|
@@ -9,6 +9,7 @@ use app\common\model\ShopGoodsModel;
|
|
|
use app\common\model\ShopOrderGoodsModel as OrderGoods;
|
|
|
use app\common\model\ShopOrderModel;
|
|
|
use app\common\model\UserModel;
|
|
|
+use app\common\service\PayConfigService;
|
|
|
use app\common\service\PaymentService;
|
|
|
use app\common\service\SystemConfigService;
|
|
|
use app\common\service\UserBankSignService;
|
|
@@ -39,58 +40,14 @@ class Pay
|
|
|
*/
|
|
|
public function payconfig(Request $request)
|
|
|
{
|
|
|
- $setting = [];
|
|
|
- $appresource = $request->post('app_sources', '');
|
|
|
- $order_type = $request->post('order_type');
|
|
|
- if (empty($order_type)) {
|
|
|
+ $paySource = $request->post('app_sources', '');
|
|
|
+ $orderType = $request->post('order_type');
|
|
|
+ if (empty($orderType)) {
|
|
|
return api_error_return('参数错误');
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- // 石区支付宝支付
|
|
|
- array_push($setting, ['is_open' => 1, 'channel' => 22, 'title' => '支付宝支付', 'icon' => getWebUrl() . '/static/img/payconfig/ic_zhifubao.png']);
|
|
|
-
|
|
|
- // 商城购买
|
|
|
- if ($order_type == 4) {
|
|
|
-
|
|
|
-
|
|
|
- if ($appresource == 'android') {
|
|
|
-
|
|
|
- // 石学长 银联支付
|
|
|
- array_push($setting, ['is_open' => 1, 'channel' => 15, 'title' => '银联(协议绑卡)', 'icon' => getWebUrl() . '/static/img/payconfig/ic_yinlian_pay.png']);
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- if ($appresource == 'ios') {
|
|
|
- // 石学长 银联支付
|
|
|
- array_push($setting, ['is_open' => 1, 'channel' => 15, 'title' => '银联', 'icon' => getWebUrl() . '/static/img/payconfig/ic_yinlian_pay.png']);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- // 购买服务商
|
|
|
- if ($order_type == 6) {
|
|
|
-
|
|
|
- if ($appresource == 'android') {
|
|
|
-
|
|
|
- // 石学长 银联支付
|
|
|
- array_push($setting, ['is_open' => 1, 'channel' => 15, 'title' => '银联(协议绑卡)', 'icon' => getWebUrl() . '/static/img/payconfig/ic_yinlian_pay.png']);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- if ($appresource == 'ios') {
|
|
|
-
|
|
|
- // 石学长 银联支付
|
|
|
- array_push($setting, ['is_open' => 1, 'channel' => 15, 'title' => '银联(协议绑卡)', 'icon' => getWebUrl() . '/static/img/payconfig/ic_yinlian_pay.png']);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- return api_succ_return(['msg' => '成功', 'data' => ['setting' => $setting]]);
|
|
|
+ $channelList = PayConfigService::make()->getChannelList($orderType, $paySource);
|
|
|
+ return api_succ_return(['msg' => '成功', 'data' => ['setting' => array_values($channelList)]]);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -141,6 +98,7 @@ class Pay
|
|
|
}
|
|
|
|
|
|
// 加锁
|
|
|
+ $result = false;
|
|
|
RedisCache::setnx($cacheKeyLock, 1, rand(2, 3));
|
|
|
try {
|
|
|
|
|
@@ -153,12 +111,17 @@ class Pay
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (!in_array($channel, [14, 15, 20, 22])) {
|
|
|
- throw new Exception('支付类型错误');
|
|
|
+ $channelList = PayConfigService::make()->getChannelList($orderType, $app_sources);
|
|
|
+ if(empty($channelList)){
|
|
|
+ throw new Exception('支付渠道暂未开放,请先配置');
|
|
|
}
|
|
|
|
|
|
- if ($post['order_type'] == 4) {
|
|
|
+ $channels = $channelList? array_keys($channelList) : [15, 22, 66];
|
|
|
+ if (!in_array($channel, $channels)) {
|
|
|
+ throw new Exception('支付类型错误或未开放');
|
|
|
+ }
|
|
|
|
|
|
+ if ($post['order_type'] == 4) {
|
|
|
if (empty($post['order_id'])) {
|
|
|
throw new Exception('参数错误');
|
|
|
}
|
|
@@ -263,6 +226,13 @@ class Pay
|
|
|
$result = $pay->getYsfPayInfoTY($request->uid, $request->data);
|
|
|
}
|
|
|
break;
|
|
|
+ case 66:
|
|
|
+ // 电科云闪付
|
|
|
+ {
|
|
|
+ $pay = new ThirdPayServices();
|
|
|
+ $result = $pay->getPayInfoDiankeYsf($request->uid, $request->data);
|
|
|
+ }
|
|
|
+ break;
|
|
|
}
|
|
|
|
|
|
} catch (Exception $e) {
|
|
@@ -271,7 +241,7 @@ class Pay
|
|
|
}
|
|
|
|
|
|
RedisCache::keyDel("caches:paymentCall:u{$request->uid}_ot{$orderType}*");
|
|
|
- return $result;
|
|
|
+ return $result? $result : api_error_return('支付请求错误或未开放,请联系客服');
|
|
|
|
|
|
}
|
|
|
|