|
|
@@ -174,8 +174,8 @@ class WechatService extends BaseService
|
|
|
$config = $configService->getConfigByGroup(7);
|
|
|
$config = $config ? $config : $defConfig;
|
|
|
$config['notify'] = isset($defConfig['notify']) ? $defConfig['notify'] : [];
|
|
|
- if ($key) {
|
|
|
- return isset($config[$key]) ? $config[$key]['value'] : '';
|
|
|
+ if ($key && $key != 'notify') {
|
|
|
+ return isset($config[$key]['value']) ? $config[$key]['value'] : '';
|
|
|
} else {
|
|
|
return $config ? $config : [];
|
|
|
}
|
|
|
@@ -434,7 +434,7 @@ class WechatService extends BaseService
|
|
|
$appId = WechatService::getConfigs('wx_appid');
|
|
|
$mchId = WechatService::getConfigs('wx_mch_id');
|
|
|
$notifyUrls = WechatService::getConfigs('notify');
|
|
|
- $notifyUrl = isset($notifyUrls[$scene]) ? url()->formatRoot('//').$notifyUrls[$scene] : url()->formatRoot('//').'/api/notify/pay/index';
|
|
|
+ $notifyUrl = isset($notifyUrls[$scene]) ? url()->formatRoot('http://').$notifyUrls[$scene] : url()->formatRoot('http://').'/api/notify/pay/index';
|
|
|
$openid = isset($order['openid']) ? trim($order['openid']) : '';
|
|
|
$orderNo = isset($order['orderNo']) ? trim($order['orderNo']) : '';
|
|
|
$totalFee = isset($order['amount']) ? moneyFormat($order['amount']) : 0.00;
|
|
|
@@ -462,18 +462,18 @@ class WechatService extends BaseService
|
|
|
'trade_type' => 'JSAPI',
|
|
|
);
|
|
|
|
|
|
- RedisService::set('orders:'.$scene.':'.$openid.':unified', $unified, 600);
|
|
|
+ RedisService::set('caches:orders:'.$scene.':'.$openid.':unified', $unified, 600);
|
|
|
$unified['sign'] = WechatService::getPaySign($unified);
|
|
|
- RedisService::set('orders:'.$scene.':'.$openid.':unifiedSign', $unified, 600);
|
|
|
+ RedisService::set('caches:orders:'.$scene.':'.$openid.':unifiedSign', $unified, 600);
|
|
|
$url = !empty(self::$apiUrl['unifiedorder']) ? trim(self::$apiUrl['unifiedorder']) : 'https://api.mch.weixin.qq.com/pay/unifiedorder';
|
|
|
$data = WechatService::arrayToXml($unified);
|
|
|
- RedisService::set('orders:'.$scene.':'.$openid.':unifiedXml', ['data'=> $unified,'result'=> $data], 600);
|
|
|
+ RedisService::set('caches:orders:'.$scene.':'.$openid.':unifiedXml', ['data'=> $unified,'result'=> $data], 600);
|
|
|
$responseXml = WechatService::curlPost($url, $data);
|
|
|
//禁止引用外部xml实体
|
|
|
libxml_disable_entity_loader(true);
|
|
|
$unifiedOrder = simplexml_load_string($responseXml, 'SimpleXMLElement', LIBXML_NOCDATA);
|
|
|
$unifiedOrder = (array)$unifiedOrder;
|
|
|
- RedisService::set('orders:'.$scene.':'.$openid.':unifiedResult', ['data'=> $unifiedOrder,'result'=> $data], 600);
|
|
|
+ RedisService::set('caches:orders:'.$scene.':'.$openid.':unifiedResult', ['data'=> $unifiedOrder,'result'=> $data], 600);
|
|
|
if ($unifiedOrder === false) {
|
|
|
return ['code' => 'exception', 'message' => 'parase xml error'];
|
|
|
}
|
|
|
@@ -527,19 +527,19 @@ class WechatService extends BaseService
|
|
|
$unified['re_user_name'] = isset($order['real_name']) ? trim($order['real_name']) : '';
|
|
|
}
|
|
|
|
|
|
- RedisService::set('orders:'.$scene.':'.$openid.':unified', $unified, 600);
|
|
|
+ RedisService::set('caches:orders:'.$scene.':'.$openid.':unified', $unified, 600);
|
|
|
$unified['sign'] = WechatService::getPaySign($unified);
|
|
|
- RedisService::set('orders:'.$scene.':'.$openid.':unifiedSign', $unified, 600);
|
|
|
+ RedisService::set('caches:orders:'.$scene.':'.$openid.':unifiedSign', $unified, 600);
|
|
|
$url = !empty(self::$apiUrl['transfers']) ? trim(self::$apiUrl['transfers']) : 'https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers';
|
|
|
$data = WechatService::arrayToXml($unified);
|
|
|
- RedisService::set('orders:'.$scene.':'.$openid.':unifiedXml', ['data'=> $unified,'result'=> $data], 600);
|
|
|
+ RedisService::set('caches:orders:'.$scene.':'.$openid.':unifiedXml', ['data'=> $unified,'result'=> $data], 600);
|
|
|
$responseXml = WechatService::curlPost($url, $data, [], self::$certPaths);
|
|
|
|
|
|
//禁止引用外部xml实体
|
|
|
libxml_disable_entity_loader(true);
|
|
|
$result = simplexml_load_string($responseXml, 'SimpleXMLElement', LIBXML_NOCDATA);
|
|
|
$result = (array)$result;
|
|
|
- RedisService::set('orders:'.$scene.':'.$openid.':unifiedResult', ['data'=> $result,'result'=> $data], 600);
|
|
|
+ RedisService::set('caches:orders:'.$scene.':'.$openid.':unifiedResult', ['data'=> $result,'result'=> $data], 600);
|
|
|
if ($result === false) {
|
|
|
return ['code' => 'exception', 'message' => 'parase xml error'];
|
|
|
}
|
|
|
@@ -718,9 +718,10 @@ class WechatService extends BaseService
|
|
|
$sign = WechatService::getPaySign($notifyData);
|
|
|
if ($nofitySign == $sign) {
|
|
|
echo '<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>';
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
- return true;
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
/**
|