57 lines
1.8 KiB
PHP
57 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace Modules\Payment\Models;
|
|
|
|
use App\Models\Model;
|
|
use GeneaLabs\LaravelModelCaching\Traits\Cachable;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class Alipay extends Model
|
|
{
|
|
|
|
use Cachable,
|
|
SoftDeletes;
|
|
|
|
protected $table = 'payment_alipays';
|
|
|
|
protected $casts = [
|
|
'log' => 'json',
|
|
];
|
|
|
|
/**
|
|
* Notes : 生成配置文件
|
|
*
|
|
* @Date : 2021/5/26 2:21 下午
|
|
* @Author : < Jason.C >
|
|
* @return int[]
|
|
*/
|
|
public function toConfig(): array
|
|
{
|
|
$ali_public_key = $this->ali_public_key ?? '';
|
|
if ($this->alipay_cert_path) {
|
|
$ali_public_key = storage_path('app/'.$this->alipay_cert_path);
|
|
}
|
|
|
|
return [
|
|
'app_id' => $this->app_id ?? '',
|
|
'notify_url' => $this->notify_url ?? '',
|
|
'return_url' => $this->return_url ?? '',
|
|
'ali_public_key' => $ali_public_key,
|
|
'app_secret_cert' => $this->private_key ?? '',
|
|
//应用公钥证书
|
|
'app_public_cert_path' => $this->app_cert_path ? storage_path('app/'.$this->app_cert_path) : '',
|
|
//支付宝公钥证书
|
|
'alipay_public_cert_path' => $this->alipay_cert_path ? storage_path('app/'.$this->alipay_cert_path) : '',
|
|
'alipay_root_cert_path' => $this->alipay_root_cert_path ? storage_path('app/'.$this->alipay_root_cert_path) : '',
|
|
'logger' => [
|
|
'enable' => true,
|
|
'file' => storage_path('logs/alipay/'.$this->log['file'].'.log'),
|
|
'level' => $this->log['level'],
|
|
'type' => $this->log['type'],
|
|
'max_file' => (int) $this->log['max_file'],
|
|
],
|
|
];
|
|
}
|
|
|
|
}
|