|
@@ -11,6 +11,7 @@ use app\model\PayDetail;
|
|
|
use app\model\SysDept;
|
|
|
use support\Db;
|
|
|
use support\exception\BusinessException;
|
|
|
+use support\Log as SupportLog;
|
|
|
use support\Redis;
|
|
|
use Yansongda\Pay\Log;
|
|
|
use Yansongda\Pay\Pay;
|
|
@@ -195,9 +196,17 @@ class OrderService
|
|
|
*/
|
|
|
public static function qrcodePay($params)
|
|
|
{
|
|
|
+ $log = SupportLog::channel('pay');
|
|
|
+ $log->info("PAY_PARAMS",json_decode(json_encode($params),true));
|
|
|
$params['order_amount_pay'] = floatval($params['order_amount_pay']);
|
|
|
$qrcodeNbr = $params['qrcode_nbr'];
|
|
|
$prefix = substr($qrcodeNbr,0,2);
|
|
|
+ // 模拟数据
|
|
|
+ // $result = [
|
|
|
+ // 'return_code'=>'SUCCESS',
|
|
|
+ // 'result_code' => 'SUCCESS'
|
|
|
+ // ];
|
|
|
+ // return $result;
|
|
|
// 微信支付
|
|
|
if(in_array($prefix,[10,11,12,13,14,15])){
|
|
|
$payData = [
|
|
@@ -209,11 +218,11 @@ class OrderService
|
|
|
try{
|
|
|
$result = Pay::wechat(config('payment.wxpay'))->pos($payData);
|
|
|
}catch(\Exception $e){
|
|
|
- Log::error("WXPAY",['msg'=>$e->getMessage()]);
|
|
|
+ $log->error("WXPAY",['msg'=>$e->getMessage()]);
|
|
|
throw new BusinessException("支付失败");
|
|
|
}
|
|
|
|
|
|
- Log::info("WXPAY_RETURN",json_decode(json_encode($result),true));
|
|
|
+ $log->info("WXPAY_RETURN",json_decode(json_encode($result),true));
|
|
|
|
|
|
}else if(in_array($prefix,[25,26,27,28,29,30])){
|
|
|
$payData = [
|
|
@@ -225,11 +234,11 @@ class OrderService
|
|
|
try{
|
|
|
$result = Pay::alipay(config('payment.alipay'))->pos($payData);
|
|
|
}catch(\Exception $e){
|
|
|
- Log::error("ALIPAY",['msg'=>$e->getMessage()]);
|
|
|
+ $log->error("ALIPAY",['msg'=>$e->getMessage()]);
|
|
|
throw new BusinessException("支付失败");
|
|
|
}
|
|
|
|
|
|
- Log::info("ALIPAY_RETURN",json_decode(json_encode($result),true));
|
|
|
+ $log->info("ALIPAY_RETURN",json_decode(json_encode($result),true));
|
|
|
|
|
|
}else{
|
|
|
throw new BusinessException("二维码无效");
|