@@ -33,92 +33,35 @@ public function configRegister()
3333 public function gatewayRegister ()
3434 {
3535 $ this ->where ('status ' , true )->get ()->map (function ($ item ) {
36+ //获取证书密钥文件路径
3637 $ upload = new Upload ();
3738 $ private_key = storage_path ('app/ ' .$ upload ->getUploadWhereFirst ($ item ->private_key )->path );
3839 $ public_key = storage_path ('app/ ' .$ upload ->getUploadWhereFirst ($ item ->public_key )->path );
3940 switch ($ item ->gateway ) {
41+ case 'alipay ' :
42+ config (['laravel-omnipay.gateways. ' .$ item ->gateway .'.driver ' => $ item ->driver ]);
43+ config (['laravel-omnipay.gateways. ' .$ item ->gateway .'.options ' => [
44+ 'signType ' => $ item ->other ,
45+ 'appId ' => $ item ->app_id ,
46+ 'sellerEmail ' => $ item ->seller_id ,
47+ 'privateKey ' => $ private_key ,
48+ 'alipayPublicKey ' => $ public_key ,
49+ 'returnUrl ' => $ item ->return_url ,
50+ 'notifyUrl ' => $ item ->notify_url
51+ ]]);
52+ break ;
4053 case 'unionpay ' :
4154 config (['laravel-omnipay.gateways. ' .$ item ->gateway .'.driver ' => $ item ->driver ]);
4255 config (['laravel-omnipay.gateways. ' .$ item ->gateway .'.options ' => [
4356 'merId ' => $ item ->app_id ,
4457 'certPath ' => $ private_key ,
4558 'certPassword ' => $ item ->other ,
46- 'certDir ' => storage_path ('app/certificates/unionpay ' ),
4759 'certDir ' => substr ($ public_key ,0 ,strripos ($ public_key ,'/ ' )), //这里需要目录
4860 'returnUrl ' => $ item ->return_url ,
4961 'notifyUrl ' => $ item ->notify_url
5062 ]]);
5163 break ;
5264 }
5365 });
54- // dd(config('laravel-omnipay.gateways'));
55- /**
56- * [加载云磁盘配置]
57- * @var [type]
58- */
59- // $this->all()->map(function ($disks) {
60- // $transport = $disks->transport? 'https': 'http';
61- // switch ($disks->driver) {
62- // case 'oss':
63- // $isCName = strstr($disks->domain,"aliyuncs.com")? false: true;//不包含阿里云自动启用自定义域名
64- // config(['filesystems.disks.'.$disks->disks => [
65- // 'driver' => 'oss',
66- // 'accessKeyId' => $disks->access_id,
67- // 'accessKeySecret' => $disks->access_key,
68- // 'endpoint' => $disks->domain,
69- // 'isCName' => $isCName,
70- // 'securityToken' => null,
71- // 'bucket' => $disks->bucket,
72- // 'timeout' => '5184000',
73- // 'connectTimeout' => '10',
74- // 'transport' => $transport,//如果支持https,请填写https,如果不支持请填写http
75- // 'max_keys' => 1000,//max-keys用于限定此次返回object的最大数,如果不设定,默认为100,max-keys取值不能大于1000
76- // ]]);
77- // break;
78- // case 'qiniu':
79- // config(['filesystems.disks.'.$disks->disks => [
80- // 'driver' => 'qiniu',
81- // 'domain' => $disks->domain,//你的七牛域名
82- // 'access_key' => $disks->access_id,//AccessKey
83- // 'secret_key' => $disks->access_key,//SecretKey
84- // 'bucket' => $disks->bucket,//Bucket名字
85- // 'transport' => $transport,//如果支持https,请填写https,如果不支持请填写http
86- // ]]);
87- // break;
88- // case 'upyun':
89- // config(['filesystems.disks.'.$disks->disks => [
90- // 'driver' => 'upyun',
91- // 'domain' => $disks->domain,//你的upyun域名
92- // 'username' => $disks->access_id,//UserName
93- // 'password' => $disks->access_key,//Password
94- // 'bucket' => $disks->bucket,//Bucket名字
95- // 'timeout' => 130,//超时时间
96- // 'endpoint' => null,//线路
97- // 'transport' => $transport,//如果支持https,请填写https,如果不支持请填写http
98- // ]]);
99- // break;
100- // case 'cos':
101- // config(['filesystems.disks.'.$disks->disks => [
102- // 'driver' => 'cos',
103- // 'domain' => $disks->domain, // 你的 COS 域名
104- // 'app_id' => $disks->app_id,
105- // 'secret_id' => $disks->access_id,
106- // 'secret_key' => $disks->access_key,
107- // 'region' => $disks->region, // 设置COS所在的区域
108- // 'transport' => $transport, // 如果支持 https,请填写 https,如果不支持请填写 http
109- // 'timeout' => 60, // 超时时间
110- // 'bucket' => $disks->bucket,
111- // ]]);
112- // break;
113- // }
114- // });
115- // /**
116- // * [$defaultDisks 挂载默认磁盘]
117- // * @var [type]
118- // */
119- // $default = $this->where('status',1)->first();
120- // if ($default) {
121- // config(['filesystems.default' => $default->disks]);
122- // }
12366 }
12467}
0 commit comments