Merge branch 'hotfix/payNotifyUrl' of http://git.dev.yoho.cn/web/yohobuy into hotfix/payNotifyUrl
Showing
23 changed files
with
290 additions
and
344 deletions
@@ -6,6 +6,7 @@ use DOMDocument; | @@ -6,6 +6,7 @@ use DOMDocument; | ||
6 | use WebPlugin\Pay\PayAbstract; | 6 | use WebPlugin\Pay\PayAbstract; |
7 | use WebPlugin\Pay\Reqparams; | 7 | use WebPlugin\Pay\Reqparams; |
8 | use WebPlugin\Pay\Rspparams; | 8 | use WebPlugin\Pay\Rspparams; |
9 | +use WebPlugin\UdpLog; | ||
9 | 10 | ||
10 | class Service extends PayAbstract | 11 | class Service extends PayAbstract |
11 | { | 12 | { |
@@ -107,6 +108,7 @@ class Service extends PayAbstract | @@ -107,6 +108,7 @@ class Service extends PayAbstract | ||
107 | /* 返回示例 | 108 | /* 返回示例 |
108 | * http://www.yohobuy.com/pay/notice/aliexpressgatewayreturn?buyer_email=tds%40smartunite.com&buyer_id=2088302294447308&exterface=create_direct_pay_by_user&is_success=T¬ify_id=RqPnCoPT3K9%252Fvwbh3I7xtEV5W65QRToFQ5fPrXsVxt12e%252FExCtC1XNiKnuRwupLaVLAR¬ify_time=2011-06-11+07%3A48%3A10¬ify_type=trade_status_sync&out_trade_no=1061003000&payment_type=1&seller_email=shop%40yoho.cn&seller_id=2088001550230585&subject=YOHO%E5%95%86%E5%93%81&total_fee=0.01&trade_no=2011061199833830&trade_status=TRADE_SUCCESS&sign=ca1c49f58d17eaa57aac308d0ac64434&sign_type=MD5 | 109 | * http://www.yohobuy.com/pay/notice/aliexpressgatewayreturn?buyer_email=tds%40smartunite.com&buyer_id=2088302294447308&exterface=create_direct_pay_by_user&is_success=T¬ify_id=RqPnCoPT3K9%252Fvwbh3I7xtEV5W65QRToFQ5fPrXsVxt12e%252FExCtC1XNiKnuRwupLaVLAR¬ify_time=2011-06-11+07%3A48%3A10¬ify_type=trade_status_sync&out_trade_no=1061003000&payment_type=1&seller_email=shop%40yoho.cn&seller_id=2088001550230585&subject=YOHO%E5%95%86%E5%93%81&total_fee=0.01&trade_no=2011061199833830&trade_status=TRADE_SUCCESS&sign=ca1c49f58d17eaa57aac308d0ac64434&sign_type=MD5 |
109 | */ | 110 | */ |
111 | + UdpLog::info("【{$this->logProjectPrefix}-支付】,function:parseResponse,参数", $arrResponse); | ||
110 | if(isset($arrResponse['q'])){ | 112 | if(isset($arrResponse['q'])){ |
111 | unset($arrResponse['q']); | 113 | unset($arrResponse['q']); |
112 | } | 114 | } |
@@ -129,6 +131,7 @@ class Service extends PayAbstract | @@ -129,6 +131,7 @@ class Service extends PayAbstract | ||
129 | $rsp->tradeNo = $arrResponse['trade_no']; | 131 | $rsp->tradeNo = $arrResponse['trade_no']; |
130 | $rsp->bankBillNo = ""; | 132 | $rsp->bankBillNo = ""; |
131 | } | 133 | } |
134 | + UdpLog::info("【{$this->logProjectPrefix}-支付】,function:parseResponse,处理结果", $rsp); | ||
132 | return $rsp; | 135 | return $rsp; |
133 | } | 136 | } |
134 | 137 |
@@ -77,15 +77,5 @@ class Config | @@ -77,15 +77,5 @@ class Config | ||
77 | 'ip_enable' => false, | 77 | 'ip_enable' => false, |
78 | 'timestamp_enable' => false | 78 | 'timestamp_enable' => false |
79 | ); | 79 | ); |
80 | - | ||
81 | - /** | ||
82 | - * @var string 日志目录 | ||
83 | - */ | ||
84 | - var $logDir = '/Data/logs/pc_pay/alibank'; | ||
85 | - | ||
86 | - /** | ||
87 | - * @var int 日志等级 | ||
88 | - */ | ||
89 | - var $logLevel = 2; // 记录信息日志 | ||
90 | } | 80 | } |
91 | 81 |
@@ -6,14 +6,13 @@ use DOMDocument; | @@ -6,14 +6,13 @@ use DOMDocument; | ||
6 | use WebPlugin\Pay\PayAbstract; | 6 | use WebPlugin\Pay\PayAbstract; |
7 | use WebPlugin\Pay\Reqparams; | 7 | use WebPlugin\Pay\Reqparams; |
8 | use WebPlugin\Pay\Rspparams; | 8 | use WebPlugin\Pay\Rspparams; |
9 | -use WebPlugin\PhpLog; | 9 | +use WebPlugin\UdpLog; |
10 | use Api\Yohobuy; | 10 | use Api\Yohobuy; |
11 | use Plugin\Helpers; | 11 | use Plugin\Helpers; |
12 | 12 | ||
13 | class Service extends PayAbstract | 13 | class Service extends PayAbstract |
14 | { | 14 | { |
15 | public $config; | 15 | public $config; |
16 | - private $log; | ||
17 | 16 | ||
18 | public function __construct(array $paymentParams) | 17 | public function __construct(array $paymentParams) |
19 | { | 18 | { |
@@ -23,8 +22,6 @@ class Service extends PayAbstract | @@ -23,8 +22,6 @@ class Service extends PayAbstract | ||
23 | $this->config->partner = $myConfig->merchant_id; | 22 | $this->config->partner = $myConfig->merchant_id; |
24 | $this->config->alipay_key = $myConfig->merchant_key; | 23 | $this->config->alipay_key = $myConfig->merchant_key; |
25 | $this->config->sellerMail = $myConfig->merchant_other_code; | 24 | $this->config->sellerMail = $myConfig->merchant_other_code; |
26 | - | ||
27 | - $this->log = new PhpLog($this->config->logDir, "PRC", $this->config->logLevel); | ||
28 | } | 25 | } |
29 | 26 | ||
30 | /** | 27 | /** |
@@ -47,7 +44,7 @@ class Service extends PayAbstract | @@ -47,7 +44,7 @@ class Service extends PayAbstract | ||
47 | // $baseUrl = $this->getBaseNoticeUrl($params->isTest); | 44 | // $baseUrl = $this->getBaseNoticeUrl($params->isTest); |
48 | // $loseTime = intval(($params->orderTime + 7200 - time()) / 60); | 45 | // $loseTime = intval(($params->orderTime + 7200 - time()) / 60); |
49 | // $loseTime = intval((strtotime(date("Y-m-d 10:00:00", strtotime("+1 day")))-time())/60); | 46 | // $loseTime = intval((strtotime(date("Y-m-d 10:00:00", strtotime("+1 day")))-time())/60); |
50 | - | 47 | + UdpLog::info("【{$this->logProjectPrefix}-支付宝银行支付】,function:getPayRequestPars,参数", $params); |
51 | $parameter = array( | 48 | $parameter = array( |
52 | 'service' => $this->config->service, | 49 | 'service' => $this->config->service, |
53 | 'partner' => $this->config->partner, | 50 | 'partner' => $this->config->partner, |
@@ -114,22 +111,15 @@ class Service extends PayAbstract | @@ -114,22 +111,15 @@ class Service extends PayAbstract | ||
114 | /* 返回示例 | 111 | /* 返回示例 |
115 | * http://www.yohobuy.com/pay/notice/alipayreturn?buyer_email=tds%40smartunite.com&buyer_id=2088302294447308&exterface=create_direct_pay_by_user&is_success=T¬ify_id=RqPnCoPT3K9%252Fvwbh3I7xtEV5W65QRToFQ5fPrXsVxt12e%252FExCtC1XNiKnuRwupLaVLAR¬ify_time=2011-06-11+07%3A48%3A10¬ify_type=trade_status_sync&out_trade_no=1061003000&payment_type=1&seller_email=shop%40yoho.cn&seller_id=2088001550230585&subject=YOHO%E5%95%86%E5%93%81&total_fee=0.01&trade_no=2011061199833830&trade_status=TRADE_SUCCESS&sign=ca1c49f58d17eaa57aac308d0ac64434&sign_type=MD5 | 112 | * http://www.yohobuy.com/pay/notice/alipayreturn?buyer_email=tds%40smartunite.com&buyer_id=2088302294447308&exterface=create_direct_pay_by_user&is_success=T¬ify_id=RqPnCoPT3K9%252Fvwbh3I7xtEV5W65QRToFQ5fPrXsVxt12e%252FExCtC1XNiKnuRwupLaVLAR¬ify_time=2011-06-11+07%3A48%3A10¬ify_type=trade_status_sync&out_trade_no=1061003000&payment_type=1&seller_email=shop%40yoho.cn&seller_id=2088001550230585&subject=YOHO%E5%95%86%E5%93%81&total_fee=0.01&trade_no=2011061199833830&trade_status=TRADE_SUCCESS&sign=ca1c49f58d17eaa57aac308d0ac64434&sign_type=MD5 |
116 | */ | 113 | */ |
117 | - $this->log->LogInfo("===开始解析支付宝银行的回调参数==="); | ||
118 | - $this->log->LogInfo("-----回调参数为---"); | ||
119 | - $this->log->LogInfo(var_export($arrResponse, true)); | ||
120 | - | 114 | + UdpLog::info("【{$this->logProjectPrefix}-支付宝银行支付】,function:parseResponse,回调参数", $arrResponse); |
121 | if (isset($arrResponse['q'])) { | 115 | if (isset($arrResponse['q'])) { |
122 | unset($arrResponse['q']); | 116 | unset($arrResponse['q']); |
123 | } | 117 | } |
124 | $rsp = new Rspparams(); | 118 | $rsp = new Rspparams(); |
125 | if (!$this->checkResponse($arrResponse)) { | 119 | if (!$this->checkResponse($arrResponse)) { |
126 | - $this->log->LogInfo("---验证支付宝银行的回调参数失败---"); | ||
127 | - | ||
128 | //验证不成功 | 120 | //验证不成功 |
129 | $rsp->payResult = -1; | 121 | $rsp->payResult = -1; |
130 | } else { | 122 | } else { |
131 | - $this->log->LogInfo("---验证支付宝银行的回调参数成功---"); | ||
132 | - | ||
133 | $rsp->bankName = ""; | 123 | $rsp->bankName = ""; |
134 | $outTradeNo = $arrResponse["out_trade_no"]; | 124 | $outTradeNo = $arrResponse["out_trade_no"]; |
135 | // if(strlen($outTradeNo) > 9) { | 125 | // if(strlen($outTradeNo) > 9) { |
@@ -146,11 +136,8 @@ class Service extends PayAbstract | @@ -146,11 +136,8 @@ class Service extends PayAbstract | ||
146 | $rsp->payOrderCode = $outTradeNo; | 136 | $rsp->payOrderCode = $outTradeNo; |
147 | $rsp->tradeNo = $arrResponse['trade_no']; | 137 | $rsp->tradeNo = $arrResponse['trade_no']; |
148 | $rsp->bankBillNo = $arrResponse['bank_seq_no'] ? $arrResponse['bank_seq_no'] : ""; | 138 | $rsp->bankBillNo = $arrResponse['bank_seq_no'] ? $arrResponse['bank_seq_no'] : ""; |
149 | - | ||
150 | - $this->log->LogInfo('----支付宝银行回调处理结果为----'); | ||
151 | - $this->log->LogInfo(var_export($rsp, true)); | ||
152 | } | 139 | } |
153 | - | 140 | + UdpLog::info("【{$this->logProjectPrefix}-支付宝银行支付】,function:parseResponse,回调参数处理结果", $rsp); |
154 | return $rsp; | 141 | return $rsp; |
155 | } | 142 | } |
156 | 143 |
@@ -6,7 +6,7 @@ use DOMDocument; | @@ -6,7 +6,7 @@ use DOMDocument; | ||
6 | use WebPlugin\Pay\PayAbstract; | 6 | use WebPlugin\Pay\PayAbstract; |
7 | use WebPlugin\Pay\Reqparams; | 7 | use WebPlugin\Pay\Reqparams; |
8 | use WebPlugin\Pay\Rspparams; | 8 | use WebPlugin\Pay\Rspparams; |
9 | - | 9 | +use WebPlugin\UdpLog; |
10 | class Service extends PayAbstract | 10 | class Service extends PayAbstract |
11 | { | 11 | { |
12 | 12 | ||
@@ -40,7 +40,7 @@ class Service extends PayAbstract | @@ -40,7 +40,7 @@ class Service extends PayAbstract | ||
40 | public function getPayRequestPars(Reqparams $params) | 40 | public function getPayRequestPars(Reqparams $params) |
41 | { | 41 | { |
42 | $baseUrl = $this->getBaseNoticeUrl($params->isTest); | 42 | $baseUrl = $this->getBaseNoticeUrl($params->isTest); |
43 | - $loseTime = intval(($params->orderTime + 7200 -time())/60); | 43 | +// $loseTime = intval(($params->orderTime + 7200 -time())/60); |
44 | // $loseTime = intval((strtotime(date("Y-m-d 10:00:00", strtotime("+1 day")))-time())/60); //第二天十点 | 44 | // $loseTime = intval((strtotime(date("Y-m-d 10:00:00", strtotime("+1 day")))-time())/60); //第二天十点 |
45 | $parameter = array( | 45 | $parameter = array( |
46 | 'service' => $this->config->service, | 46 | 'service' => $this->config->service, |
@@ -99,6 +99,7 @@ class Service extends PayAbstract | @@ -99,6 +99,7 @@ class Service extends PayAbstract | ||
99 | /* 返回示例 | 99 | /* 返回示例 |
100 | * http://www.yohobuy.com/pay/notice/alibarcodereturn?buyer_email=tds%40smartunite.com&buyer_id=2088302294447308&exterface=create_direct_pay_by_user&is_success=T¬ify_id=RqPnCoPT3K9%252Fvwbh3I7xtEV5W65QRToFQ5fPrXsVxt12e%252FExCtC1XNiKnuRwupLaVLAR¬ify_time=2011-06-11+07%3A48%3A10¬ify_type=trade_status_sync&out_trade_no=1061003000&payment_type=1&seller_email=shop%40yoho.cn&seller_id=2088001550230585&subject=YOHO%E5%95%86%E5%93%81&total_fee=0.01&trade_no=2011061199833830&trade_status=TRADE_SUCCESS&sign=ca1c49f58d17eaa57aac308d0ac64434&sign_type=MD5 | 100 | * http://www.yohobuy.com/pay/notice/alibarcodereturn?buyer_email=tds%40smartunite.com&buyer_id=2088302294447308&exterface=create_direct_pay_by_user&is_success=T¬ify_id=RqPnCoPT3K9%252Fvwbh3I7xtEV5W65QRToFQ5fPrXsVxt12e%252FExCtC1XNiKnuRwupLaVLAR¬ify_time=2011-06-11+07%3A48%3A10¬ify_type=trade_status_sync&out_trade_no=1061003000&payment_type=1&seller_email=shop%40yoho.cn&seller_id=2088001550230585&subject=YOHO%E5%95%86%E5%93%81&total_fee=0.01&trade_no=2011061199833830&trade_status=TRADE_SUCCESS&sign=ca1c49f58d17eaa57aac308d0ac64434&sign_type=MD5 |
101 | */ | 101 | */ |
102 | + UdpLog::info("【{$this->logProjectPrefix}-支付】,function:parseResponse,参数", $arrResponse); | ||
102 | if(isset($arrResponse['q'])){ | 103 | if(isset($arrResponse['q'])){ |
103 | unset($arrResponse['q']); | 104 | unset($arrResponse['q']); |
104 | } | 105 | } |
@@ -122,6 +123,7 @@ class Service extends PayAbstract | @@ -122,6 +123,7 @@ class Service extends PayAbstract | ||
122 | $rsp->tradeNo = $arrResponse['trade_no']; | 123 | $rsp->tradeNo = $arrResponse['trade_no']; |
123 | $rsp->bankBillNo = ""; | 124 | $rsp->bankBillNo = ""; |
124 | } | 125 | } |
126 | + UdpLog::info("【{$this->logProjectPrefix}-支付】,function:parseResponse,处理结果", $rsp); | ||
125 | return $rsp; | 127 | return $rsp; |
126 | } | 128 | } |
127 | 129 |
@@ -4,7 +4,7 @@ namespace WebPlugin\Pay\Alimobilemini; | @@ -4,7 +4,7 @@ namespace WebPlugin\Pay\Alimobilemini; | ||
4 | 4 | ||
5 | use WebPlugin\Pay\PayAbstract; | 5 | use WebPlugin\Pay\PayAbstract; |
6 | use WebPlugin\Pay\Rspparams; | 6 | use WebPlugin\Pay\Rspparams; |
7 | -use WebPlugin\PhpLog; | 7 | +use WebPlugin\UdpLog; |
8 | 8 | ||
9 | /** | 9 | /** |
10 | * 手机支付返回 | 10 | * 手机支付返回 |
@@ -14,7 +14,6 @@ use WebPlugin\PhpLog; | @@ -14,7 +14,6 @@ use WebPlugin\PhpLog; | ||
14 | class Service extends PayAbstract | 14 | class Service extends PayAbstract |
15 | { | 15 | { |
16 | public $config; | 16 | public $config; |
17 | - private $log; | ||
18 | 17 | ||
19 | private $utils; | 18 | private $utils; |
20 | 19 | ||
@@ -23,8 +22,6 @@ class Service extends PayAbstract | @@ -23,8 +22,6 @@ class Service extends PayAbstract | ||
23 | $this->logProjectPrefix = 'alimobilemini'; | 22 | $this->logProjectPrefix = 'alimobilemini'; |
24 | $this->utils = new Utils(); | 23 | $this->utils = new Utils(); |
25 | $this->config = new Config(); | 24 | $this->config = new Config(); |
26 | - | ||
27 | - $this->log = new PhpLog($this->config->logDir, 'PRC', $this->config->logLevel); | ||
28 | } | 25 | } |
29 | 26 | ||
30 | 27 | ||
@@ -48,7 +45,7 @@ class Service extends PayAbstract | @@ -48,7 +45,7 @@ class Service extends PayAbstract | ||
48 | 45 | ||
49 | // $datastr=implode("&", $data); | 46 | // $datastr=implode("&", $data); |
50 | // ################################## | 47 | // ################################## |
51 | - | 48 | + UdpLog::info("【{$this->logProjectPrefix}-支付宝极简支付】,function:parseResponse,参数", $arrResponse); |
52 | $isVerify = $this->utils->getSignVeryfy($arrResponse); | 49 | $isVerify = $this->utils->getSignVeryfy($arrResponse); |
53 | if ($isVerify) { | 50 | if ($isVerify) { |
54 | //验证成功 | 51 | //验证成功 |
@@ -62,16 +59,11 @@ class Service extends PayAbstract | @@ -62,16 +59,11 @@ class Service extends PayAbstract | ||
62 | $rsp->payOrderCode = $arrResponse['out_trade_no']; | 59 | $rsp->payOrderCode = $arrResponse['out_trade_no']; |
63 | $rsp->tradeNo = $arrResponse['trade_no']; | 60 | $rsp->tradeNo = $arrResponse['trade_no']; |
64 | $rsp->bankBillNo = ""; | 61 | $rsp->bankBillNo = ""; |
65 | - | ||
66 | - $this->log->LogInfo(var_export($arrResponse, true)); | ||
67 | - $this->log->LogInfo('======alimobilemini成功==='); | ||
68 | } else { | 62 | } else { |
69 | //不成功 | 63 | //不成功 |
70 | $rsp->payResult = -1; | 64 | $rsp->payResult = -1; |
71 | - $this->log->LogInfo(var_export($arrResponse, true)); | ||
72 | - $this->log->LogInfo('======alimobilemini失败===订单号----->' . $arrResponse['out_trade_no']); | ||
73 | } | 65 | } |
74 | - | 66 | + UdpLog::info("【{$this->logProjectPrefix}-支付宝极简支付】,function:parseResponse,处理结果", $rsp); |
75 | return $rsp; | 67 | return $rsp; |
76 | } | 68 | } |
77 | 69 |
@@ -80,14 +80,4 @@ class Config | @@ -80,14 +80,4 @@ class Config | ||
80 | 'ip_enable' => false, | 80 | 'ip_enable' => false, |
81 | 'timestamp_enable' => false | 81 | 'timestamp_enable' => false |
82 | ); | 82 | ); |
83 | - | ||
84 | - /** | ||
85 | - * @var string 日志目录 | ||
86 | - */ | ||
87 | - var $logDir = '/Data/logs/pc_pay/alipay'; | ||
88 | - | ||
89 | - /** | ||
90 | - * @var string 日志等级 | ||
91 | - */ | ||
92 | - var $logLevel = 2; // 记录信息日志 | ||
93 | } | 83 | } |
@@ -5,7 +5,7 @@ namespace WebPlugin\Pay\Alipay; | @@ -5,7 +5,7 @@ namespace WebPlugin\Pay\Alipay; | ||
5 | use WebPlugin\Pay\PayAbstract; | 5 | use WebPlugin\Pay\PayAbstract; |
6 | use WebPlugin\Pay\Reqparams; | 6 | use WebPlugin\Pay\Reqparams; |
7 | use WebPlugin\Pay\Rspparams; | 7 | use WebPlugin\Pay\Rspparams; |
8 | -use WebPlugin\PhpLog; | 8 | +use WebPlugin\UdpLog; |
9 | use Api\Yohobuy; | 9 | use Api\Yohobuy; |
10 | use Plugin\Helpers; | 10 | use Plugin\Helpers; |
11 | 11 | ||
@@ -13,7 +13,6 @@ class Service extends PayAbstract | @@ -13,7 +13,6 @@ class Service extends PayAbstract | ||
13 | { | 13 | { |
14 | 14 | ||
15 | public $config; | 15 | public $config; |
16 | - private $log; | ||
17 | 16 | ||
18 | public function __construct(array $paymentParams) | 17 | public function __construct(array $paymentParams) |
19 | { | 18 | { |
@@ -23,8 +22,6 @@ class Service extends PayAbstract | @@ -23,8 +22,6 @@ class Service extends PayAbstract | ||
23 | $this->config->partner = $myConfig->merchant_id; | 22 | $this->config->partner = $myConfig->merchant_id; |
24 | $this->config->alipay_key = $myConfig->merchant_key; | 23 | $this->config->alipay_key = $myConfig->merchant_key; |
25 | $this->config->sellerMail = $myConfig->merchant_other_code; | 24 | $this->config->sellerMail = $myConfig->merchant_other_code; |
26 | - | ||
27 | - $this->log = new PhpLog($this->config->logDir, 'PRC', $this->config->logLevel); | ||
28 | } | 25 | } |
29 | 26 | ||
30 | /** | 27 | /** |
@@ -48,10 +45,7 @@ class Service extends PayAbstract | @@ -48,10 +45,7 @@ class Service extends PayAbstract | ||
48 | */ | 45 | */ |
49 | public function getPayRequestPars(Reqparams $params) | 46 | public function getPayRequestPars(Reqparams $params) |
50 | { | 47 | { |
51 | - $this->log->LogInfo("===开始处理支付宝的请求参数==="); | ||
52 | - $this->log->LogInfo("-----请求参数为---"); | ||
53 | - $this->log->LogInfo(var_export($params, true)); | ||
54 | - | 48 | + UdpLog::info("【{$this->logProjectPrefix}-支付宝支付】,function:getPayRequestPars,参数", $params); |
55 | // $baseUrl = $this->getBaseNoticeUrl($params->isTest); | 49 | // $baseUrl = $this->getBaseNoticeUrl($params->isTest); |
56 | // $loseTime = intval(($params->orderTime + 7200 -time())/60); | 50 | // $loseTime = intval(($params->orderTime + 7200 -time())/60); |
57 | // $loseTime = intval((strtotime(date("Y-m-d 10:00:00", strtotime("+1 day")))-time())/60); //第二天十点 | 51 | // $loseTime = intval((strtotime(date("Y-m-d 10:00:00", strtotime("+1 day")))-time())/60); //第二天十点 |
@@ -103,9 +97,7 @@ class Service extends PayAbstract | @@ -103,9 +97,7 @@ class Service extends PayAbstract | ||
103 | 'reqType' => 'get' | 97 | 'reqType' => 'get' |
104 | ); | 98 | ); |
105 | 99 | ||
106 | - $this->log->LogInfo('----支付宝请求处理结果为----'); | ||
107 | - $this->log->LogInfo(var_export($result, true)); | ||
108 | - | 100 | + UdpLog::info("【{$this->logProjectPrefix}-支付宝支付】,function:getPayRequestPars,请求处理结果", $result); |
109 | return $result; | 101 | return $result; |
110 | } | 102 | } |
111 | 103 | ||
@@ -114,20 +106,15 @@ class Service extends PayAbstract | @@ -114,20 +106,15 @@ class Service extends PayAbstract | ||
114 | /* 返回示例 | 106 | /* 返回示例 |
115 | * http://www.yohobuy.com/pay/notice/alipayreturn?buyer_email=tds%40smartunite.com&buyer_id=2088302294447308&exterface=create_direct_pay_by_user&is_success=T¬ify_id=RqPnCoPT3K9%252Fvwbh3I7xtEV5W65QRToFQ5fPrXsVxt12e%252FExCtC1XNiKnuRwupLaVLAR¬ify_time=2011-06-11+07%3A48%3A10¬ify_type=trade_status_sync&out_trade_no=1061003000&payment_type=1&seller_email=shop%40yoho.cn&seller_id=2088001550230585&subject=YOHO%E5%95%86%E5%93%81&total_fee=0.01&trade_no=2011061199833830&trade_status=TRADE_SUCCESS&sign=ca1c49f58d17eaa57aac308d0ac64434&sign_type=MD5 | 107 | * http://www.yohobuy.com/pay/notice/alipayreturn?buyer_email=tds%40smartunite.com&buyer_id=2088302294447308&exterface=create_direct_pay_by_user&is_success=T¬ify_id=RqPnCoPT3K9%252Fvwbh3I7xtEV5W65QRToFQ5fPrXsVxt12e%252FExCtC1XNiKnuRwupLaVLAR¬ify_time=2011-06-11+07%3A48%3A10¬ify_type=trade_status_sync&out_trade_no=1061003000&payment_type=1&seller_email=shop%40yoho.cn&seller_id=2088001550230585&subject=YOHO%E5%95%86%E5%93%81&total_fee=0.01&trade_no=2011061199833830&trade_status=TRADE_SUCCESS&sign=ca1c49f58d17eaa57aac308d0ac64434&sign_type=MD5 |
116 | */ | 108 | */ |
117 | - $this->log->LogInfo("===开始解析支付宝的回调参数==="); | ||
118 | - $this->log->LogInfo("-----回调参数为---"); | ||
119 | - $this->log->LogInfo(var_export($arrResponse, true)); | ||
120 | - | 109 | + UdpLog::info("【{$this->logProjectPrefix}-支付宝支付】,function:parseResponse,回调参数", $arrResponse); |
121 | if (isset($arrResponse['q'])) { | 110 | if (isset($arrResponse['q'])) { |
122 | unset($arrResponse['q']); | 111 | unset($arrResponse['q']); |
123 | } | 112 | } |
124 | $rsp = new Rspparams(); | 113 | $rsp = new Rspparams(); |
125 | if (!$this->checkResponse($arrResponse)) { | 114 | if (!$this->checkResponse($arrResponse)) { |
126 | - $this->log->LogInfo("-----支付宝回调参数验证签名失败---"); | ||
127 | //验证不成功 | 115 | //验证不成功 |
128 | $rsp->payResult = -1; | 116 | $rsp->payResult = -1; |
129 | } else { | 117 | } else { |
130 | - $this->log->LogInfo("-----支付宝回调参数验证签名成功---"); | ||
131 | $rsp->bankName = ""; | 118 | $rsp->bankName = ""; |
132 | $outTradeNo = $arrResponse["out_trade_no"]; | 119 | $outTradeNo = $arrResponse["out_trade_no"]; |
133 | $rsp->orderCode = $outTradeNo; | 120 | $rsp->orderCode = $outTradeNo; |
@@ -141,9 +128,7 @@ class Service extends PayAbstract | @@ -141,9 +128,7 @@ class Service extends PayAbstract | ||
141 | $rsp->bankBillNo = ""; | 128 | $rsp->bankBillNo = ""; |
142 | } | 129 | } |
143 | 130 | ||
144 | - $this->log->LogInfo("-----解析支付宝回调参数的结果为---"); | ||
145 | - $this->log->LogInfo(var_export($rsp, true)); | ||
146 | - | 131 | + UdpLog::info("【{$this->logProjectPrefix}-支付宝支付】,function:parseResponse,回调参数的结果", $arrResponse); |
147 | return $rsp; | 132 | return $rsp; |
148 | } | 133 | } |
149 | 134 |
@@ -62,15 +62,4 @@ class Config | @@ -62,15 +62,4 @@ class Config | ||
62 | * @var unknown_type | 62 | * @var unknown_type |
63 | */ | 63 | */ |
64 | var $payType = 0; //非直连为0 | 64 | var $payType = 0; //非直连为0 |
65 | - | ||
66 | - /** | ||
67 | - * @var string 日志目录 | ||
68 | - */ | ||
69 | - var $logDir = '/Data/logs/pc_pay/allinpay'; | ||
70 | - | ||
71 | - /** | ||
72 | - * @var string 日志等级 | ||
73 | - */ | ||
74 | - var $logLevel = 2; // 记录信息日志 | ||
75 | - | ||
76 | } | 65 | } |
@@ -5,12 +5,11 @@ namespace WebPlugin\Pay\Allinpay; | @@ -5,12 +5,11 @@ namespace WebPlugin\Pay\Allinpay; | ||
5 | use WebPlugin\Pay\PayAbstract; | 5 | use WebPlugin\Pay\PayAbstract; |
6 | use WebPlugin\Pay\Reqparams; | 6 | use WebPlugin\Pay\Reqparams; |
7 | use WebPlugin\Pay\Rspparams; | 7 | use WebPlugin\Pay\Rspparams; |
8 | -use WebPlugin\PhpLog; | 8 | +use WebPlugin\UdpLog; |
9 | 9 | ||
10 | class Service extends PayAbstract | 10 | class Service extends PayAbstract |
11 | { | 11 | { |
12 | public $config; | 12 | public $config; |
13 | - private $log; | ||
14 | 13 | ||
15 | public function __construct(array $paymentParams) | 14 | public function __construct(array $paymentParams) |
16 | { | 15 | { |
@@ -19,8 +18,6 @@ class Service extends PayAbstract | @@ -19,8 +18,6 @@ class Service extends PayAbstract | ||
19 | $myConfig = json_decode($paymentParams["pay_params"]); | 18 | $myConfig = json_decode($paymentParams["pay_params"]); |
20 | $this->config->merchantId = $myConfig->merchant_id; | 19 | $this->config->merchantId = $myConfig->merchant_id; |
21 | $this->config->merchantKey = $myConfig->merchant_key; | 20 | $this->config->merchantKey = $myConfig->merchant_key; |
22 | - | ||
23 | - $this->log = new PhpLog($this->config->logDir, 'PRC', $this->config->logLevel); | ||
24 | } | 21 | } |
25 | 22 | ||
26 | /** | 23 | /** |
@@ -67,18 +64,11 @@ class Service extends PayAbstract | @@ -67,18 +64,11 @@ class Service extends PayAbstract | ||
67 | */ | 64 | */ |
68 | public function parseResponse(array $arrResponse) | 65 | public function parseResponse(array $arrResponse) |
69 | { | 66 | { |
70 | - $this->log->LogInfo("===开始处理通联支付的回调参数==="); | ||
71 | - $this->log->LogInfo("-----回调参数为---"); | ||
72 | - $this->log->LogInfo(var_export($arrResponse, true)); | ||
73 | - | 67 | + UdpLog::info("【{$this->logProjectPrefix}-通联支付】,function:parseResponse,参数", $arrResponse); |
74 | $rsp = new Rspparams(); | 68 | $rsp = new Rspparams(); |
75 | if (!$this->checkResponse($arrResponse)) { | 69 | if (!$this->checkResponse($arrResponse)) { |
76 | - $this->log->LogInfo("-----验证通联支付回调参数失败---"); | ||
77 | - | ||
78 | $rsp->payResult = -1; | 70 | $rsp->payResult = -1; |
79 | } else { | 71 | } else { |
80 | - $this->log->LogInfo("-----验证通联支付回调参数成功---"); | ||
81 | - | ||
82 | $rsp->bankName = ""; | 72 | $rsp->bankName = ""; |
83 | $rsp->orderCode = $arrResponse["orderNo"]; | 73 | $rsp->orderCode = $arrResponse["orderNo"]; |
84 | $rsp->payResult = $this->convertResult($arrResponse["payResult"]); | 74 | $rsp->payResult = $this->convertResult($arrResponse["payResult"]); |
@@ -90,7 +80,7 @@ class Service extends PayAbstract | @@ -90,7 +80,7 @@ class Service extends PayAbstract | ||
90 | $rsp->tradeNo = ""; | 80 | $rsp->tradeNo = ""; |
91 | $rsp->bankBillNo = ""; | 81 | $rsp->bankBillNo = ""; |
92 | } | 82 | } |
93 | - | 83 | + UdpLog::info("【{$this->logProjectPrefix}-通联支付】,function:parseResponse,回调参数处理结果", $arrResponse); |
94 | return $rsp; | 84 | return $rsp; |
95 | } | 85 | } |
96 | 86 |
@@ -5,7 +5,7 @@ namespace WebPlugin\Pay\Chinabank; | @@ -5,7 +5,7 @@ namespace WebPlugin\Pay\Chinabank; | ||
5 | use WebPlugin\Pay\PayAbstract; | 5 | use WebPlugin\Pay\PayAbstract; |
6 | use WebPlugin\Pay\Reqparams; | 6 | use WebPlugin\Pay\Reqparams; |
7 | use WebPlugin\Pay\Rspparams; | 7 | use WebPlugin\Pay\Rspparams; |
8 | - | 8 | +use WebPlugin\UdpLog; |
9 | class Service extends PayAbstract | 9 | class Service extends PayAbstract |
10 | { | 10 | { |
11 | 11 | ||
@@ -53,6 +53,7 @@ class Service extends PayAbstract | @@ -53,6 +53,7 @@ class Service extends PayAbstract | ||
53 | * @return void|QCPay_Utils_Rspparams | 53 | * @return void|QCPay_Utils_Rspparams |
54 | */ | 54 | */ |
55 | function parseResponse(Array $arrResponse){ | 55 | function parseResponse(Array $arrResponse){ |
56 | + UdpLog::info("【{$this->logProjectPrefix}-支付】,function:parseResponse,参数", $arrResponse); | ||
56 | // {"v_md5all":"8F7E33B3759DC55F0E776120B5C16A55","v_md5info":"e42e938417bd01d8eb69235c1ebe9be3","remark1":"110610002420","v_pmode":null,"remark2":"","v_idx":"5607406315","v_md5":"2E9135262B2729B23B049EBBE80E5183","v_pstatus":"20","v_pstring":null,"v_md5str":"2E9135262B2729B23B049EBBE80E5183","v_md5money":"9330e642e14622f4993ce5a6e9781bbd","v_moneytype":"CNY","v_oid":"110610002420","v_amount":"0.01"} | 57 | // {"v_md5all":"8F7E33B3759DC55F0E776120B5C16A55","v_md5info":"e42e938417bd01d8eb69235c1ebe9be3","remark1":"110610002420","v_pmode":null,"remark2":"","v_idx":"5607406315","v_md5":"2E9135262B2729B23B049EBBE80E5183","v_pstatus":"20","v_pstring":null,"v_md5str":"2E9135262B2729B23B049EBBE80E5183","v_md5money":"9330e642e14622f4993ce5a6e9781bbd","v_moneytype":"CNY","v_oid":"110610002420","v_amount":"0.01"} |
57 | //把中文进行转码 | 58 | //把中文进行转码 |
58 | $arrResponse["v_pmode"] = mb_convert_encoding($arrResponse["v_pmode"], "UTF-8", "GBK"); | 59 | $arrResponse["v_pmode"] = mb_convert_encoding($arrResponse["v_pmode"], "UTF-8", "GBK"); |
@@ -75,6 +76,7 @@ class Service extends PayAbstract | @@ -75,6 +76,7 @@ class Service extends PayAbstract | ||
75 | $rsp->tradeNo = ""; | 76 | $rsp->tradeNo = ""; |
76 | $rsp->bankBillNo = ""; | 77 | $rsp->bankBillNo = ""; |
77 | } | 78 | } |
79 | + UdpLog::info("【{$this->logProjectPrefix}-支付】,function:parseResponse,解析结果", $rsp); | ||
78 | return $rsp; | 80 | return $rsp; |
79 | } | 81 | } |
80 | 82 |
@@ -5,13 +5,11 @@ namespace WebPlugin\Pay\Shengpay; | @@ -5,13 +5,11 @@ namespace WebPlugin\Pay\Shengpay; | ||
5 | use WebPlugin\Pay\PayAbstract; | 5 | use WebPlugin\Pay\PayAbstract; |
6 | use WebPlugin\Pay\Reqparams; | 6 | use WebPlugin\Pay\Reqparams; |
7 | use WebPlugin\Pay\Rspparams; | 7 | use WebPlugin\Pay\Rspparams; |
8 | -use WebPlugin\PhpLog; | ||
9 | - | 8 | +use WebPlugin\UdpLog; |
10 | class Service extends PayAbstract | 9 | class Service extends PayAbstract |
11 | { | 10 | { |
12 | 11 | ||
13 | public $config; | 12 | public $config; |
14 | - private $log; | ||
15 | 13 | ||
16 | public function __construct(array $paymentParams) | 14 | public function __construct(array $paymentParams) |
17 | { | 15 | { |
@@ -20,8 +18,6 @@ class Service extends PayAbstract | @@ -20,8 +18,6 @@ class Service extends PayAbstract | ||
20 | $myConfig = json_decode($paymentParams["pay_params"]); | 18 | $myConfig = json_decode($paymentParams["pay_params"]); |
21 | $this->config->merchant_no = $myConfig->merchant_id; | 19 | $this->config->merchant_no = $myConfig->merchant_id; |
22 | $this->config->merchant_key = $myConfig->merchant_key; | 20 | $this->config->merchant_key = $myConfig->merchant_key; |
23 | - | ||
24 | - $this->log = new PhpLog($this->config->logDir, 'PRC', $this->config->logLevel); | ||
25 | } | 21 | } |
26 | 22 | ||
27 | /** | 23 | /** |
@@ -30,10 +26,7 @@ class Service extends PayAbstract | @@ -30,10 +26,7 @@ class Service extends PayAbstract | ||
30 | */ | 26 | */ |
31 | public function getPayRequestPars(Reqparams $params) | 27 | public function getPayRequestPars(Reqparams $params) |
32 | { | 28 | { |
33 | - | ||
34 | - $this->log->LogInfo("===开始处理盛付通的请求参数==="); | ||
35 | - $this->log->LogInfo("-----请求参数为---"); | ||
36 | - $this->log->LogInfo(var_export($params, true)); | 29 | + UdpLog::info("【{$this->logProjectPrefix}-支付】,function:getPayRequestPars,参数", $params); |
37 | 30 | ||
38 | $bankCode = $params->paymentParameter == 'platform' ? '' : $params->paymentParameter; | 31 | $bankCode = $params->paymentParameter == 'platform' ? '' : $params->paymentParameter; |
39 | $baseUrl = $this->getBaseNoticeUrl($params->isTest); | 32 | $baseUrl = $this->getBaseNoticeUrl($params->isTest); |
@@ -60,7 +53,7 @@ class Service extends PayAbstract | @@ -60,7 +53,7 @@ class Service extends PayAbstract | ||
60 | 'pars' => $parameters, | 53 | 'pars' => $parameters, |
61 | 'reqType' => 'post' | 54 | 'reqType' => 'post' |
62 | ); | 55 | ); |
63 | - | 56 | + UdpLog::info("【{$this->logProjectPrefix}-支付】,orderCode:{$params->orderCode},function:getPayRequestPars,处理结果", $result); |
64 | return $result; | 57 | return $result; |
65 | } | 58 | } |
66 | 59 | ||
@@ -108,19 +101,12 @@ class Service extends PayAbstract | @@ -108,19 +101,12 @@ class Service extends PayAbstract | ||
108 | */ | 101 | */ |
109 | function parseResponse(Array $arrResponse) | 102 | function parseResponse(Array $arrResponse) |
110 | { | 103 | { |
111 | - $this->log->LogInfo("===开始处理盛付通的回调参数==="); | ||
112 | - $this->log->LogInfo("-----回调参数为---"); | ||
113 | - $this->log->LogInfo(var_export($arrResponse, true)); | ||
114 | - | 104 | + UdpLog::info("【{$this->logProjectPrefix}-支付】,function:parseResponse,参数", $arrResponse); |
115 | $rsp = new Rspparams(); | 105 | $rsp = new Rspparams(); |
116 | if (!$this->checkResponse($arrResponse)) { | 106 | if (!$this->checkResponse($arrResponse)) { |
117 | - $this->log->LogInfo("-----验证盛付通回调参数失败---"); | ||
118 | - | ||
119 | //验证不成功 | 107 | //验证不成功 |
120 | $rsp->payResult = -1; | 108 | $rsp->payResult = -1; |
121 | } else { | 109 | } else { |
122 | - $this->log->LogInfo("-----验证盛付通回调参数成功---"); | ||
123 | - | ||
124 | $rsp->bankName = ""; | 110 | $rsp->bankName = ""; |
125 | $rsp->orderCode = $arrResponse["OrderNo"]; | 111 | $rsp->orderCode = $arrResponse["OrderNo"]; |
126 | $rsp->payResult = $this->convertResult($arrResponse["Status"]); | 112 | $rsp->payResult = $this->convertResult($arrResponse["Status"]); |
@@ -132,7 +118,7 @@ class Service extends PayAbstract | @@ -132,7 +118,7 @@ class Service extends PayAbstract | ||
132 | $rsp->tradeNo = ""; | 118 | $rsp->tradeNo = ""; |
133 | $rsp->bankBillNo = ""; | 119 | $rsp->bankBillNo = ""; |
134 | } | 120 | } |
135 | - | 121 | + UdpLog::info("【{$this->logProjectPrefix}-支付】,function:parseResponse,处理结果", $rsp); |
136 | return $rsp; | 122 | return $rsp; |
137 | } | 123 | } |
138 | 124 |
@@ -5,13 +5,12 @@ namespace WebPlugin\Pay\Tenpay; | @@ -5,13 +5,12 @@ namespace WebPlugin\Pay\Tenpay; | ||
5 | use WebPlugin\Pay\PayAbstract; | 5 | use WebPlugin\Pay\PayAbstract; |
6 | use WebPlugin\Pay\Reqparams; | 6 | use WebPlugin\Pay\Reqparams; |
7 | use WebPlugin\Pay\Rspparams; | 7 | use WebPlugin\Pay\Rspparams; |
8 | -use WebPlugin\PhpLog; | 8 | +use WebPlugin\UdpLog; |
9 | 9 | ||
10 | class Service extends PayAbstract | 10 | class Service extends PayAbstract |
11 | { | 11 | { |
12 | 12 | ||
13 | public $config; | 13 | public $config; |
14 | - private $log; | ||
15 | 14 | ||
16 | /** | 15 | /** |
17 | * Service constructor. | 16 | * Service constructor. |
@@ -24,8 +23,6 @@ class Service extends PayAbstract | @@ -24,8 +23,6 @@ class Service extends PayAbstract | ||
24 | $myConfig = json_decode($paymentParams["pay_params"]); | 23 | $myConfig = json_decode($paymentParams["pay_params"]); |
25 | $this->config->bargainor_id = $myConfig->merchant_id; | 24 | $this->config->bargainor_id = $myConfig->merchant_id; |
26 | $this->config->sp_key = $myConfig->merchant_key; | 25 | $this->config->sp_key = $myConfig->merchant_key; |
27 | - | ||
28 | - $this->log = new PhpLog($this->config->logDir, 'PRC', $this->config->logLevel); | ||
29 | } | 26 | } |
30 | 27 | ||
31 | /** | 28 | /** |
@@ -34,10 +31,7 @@ class Service extends PayAbstract | @@ -34,10 +31,7 @@ class Service extends PayAbstract | ||
34 | */ | 31 | */ |
35 | public function getPayRequestPars(Reqparams $params) | 32 | public function getPayRequestPars(Reqparams $params) |
36 | { | 33 | { |
37 | - $this->log->LogInfo("===开始处理财付通的请求参数==="); | ||
38 | - $this->log->LogInfo("-----请求参数为---"); | ||
39 | - $this->log->LogInfo(var_export($params, true)); | ||
40 | - | 34 | + UdpLog::info("【{$this->logProjectPrefix}-支付】,function:getPayRequestPars,参数", $params); |
41 | parent::getPayRequestPars($params); | 35 | parent::getPayRequestPars($params); |
42 | $baseUrl = $this->getBaseNoticeUrl($params->isTest); | 36 | $baseUrl = $this->getBaseNoticeUrl($params->isTest); |
43 | 37 | ||
@@ -65,7 +59,7 @@ class Service extends PayAbstract | @@ -65,7 +59,7 @@ class Service extends PayAbstract | ||
65 | 'pars' => $sign_text, | 59 | 'pars' => $sign_text, |
66 | 'reqType' => 'get' | 60 | 'reqType' => 'get' |
67 | ); | 61 | ); |
68 | - | 62 | + UdpLog::info("【{$this->logProjectPrefix}-支付】,ordercode:{$params->orderCode},function:getPayRequestPars,处理结果", $result); |
69 | return $result; | 63 | return $result; |
70 | } | 64 | } |
71 | 65 | ||
@@ -76,10 +70,7 @@ class Service extends PayAbstract | @@ -76,10 +70,7 @@ class Service extends PayAbstract | ||
76 | */ | 70 | */ |
77 | public function parseResponse(array $arrResponse) | 71 | public function parseResponse(array $arrResponse) |
78 | { | 72 | { |
79 | - $this->log->LogInfo("===开始处理财付通的回调参数==="); | ||
80 | - $this->log->LogInfo("-----回调参数为---"); | ||
81 | - $this->log->LogInfo(var_export($arrResponse, true)); | ||
82 | - | 73 | + UdpLog::info("【{$this->logProjectPrefix}-支付】,function:parseResponse,参数", $arrResponse); |
83 | $rsp = new Rspparams(); | 74 | $rsp = new Rspparams(); |
84 | if (!$this->checkResponse($arrResponse)) { | 75 | if (!$this->checkResponse($arrResponse)) { |
85 | //验证不成功 | 76 | //验证不成功 |
@@ -96,6 +87,7 @@ class Service extends PayAbstract | @@ -96,6 +87,7 @@ class Service extends PayAbstract | ||
96 | $rsp->tradeNo = ""; | 87 | $rsp->tradeNo = ""; |
97 | $rsp->bankBillNo = ""; | 88 | $rsp->bankBillNo = ""; |
98 | } | 89 | } |
90 | + UdpLog::info("【{$this->logProjectPrefix}-支付】,function:parseResponse,处理结果", $rsp); | ||
99 | return $rsp; | 91 | return $rsp; |
100 | } | 92 | } |
101 | 93 |
@@ -5,14 +5,13 @@ namespace WebPlugin\Pay\Unionpayweb; | @@ -5,14 +5,13 @@ namespace WebPlugin\Pay\Unionpayweb; | ||
5 | use WebPlugin\Pay\PayAbstract; | 5 | use WebPlugin\Pay\PayAbstract; |
6 | use WebPlugin\Pay\Reqparams; | 6 | use WebPlugin\Pay\Reqparams; |
7 | use WebPlugin\Pay\Rspparams; | 7 | use WebPlugin\Pay\Rspparams; |
8 | -use WebPlugin\PhpLog; | 8 | +use WebPlugin\UdpLog; |
9 | use WebPlugin\Helpers; | 9 | use WebPlugin\Helpers; |
10 | use Api\Yohobuy; | 10 | use Api\Yohobuy; |
11 | 11 | ||
12 | class Service extends PayAbstract | 12 | class Service extends PayAbstract |
13 | { | 13 | { |
14 | private $merId; | 14 | private $merId; |
15 | - private $log; | ||
16 | 15 | ||
17 | public function __construct(array $paymentParams) | 16 | public function __construct(array $paymentParams) |
18 | { | 17 | { |
@@ -21,7 +20,6 @@ class Service extends PayAbstract | @@ -21,7 +20,6 @@ class Service extends PayAbstract | ||
21 | include_once 'Func/common.php'; | 20 | include_once 'Func/common.php'; |
22 | include_once 'Func/secureUtil.php'; | 21 | include_once 'Func/secureUtil.php'; |
23 | 22 | ||
24 | - $this->log = new PhpLog(SDK_LOG_FILE_PATH, "PRC", SDK_LOG_LEVEL); | ||
25 | $this->merId = array( | 23 | $this->merId = array( |
26 | 'mobile' => '898111453110482',//手机支付 | 24 | 'mobile' => '898111453110482',//手机支付 |
27 | 'pc_nocard' => '898111453110464',//无卡支付 | 25 | 'pc_nocard' => '898111453110464',//无卡支付 |
@@ -37,22 +35,17 @@ class Service extends PayAbstract | @@ -37,22 +35,17 @@ class Service extends PayAbstract | ||
37 | */ | 35 | */ |
38 | public function parseResponse(array $package) | 36 | public function parseResponse(array $package) |
39 | { | 37 | { |
40 | - $this->log->LogInfo("===开始解析银联支付的回调参数==="); | ||
41 | - $this->log->LogInfo("===回调参数为==="); | ||
42 | - $this->log->LogInfo(var_export($package, true)); | ||
43 | - | 38 | + UdpLog::info("【{$this->logProjectPrefix}-银联支付】,function:parseResponse,参数", $package); |
44 | $verify = false; | 39 | $verify = false; |
45 | $responseData = new Rspparams(); | 40 | $responseData = new Rspparams(); |
46 | 41 | ||
47 | if (!isset($package['respCode']) || $package['respCode'] !== '00') { | 42 | if (!isset($package['respCode']) || $package['respCode'] !== '00') { |
48 | - $this->log->LogInfo('银联支付返回码有误'); | ||
49 | $responseData->payResult = -1; | 43 | $responseData->payResult = -1; |
50 | return $responseData; | 44 | return $responseData; |
51 | } | 45 | } |
52 | 46 | ||
53 | if (isset($package['signature'])) { // TODO isset($package['signature']) && verify($package)验证签名待做 | 47 | if (isset($package['signature'])) { // TODO isset($package['signature']) && verify($package)验证签名待做 |
54 | $verify = true; | 48 | $verify = true; |
55 | - $this->log->LogInfo('银联支付验签成功'); | ||
56 | } | 49 | } |
57 | 50 | ||
58 | if ($verify) { | 51 | if ($verify) { |
@@ -70,9 +63,7 @@ class Service extends PayAbstract | @@ -70,9 +63,7 @@ class Service extends PayAbstract | ||
70 | } else { | 63 | } else { |
71 | $responseData->payResult = -1; | 64 | $responseData->payResult = -1; |
72 | } | 65 | } |
73 | - | ||
74 | - $this->log->LogInfo("===银联支付的回调参数处理结果为==="); | ||
75 | - $this->log->LogInfo(var_export($responseData, true)); | 66 | + UdpLog::info("【{$this->logProjectPrefix}-银联支付】,function:parseResponse,处理结果", $responseData); |
76 | 67 | ||
77 | return $responseData; | 68 | return $responseData; |
78 | } | 69 | } |
@@ -110,8 +101,7 @@ class Service extends PayAbstract | @@ -110,8 +101,7 @@ class Service extends PayAbstract | ||
110 | 'reqType' => 'post' | 101 | 'reqType' => 'post' |
111 | ); | 102 | ); |
112 | 103 | ||
113 | - $this->log->LogInfo(var_export($requestParams, true)); | ||
114 | - | 104 | + UdpLog::info("【{$this->logProjectPrefix}-银联支付】,orderCode:{$params->orderCode},function:getPayRequestPars,处理结果", $result); |
115 | return $result; | 105 | return $result; |
116 | } | 106 | } |
117 | 107 |
@@ -8,7 +8,7 @@ use WebPlugin\Pay\Rspparams; | @@ -8,7 +8,7 @@ use WebPlugin\Pay\Rspparams; | ||
8 | use WebPlugin\Pay\Signature; | 8 | use WebPlugin\Pay\Signature; |
9 | use WebPlugin\Pay\weixin\lib\WxPayApi; | 9 | use WebPlugin\Pay\weixin\lib\WxPayApi; |
10 | use WebPlugin\Pay\weixin\lib\WxPayOrderQuery; | 10 | use WebPlugin\Pay\weixin\lib\WxPayOrderQuery; |
11 | -use WebPlugin\PhpLog; | 11 | +use WebPlugin\UdpLog; |
12 | use WebPlugin\Helpers; | 12 | use WebPlugin\Helpers; |
13 | 13 | ||
14 | class Service extends PayAbstract | 14 | class Service extends PayAbstract |
@@ -20,7 +20,6 @@ class Service extends PayAbstract | @@ -20,7 +20,6 @@ class Service extends PayAbstract | ||
20 | private $appKey; | 20 | private $appKey; |
21 | private $privateKey; | 21 | private $privateKey; |
22 | private $payCurl; | 22 | private $payCurl; |
23 | - private $log; | ||
24 | 23 | ||
25 | public function __construct(array $paymentParams) | 24 | public function __construct(array $paymentParams) |
26 | { | 25 | { |
@@ -31,8 +30,6 @@ class Service extends PayAbstract | @@ -31,8 +30,6 @@ class Service extends PayAbstract | ||
31 | $this->appKey = $this->config->app_key; | 30 | $this->appKey = $this->config->app_key; |
32 | $this->privateKey = $this->config->private_key; | 31 | $this->privateKey = $this->config->private_key; |
33 | $this->paymentCode = $paymentParams['id']; | 32 | $this->paymentCode = $paymentParams['id']; |
34 | - | ||
35 | - $this->log = new PhpLog($this->config->logDir, 'PRC', $this->config->logLevel); | ||
36 | } | 33 | } |
37 | 34 | ||
38 | public function getPayRequestPars(Reqparams $params) | 35 | public function getPayRequestPars(Reqparams $params) |
@@ -54,10 +51,7 @@ class Service extends PayAbstract | @@ -54,10 +51,7 @@ class Service extends PayAbstract | ||
54 | */ | 51 | */ |
55 | public function pay(array $orderInfo) | 52 | public function pay(array $orderInfo) |
56 | { | 53 | { |
57 | - $this->log->LogInfo("===开始处理微信扫码支付的请求参数==="); | ||
58 | - $this->log->LogInfo("-----请求参数为---"); | ||
59 | - $this->log->LogInfo(var_export($orderInfo, true)); | ||
60 | - | 54 | + UdpLog::info("【{$this->logProjectPrefix}-微信支付】,function:pay,参数", $orderInfo); |
61 | //生成签名 | 55 | //生成签名 |
62 | $this->orderCode = $orderInfo['order_code']; | 56 | $this->orderCode = $orderInfo['order_code']; |
63 | $payParams = array( | 57 | $payParams = array( |
@@ -85,11 +79,8 @@ class Service extends PayAbstract | @@ -85,11 +79,8 @@ class Service extends PayAbstract | ||
85 | 'pars' => trim($pars, '&') | 79 | 'pars' => trim($pars, '&') |
86 | ); | 80 | ); |
87 | 81 | ||
88 | - $this->log->LogInfo("===开始处理微信扫码支付的支付地址==="); | ||
89 | - $this->log->LogInfo("-----支付地址数据为---"); | ||
90 | - $this->log->LogInfo(var_export($payUrlInfo, true)); | ||
91 | - | ||
92 | $payUrl = $payUrlInfo['pay_url'] . '?' . $payUrlInfo['pars']; | 82 | $payUrl = $payUrlInfo['pay_url'] . '?' . $payUrlInfo['pars']; |
83 | + UdpLog::info("【{$this->logProjectPrefix}-微信支付】,order_code:{$orderInfo['order_code']},function:pay,结果", $payUrl); | ||
93 | 84 | ||
94 | return array('pay_url' => $payUrl); | 85 | return array('pay_url' => $payUrl); |
95 | } | 86 | } |
@@ -99,17 +90,14 @@ class Service extends PayAbstract | @@ -99,17 +90,14 @@ class Service extends PayAbstract | ||
99 | /* 返回示例 | 90 | /* 返回示例 |
100 | * http://www.yohobuy.com/pay/notice/wechatqrcodereturn?ordercode=93465435 | 91 | * http://www.yohobuy.com/pay/notice/wechatqrcodereturn?ordercode=93465435 |
101 | */ | 92 | */ |
102 | - | ||
103 | - $this->log->LogInfo("===开始查询微信扫码支付的结果==="); | 93 | + UdpLog::info("【{$this->logProjectPrefix}-微信支付】,function:parseResponse,参数", $data); |
104 | 94 | ||
105 | // 组装微信支付的订单号 | 95 | // 组装微信支付的订单号 |
106 | $tradeNo = 'YOHOBuy_' . $data['orderCode']; | 96 | $tradeNo = 'YOHOBuy_' . $data['orderCode']; |
107 | $input = new WxPayOrderQuery(); | 97 | $input = new WxPayOrderQuery(); |
108 | $input->SetOut_trade_no($tradeNo); | 98 | $input->SetOut_trade_no($tradeNo); |
109 | $result = WxPayApi::orderQuery($input); | 99 | $result = WxPayApi::orderQuery($input); |
110 | - | ||
111 | - $this->log->LogInfo("===查询微信扫码支付的结果结束,结果为==="); | ||
112 | - $this->log->LogInfo(var_export($result, true)); | 100 | + UdpLog::info("【{$this->logProjectPrefix}-微信支付】,orderCode:{$data['orderCode']},function:parseResponse,组装微信支付的订单号", $result); |
113 | 101 | ||
114 | $rsp = new Rspparams(); | 102 | $rsp = new Rspparams(); |
115 | // 支付成功 | 103 | // 支付成功 |
@@ -125,13 +113,10 @@ class Service extends PayAbstract | @@ -125,13 +113,10 @@ class Service extends PayAbstract | ||
125 | $rsp->tradeNo = $result["out_trade_no"]; | 113 | $rsp->tradeNo = $result["out_trade_no"]; |
126 | $rsp->bankBillNo = $result['bank_type']; | 114 | $rsp->bankBillNo = $result['bank_type']; |
127 | } else { | 115 | } else { |
128 | - $this->log->LogInfo("===微信扫码支付失败==="); | ||
129 | $rsp->payResult = -1; | 116 | $rsp->payResult = -1; |
130 | } | 117 | } |
131 | 118 | ||
132 | - $this->log->LogInfo("===微信扫码支付回调参数解析结果为==="); | ||
133 | - $this->log->LogInfo(var_export($rsp, true)); | ||
134 | - | 119 | + UdpLog::info("【{$this->logProjectPrefix}-微信支付】,orderCode:{$data['orderCode']},function:parseResponse,处理结果", $rsp); |
135 | return $rsp; | 120 | return $rsp; |
136 | } | 121 | } |
137 | 122 |
@@ -7,18 +7,13 @@ use LibModels\Web\Product\PayData; | @@ -7,18 +7,13 @@ use LibModels\Web\Product\PayData; | ||
7 | use WebPlugin\Pay\weixin\lib\WxPayApi; | 7 | use WebPlugin\Pay\weixin\lib\WxPayApi; |
8 | use WebPlugin\Pay\weixin\lib\WxPayNotify; | 8 | use WebPlugin\Pay\weixin\lib\WxPayNotify; |
9 | use WebPlugin\Pay\weixin\lib\WxPayOrderQuery; | 9 | use WebPlugin\Pay\weixin\lib\WxPayOrderQuery; |
10 | -use WebPlugin\PhpLog; | 10 | +use WebPlugin\UdpLog; |
11 | 11 | ||
12 | class PayNotifyCallBack extends WxPayNotify | 12 | class PayNotifyCallBack extends WxPayNotify |
13 | { | 13 | { |
14 | - // 向ERP提交订单状态有关接口调用日志和更新订单状态有关接口调用日志 | ||
15 | - const ORDER_STATUS_LOG = '/Data/logs/pc_pay/order_status'; | ||
16 | - // 日志等级,2表示记录信息等级的日志 | ||
17 | - const LOG_LEVEL = 2; | ||
18 | - // 获取微信订单中的订单号需要截取的开始位置 | 14 | + // 获取微信订单中的orderCode需要截取的开始位置 |
19 | const ORDER_CODE_START = 8; | 15 | const ORDER_CODE_START = 8; |
20 | 16 | ||
21 | - private $log = null; | ||
22 | private $_uid; | 17 | private $_uid; |
23 | 18 | ||
24 | /** | 19 | /** |
@@ -27,8 +22,6 @@ class PayNotifyCallBack extends WxPayNotify | @@ -27,8 +22,6 @@ class PayNotifyCallBack extends WxPayNotify | ||
27 | */ | 22 | */ |
28 | public function __construct($uid) | 23 | public function __construct($uid) |
29 | { | 24 | { |
30 | - // 初始化日志 | ||
31 | - $this->log = new PhpLog(self::ORDER_STATUS_LOG, 'PRC', self::LOG_LEVEL); | ||
32 | $this->_uid = $uid; | 25 | $this->_uid = $uid; |
33 | } | 26 | } |
34 | 27 | ||
@@ -38,12 +31,9 @@ class PayNotifyCallBack extends WxPayNotify | @@ -38,12 +31,9 @@ class PayNotifyCallBack extends WxPayNotify | ||
38 | { | 31 | { |
39 | $input = new WxPayOrderQuery(); | 32 | $input = new WxPayOrderQuery(); |
40 | $input->SetTransaction_id($transaction_id); | 33 | $input->SetTransaction_id($transaction_id); |
41 | - $this->log->LogInfo('微信扫码支付交易号:' . $transaction_id); | 34 | + UdpLog::info("【{$this->logProjectPrefix}-微信扫码支付】,function:Queryorder,微信扫码支付交易号", $transaction_id); |
42 | $result = WxPayApi::orderQuery($input); | 35 | $result = WxPayApi::orderQuery($input); |
43 | - | ||
44 | - $this->log->LogInfo('begin PayNotifyCallBack->Queryorder'); | ||
45 | - $this->log->LogInfo('===开始查询微信扫码订单====='); | ||
46 | - $this->log->LogInfo(var_export($result, true)); | 36 | + UdpLog::info("【{$this->logProjectPrefix}-微信扫码支付】,function:Queryorder,扫码订单结果", $result); |
47 | 37 | ||
48 | if (array_key_exists("return_code", $result) && array_key_exists("result_code", $result) && $result["return_code"] == "SUCCESS" && $result["result_code"] == "SUCCESS") { | 38 | if (array_key_exists("return_code", $result) && array_key_exists("result_code", $result) && $result["return_code"] == "SUCCESS" && $result["result_code"] == "SUCCESS") { |
49 | $orderCode = substr($result['out_trade_no'], self::ORDER_CODE_START); | 39 | $orderCode = substr($result['out_trade_no'], self::ORDER_CODE_START); |
@@ -54,21 +44,17 @@ class PayNotifyCallBack extends WxPayNotify | @@ -54,21 +44,17 @@ class PayNotifyCallBack extends WxPayNotify | ||
54 | $tradeNo = $result['out_trade_no']; | 44 | $tradeNo = $result['out_trade_no']; |
55 | $bankBillNo = $result['bank_type']; | 45 | $bankBillNo = $result['bank_type']; |
56 | 46 | ||
57 | - $this->log->LogInfo('==[' . $orderCode . ']=开始调用获取订单详情方式接口,接口方法为app.SpaceOrders.detail==='); | ||
58 | $orderInfo = OrderData::getOrderDetail('', $orderCode); | 47 | $orderInfo = OrderData::getOrderDetail('', $orderCode); |
59 | - $this->log->LogInfo('==[' . $orderCode . ']=结束调用获取订单详情方式接口,返回结果为==='); | ||
60 | - $this->log->LogInfo(var_export($orderInfo, true)); | 48 | + UdpLog::info("【{$this->logProjectPrefix}-微信扫码支付】,orderCode:{$orderCode},function:Queryorder,订单详情", $orderInfo); |
61 | 49 | ||
62 | if (!isset($orderInfo['data']) || empty($orderInfo['data'])) { | 50 | if (!isset($orderInfo['data']) || empty($orderInfo['data'])) { |
63 | - $this->log->LogInfo('==[' . $orderCode . ']=微信支付状态同步中未获取到订单详情信息==='); | 51 | + UdpLog::error("【{$this->logProjectPrefix}-微信扫码支付】,orderCode:{$orderCode},function:Queryorder,微信支付状态同步中未获取到订单详情信息", $orderInfo); |
64 | return false; | 52 | return false; |
65 | } | 53 | } |
66 | 54 | ||
67 | //更新订单状态 | 55 | //更新订单状态 |
68 | $updateOrderStatus = PayData::pcpayNotify($orderCode, $payment, $amount, $bankName, $bankCode, $tradeNo, $bankBillNo); | 56 | $updateOrderStatus = PayData::pcpayNotify($orderCode, $payment, $amount, $bankName, $bankCode, $tradeNo, $bankBillNo); |
69 | - $this->log->LogInfo(var_export($updateOrderStatus, true)); | ||
70 | - $this->log->LogInfo('==[' . $orderCode . ']=微信扫码订单支付成功==='); | ||
71 | - | 57 | + UdpLog::info("【{$this->logProjectPrefix}-微信扫码支付】,orderCode:{$orderCode},function:Queryorder,更新订单状态结果", $updateOrderStatus); |
72 | return true; | 58 | return true; |
73 | } | 59 | } |
74 | 60 | ||
@@ -78,23 +64,19 @@ class PayNotifyCallBack extends WxPayNotify | @@ -78,23 +64,19 @@ class PayNotifyCallBack extends WxPayNotify | ||
78 | //重写回调处理函数 | 64 | //重写回调处理函数 |
79 | public function NotifyProcess($data, &$msg) | 65 | public function NotifyProcess($data, &$msg) |
80 | { | 66 | { |
81 | - $this->log->LogInfo('begin notifyProcess'); | ||
82 | - $this->log->LogInfo(var_export($data, true)); | ||
83 | - | 67 | + UdpLog::info("【{$this->logProjectPrefix}-微信扫码支付】,function:NotifyProcess,参数", $data); |
84 | if (!array_key_exists("transaction_id", $data)) { | 68 | if (!array_key_exists("transaction_id", $data)) { |
85 | $msg = "输入参数不正确"; | 69 | $msg = "输入参数不正确"; |
86 | - $this->log->LogInfo('=====微信扫码支付通知结果为:' . $msg . '====='); | 70 | + UdpLog::info("【{$this->logProjectPrefix}-微信扫码支付】,function:NotifyProcess,输入参数不正确", $data); |
87 | return false; | 71 | return false; |
88 | } | 72 | } |
89 | //查询订单,判断订单真实性 | 73 | //查询订单,判断订单真实性 |
90 | if (!$this->Queryorder($data["transaction_id"])) { | 74 | if (!$this->Queryorder($data["transaction_id"])) { |
91 | $msg = "订单查询失败"; | 75 | $msg = "订单查询失败"; |
92 | - $this->log->LogInfo('=====微信扫码支付通知结果为:' . $msg . '====='); | 76 | + UdpLog::info("【{$this->logProjectPrefix}-微信扫码支付】,function:NotifyProcess,订单查询失败", $data); |
93 | return false; | 77 | return false; |
94 | } | 78 | } |
95 | 79 | ||
96 | - $this->log->LogInfo('=====微信扫码支付通知结果为:' . $msg . '====='); | ||
97 | - | ||
98 | return true; | 80 | return true; |
99 | } | 81 | } |
100 | 82 |
library/WebPlugin/UdpLog.php
0 → 100644
1 | +<?php | ||
2 | +/** | ||
3 | + * Created by IntelliJ IDEA. | ||
4 | + * User: hbomb_000 | ||
5 | + * Date: 2016/5/5 | ||
6 | + * Time: 18:17 | ||
7 | + */ | ||
8 | + | ||
9 | +namespace WebPlugin; | ||
10 | + | ||
11 | + | ||
12 | +/** | ||
13 | + * Class UdpLog | ||
14 | + * @useage: | ||
15 | + * UdpLog::info('get payment list begin',array('order_code'=>123231)); | ||
16 | + * @package WebPlugin | ||
17 | + */ | ||
18 | +class UdpLog | ||
19 | +{ | ||
20 | + //influxdb url | ||
21 | + public static $url = 'influxdb.yohobuy.com'; | ||
22 | + //influxdb port | ||
23 | + public static $port = '4444'; | ||
24 | + //influxdb measurement | ||
25 | + public static $measurement = 'php_log'; | ||
26 | + | ||
27 | + public static $filePath = '/Data/logs/'; | ||
28 | + | ||
29 | + const RECORD_MODE_FILE = 'FILE'; | ||
30 | + const RECORD_MODE_UDP = 'UDP'; | ||
31 | + | ||
32 | + const RECORD_MODE = 'FILE';//mode: FILE | UDP | ||
33 | + | ||
34 | + /** | ||
35 | + * proc line and send log to influxdb | ||
36 | + * @param $level | ||
37 | + * @param $message | ||
38 | + * @param $meta | ||
39 | + */ | ||
40 | + private static function procLog($level, $message, $debugInfo, $meta = '') { | ||
41 | + date_default_timezone_set('PRC'); | ||
42 | + $level = str_replace(__CLASS__.'::','',$level); | ||
43 | + $file = $debugInfo[0]["file"]; | ||
44 | + $line = $debugInfo[0]["line"]; | ||
45 | + $string = ''; | ||
46 | + //make tags | ||
47 | + $tags = array( | ||
48 | + 'time' => date('Y-m-d H:i:s',time()), | ||
49 | + 'level' => $level, | ||
50 | + 'host'=> gethostname(), | ||
51 | + 'file'=> $file, | ||
52 | + 'line'=> $line, | ||
53 | + 'message' => $message, | ||
54 | + 'meta' => serialize($meta) | ||
55 | + ); | ||
56 | + //make a line | ||
57 | + $string = implode('|', $tags); //format: time|level|host|file|line|message|meta | ||
58 | + if(self::RECORD_MODE == self::RECORD_MODE_UDP) { | ||
59 | + self::send($string); | ||
60 | + } | ||
61 | + else if(self::RECORD_MODE == self::RECORD_MODE_FILE) { | ||
62 | + self::fileLog($level, $string); | ||
63 | + } | ||
64 | + } | ||
65 | + | ||
66 | + /** | ||
67 | + * 文件日志记录 | ||
68 | + * | ||
69 | + * @param string $level | ||
70 | + * @param string $message | ||
71 | + */ | ||
72 | + private static function fileLog($level, $message) | ||
73 | + { | ||
74 | + $filename = $level . '.log'; //日志文件 | ||
75 | + $logFile = self::createPath(self::$filePath, $filename); | ||
76 | + if (!file_exists(self::$filePath))//判断文件路径是否存在 | ||
77 | + { | ||
78 | + if (!empty(self::$filePath))//判断路径是否为空 | ||
79 | + { | ||
80 | + if (!(self::createDir(self::$filePath))) { | ||
81 | + return false; | ||
82 | + } | ||
83 | + if (!is_writable($logFile)) { | ||
84 | + return false; | ||
85 | + } | ||
86 | + } | ||
87 | + } | ||
88 | + @error_log($message."\r\n", 3, $logFile); | ||
89 | + } | ||
90 | + | ||
91 | + /** | ||
92 | + * 作用:创建目录 | ||
93 | + * 输入:要创建的目录 | ||
94 | + * 输出:true | false | ||
95 | + */ | ||
96 | + private static function createDir($dir) | ||
97 | + { | ||
98 | + return is_dir($dir) or (self::createDir(dirname($dir)) and mkdir($dir, 0777)); | ||
99 | + } | ||
100 | + | ||
101 | + /** | ||
102 | + * 作用:构建路径 | ||
103 | + * 输入:文件的路径,要写入的文件名 | ||
104 | + * 输出:构建好的路径字串 | ||
105 | + */ | ||
106 | + private static function createPath($dir, $filename) | ||
107 | + { | ||
108 | + if (empty($dir)) { | ||
109 | + return $filename; | ||
110 | + } else { | ||
111 | + return $dir . "/" . $filename; | ||
112 | + } | ||
113 | + } | ||
114 | + | ||
115 | + /** | ||
116 | + * send by udp | ||
117 | + * @param $string | ||
118 | + */ | ||
119 | + private static function send($string) { | ||
120 | + $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); | ||
121 | + $len = strlen($string); | ||
122 | + socket_sendto($sock, $string, $len, 0, self::$url, self::$port); | ||
123 | + socket_close($sock); | ||
124 | + } | ||
125 | + | ||
126 | + /** | ||
127 | + * info log | ||
128 | + * @param $message | ||
129 | + * @param mixed $meta | ||
130 | + */ | ||
131 | + public static function info($message, $meta = '') { | ||
132 | + self::procLog(__METHOD__, $message, debug_backtrace(), $meta); | ||
133 | + } | ||
134 | + | ||
135 | + /** | ||
136 | + * warn log | ||
137 | + * @param $message | ||
138 | + * @param mixed $meta | ||
139 | + */ | ||
140 | + public static function warn($message, $meta = '') { | ||
141 | + self::procLog(__METHOD__, $message, debug_backtrace(), $meta); | ||
142 | + } | ||
143 | + | ||
144 | + /** | ||
145 | + * error log | ||
146 | + * @param $message | ||
147 | + * @param mixed $meta | ||
148 | + */ | ||
149 | + public static function error($message, $meta = '') { | ||
150 | + self::procLog(__METHOD__, $message, debug_backtrace(), $meta); | ||
151 | + } | ||
152 | + | ||
153 | + /** | ||
154 | + * debug log | ||
155 | + * @param $message | ||
156 | + * @param mixed $meta | ||
157 | + */ | ||
158 | + public static function debug($message, $meta = '') { | ||
159 | + self::procLog(__METHOD__, $message, debug_backtrace(), $meta); | ||
160 | + } | ||
161 | +} |
web-static/dist/yohobuy/0.0.16/index.tar.gz
0 → 100644
No preview for this file type
@@ -16069,7 +16069,8 @@ var $ = require("jquery"), | @@ -16069,7 +16069,8 @@ var $ = require("jquery"), | ||
16069 | showDiv, | 16069 | showDiv, |
16070 | imgAlt, | 16070 | imgAlt, |
16071 | imgSrc, | 16071 | imgSrc, |
16072 | - orderCode; | 16072 | + orderCode, |
16073 | + payment; | ||
16073 | 16074 | ||
16074 | $.jqtab = function(tabtit, tabcon) { | 16075 | $.jqtab = function(tabtit, tabcon) { |
16075 | 16076 | ||
@@ -16128,28 +16129,40 @@ $('.change').click(function() { | @@ -16128,28 +16129,40 @@ $('.change').click(function() { | ||
16128 | }); | 16129 | }); |
16129 | 16130 | ||
16130 | //支付方式选择按钮 | 16131 | //支付方式选择按钮 |
16131 | -function getData(payment,orderCode){ | ||
16132 | - $.ajax({ | ||
16133 | - type:"get", | ||
16134 | - url:"/common/addpaymentinterval", | ||
16135 | - dataType:'json', | ||
16136 | - data:{ | ||
16137 | - orderCode:orderCode, | ||
16138 | - payment:payment | ||
16139 | - } | ||
16140 | - | ||
16141 | - }); | 16132 | +function getData(payment, orderCode) { |
16133 | + $.ajax({ | ||
16134 | + type: 'get', | ||
16135 | + url: '/common/addpaymentinterval', | ||
16136 | + dataType: 'json', | ||
16137 | + data: { | ||
16138 | + orderCode: orderCode, | ||
16139 | + payment: payment | ||
16140 | + } | ||
16141 | + }); | ||
16142 | } | 16142 | } |
16143 | 16143 | ||
16144 | -$("#btnby").click(function(){ | ||
16145 | - payment = $(".choose-type").attr("data-id"); | ||
16146 | - orderCode = $('.order-num').text(); | ||
16147 | - getData(payment,orderCode); | 16144 | +$('#btnby').click(function() { |
16145 | + payment = $('.choose-type').attr('data-id'); | ||
16146 | + orderCode = $('.order-num').text(); | ||
16147 | + getData(payment, orderCode); | ||
16148 | window.open($payUrl + '?order_code=' + orderCode + '&payment_type=' + $showValue); | 16148 | window.open($payUrl + '?order_code=' + orderCode + '&payment_type=' + $showValue); |
16149 | $lightBox.show(); | 16149 | $lightBox.show(); |
16150 | -}) | 16150 | +}); |
16151 | 16151 | ||
16152 | - | 16152 | +//发送支付确认 |
16153 | +$('.pay-over').unbind('click').bind('click', function() { | ||
16154 | + var _this = this; | ||
16155 | + | ||
16156 | + $.post('/shopping/pay/sendPay', | ||
16157 | + { | ||
16158 | + orderCode: orderCode, | ||
16159 | + paymentId: payment | ||
16160 | + }, | ||
16161 | + function() { | ||
16162 | + window.location.href = $(_this).data('url'); | ||
16163 | + } | ||
16164 | + ); | ||
16165 | +}); | ||
16153 | }); | 16166 | }); |
16154 | define("js/pay/wechatqrcode", ["jquery"], function(require, exports, module){ | 16167 | define("js/pay/wechatqrcode", ["jquery"], function(require, exports, module){ |
16155 | /** | 16168 | /** |
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
@@ -14,7 +14,7 @@ use WebPlugin\Pay\weixin\lib\WxPayConfig; | @@ -14,7 +14,7 @@ use WebPlugin\Pay\weixin\lib\WxPayConfig; | ||
14 | use WebPlugin\Pay\weixin\lib\WxPayNativePay; | 14 | use WebPlugin\Pay\weixin\lib\WxPayNativePay; |
15 | use WebPlugin\Pay\weixin\lib\WxPayOrderQuery; | 15 | use WebPlugin\Pay\weixin\lib\WxPayOrderQuery; |
16 | use WebPlugin\Pay\weixin\lib\WxPayUnifiedOrder; | 16 | use WebPlugin\Pay\weixin\lib\WxPayUnifiedOrder; |
17 | -use WebPlugin\PhpLog; | 17 | +use WebPlugin\UdpLog; |
18 | 18 | ||
19 | /** | 19 | /** |
20 | * 支付有关方法 | 20 | * 支付有关方法 |
@@ -26,19 +26,6 @@ use WebPlugin\PhpLog; | @@ -26,19 +26,6 @@ use WebPlugin\PhpLog; | ||
26 | */ | 26 | */ |
27 | class PayModel | 27 | class PayModel |
28 | { | 28 | { |
29 | - // 日志等级,2表示记录信息等级的日志 | ||
30 | - const LOG_LEVEL = 2; | ||
31 | - // 支付方式有关接口调用日志 | ||
32 | - const PAYMENT_LIST_LOG = '/Data/logs/pc_pay/payment_list'; | ||
33 | - // 向ERP提交订单状态有关接口调用日志和更新订单状态有关接口调用日志 | ||
34 | - const ORDER_STATUS_LOG = '/Data/logs/pc_pay/order_status'; | ||
35 | - // 获取或者更新订单支付银行的接口调用日志 | ||
36 | - const ORDER_BANK_LOG = '/Data/logs/pc_pay/order_bank'; | ||
37 | - // 根据用户UID获取订单数有关接口调用日志 | ||
38 | - const ORDER_COUNT_LOG = '/Data/logs/pc_pay/order_count'; | ||
39 | - // 发送短信有关接口调用日志 | ||
40 | - const SEND_MESSAGE_LOG = '/Data/logs/pc_pay/send_message'; | ||
41 | - | ||
42 | // 是否老用户订单数判断值 | 29 | // 是否老用户订单数判断值 |
43 | const OLD_USER_LIMIT = 1; | 30 | const OLD_USER_LIMIT = 1; |
44 | 31 | ||
@@ -117,13 +104,7 @@ class PayModel | @@ -117,13 +104,7 @@ class PayModel | ||
117 | // 用户ID | 104 | // 用户ID |
118 | $result['uid'] = $uid; | 105 | $result['uid'] = $uid; |
119 | 106 | ||
120 | - // 初始化日志 | ||
121 | - $log = new PhpLog(self::PAYMENT_LIST_LOG, 'PRC', self::LOG_LEVEL); | ||
122 | - // 获取支付途径列表 | ||
123 | - $log->LogInfo('===开始调用支付方式列表接口,接口方法为web.SpaceOrders.getPaymentList==='); | ||
124 | $payTypes = PayData::getPaymentList(); | 107 | $payTypes = PayData::getPaymentList(); |
125 | - $log->LogInfo('===结束调用支付方式列表接口,返回结果为==='); | ||
126 | - $log->LogInfo(var_export($payTypes, true)); | ||
127 | 108 | ||
128 | $defaultPayType = 0; | 109 | $defaultPayType = 0; |
129 | $types = array(); | 110 | $types = array(); |
@@ -154,27 +135,15 @@ class PayModel | @@ -154,27 +135,15 @@ class PayModel | ||
154 | 135 | ||
155 | // 无需付款 | 136 | // 无需付款 |
156 | if (isset($order["payment_amount"]) && $order["payment_amount"] == 0) { | 137 | if (isset($order["payment_amount"]) && $order["payment_amount"] == 0) { |
157 | - // 初始化日志 | ||
158 | - $log = new PhpLog(self::ORDER_STATUS_LOG, 'PRC', self::LOG_LEVEL); | ||
159 | - $log->LogInfo('===[' . $orderCode . ']==='); | ||
160 | - | ||
161 | //无需付款-更新订单状态 | 138 | //无需付款-更新订单状态 |
162 | $updateOrderStatus = PayData::pcpayNotify($orderCode, 0, 0); | 139 | $updateOrderStatus = PayData::pcpayNotify($orderCode, 0, 0); |
163 | - $log->LogInfo('===无需付款---结束调用更新订单状态接口,返回结果为==='); | ||
164 | - $log->LogInfo(var_export($updateOrderStatus, true)); | 140 | + UdpLog::info("【无需付款】,orderCode:{$orderCode},更新订单状态结果", $updateOrderStatus); |
165 | $result['notNeedPay'] = true; | 141 | $result['notNeedPay'] = true; |
166 | break; | 142 | break; |
167 | } | 143 | } |
168 | 144 | ||
169 | // 记录支付方式 | 145 | // 记录支付方式 |
170 | - // 初始化日志 | ||
171 | - $log = new PhpLog(self::ORDER_BANK_LOG, 'PRC', self::LOG_LEVEL); | ||
172 | - $log->LogInfo('===开始调用记录支付方式接口,接口方法为web.SpaceOrders.getOrderPayBank==='); | ||
173 | - $log->LogInfo('===请求参数为orderCode=' . $orderCode . '==='); | ||
174 | $bankRecord = PayData::getBankByOrder($orderCode); | 146 | $bankRecord = PayData::getBankByOrder($orderCode); |
175 | - $log->LogInfo('===结束调用记录支付方式接口,返回结果为==='); | ||
176 | - $log->LogInfo(var_export($bankRecord, true)); | ||
177 | - | ||
178 | if (isset($bankRecord['data']['bankCode']) && !empty($bankRecord['data']['bankCode'])) { | 147 | if (isset($bankRecord['data']['bankCode']) && !empty($bankRecord['data']['bankCode'])) { |
179 | $payRecord = $bankRecord['data']['bankCode']; | 148 | $payRecord = $bankRecord['data']['bankCode']; |
180 | } else { | 149 | } else { |
@@ -198,12 +167,7 @@ class PayModel | @@ -198,12 +167,7 @@ class PayModel | ||
198 | 167 | ||
199 | // 是否是老用户(用于订单统计) | 168 | // 是否是老用户(用于订单统计) |
200 | $orderCount = 0; | 169 | $orderCount = 0; |
201 | - // 初始化日志 | ||
202 | - $log = new PhpLog(self::ORDER_COUNT_LOG, 'PRC', self::LOG_LEVEL); | ||
203 | - $log->LogInfo('===开始调用查询用户订单数接口,接口方法为web.SpaceOrders.getOrderCountByUid==='); | ||
204 | $orders = PayData::getOrderCountByUid($uid); | 170 | $orders = PayData::getOrderCountByUid($uid); |
205 | - $log->LogInfo('===结束调用查询用户订单数接口,返回结果为==='); | ||
206 | - $log->LogInfo(var_export($orders, true)); | ||
207 | 171 | ||
208 | if (isset($orders['data']) && !empty($orders['data'])) { | 172 | if (isset($orders['data']) && !empty($orders['data'])) { |
209 | $orderCount = $orders['data']['total']; | 173 | $orderCount = $orders['data']['total']; |
@@ -394,12 +358,7 @@ class PayModel | @@ -394,12 +358,7 @@ class PayModel | ||
394 | $result = array(); | 358 | $result = array(); |
395 | 359 | ||
396 | do { | 360 | do { |
397 | - // 初始化日志 | ||
398 | - $log = new PhpLog(self::ORDER_STATUS_LOG, 'PRC', self::LOG_LEVEL); | ||
399 | - $log->LogInfo('=====[' . $orderCode . ']===开始生成微信支付二维码========'); | ||
400 | - | ||
401 | if (empty($orderCode)) { | 361 | if (empty($orderCode)) { |
402 | - $log->LogInfo('=====[' . $orderCode . ']===微信支付时,订单号为空========'); | ||
403 | $result['error'] = true; | 362 | $result['error'] = true; |
404 | $result['message'] = '订单号不能为空'; | 363 | $result['message'] = '订单号不能为空'; |
405 | break; | 364 | break; |
@@ -408,7 +367,7 @@ class PayModel | @@ -408,7 +367,7 @@ class PayModel | ||
408 | /* 判断订单信息是否存在 */ | 367 | /* 判断订单信息是否存在 */ |
409 | $orderDetail = OrderData::getOrderDetail($uid, $orderCode); | 368 | $orderDetail = OrderData::getOrderDetail($uid, $orderCode); |
410 | if (!isset($orderDetail['data']) || empty($orderDetail['data'])) { | 369 | if (!isset($orderDetail['data']) || empty($orderDetail['data'])) { |
411 | - $log->LogInfo('=====[' . $orderCode . ']===微信支付时,订单信息未查到========'); | 370 | + UdpLog::info("【微信支付时】,function:weixinQrcode,orderCode:{$orderCode},订单信息未查到", array('uid' => $uid, 'orderCode' => $orderCode)); |
412 | $result['error'] = true; | 371 | $result['error'] = true; |
413 | $result['message'] = '没有找到该订单'; | 372 | $result['message'] = '没有找到该订单'; |
414 | break; | 373 | break; |
@@ -435,8 +394,7 @@ class PayModel | @@ -435,8 +394,7 @@ class PayModel | ||
435 | $input->SetProduct_id($orderCode); | 394 | $input->SetProduct_id($orderCode); |
436 | $notify = new WxPayNativePay(); | 395 | $notify = new WxPayNativePay(); |
437 | $payResult = $notify->GetPayUrl($input); | 396 | $payResult = $notify->GetPayUrl($input); |
438 | - $log->LogInfo('=====[' . $orderCode . ']===微信支付时,微信统一下单的返回结果为:========'); | ||
439 | - $log->LogInfo(var_export($payResult, true)); | 397 | + UdpLog::info("【微信支付时】,function:weixinQrcode,orderCode:{$orderCode},微信统一下单的返回结果为", array('uid' => $uid, 'payResult' => $payResult)); |
440 | 398 | ||
441 | $orderData = $orderDetail['data']; | 399 | $orderData = $orderDetail['data']; |
442 | $firstGoods = current($orderData['order_goods']); | 400 | $firstGoods = current($orderData['order_goods']); |
@@ -452,8 +410,7 @@ class PayModel | @@ -452,8 +410,7 @@ class PayModel | ||
452 | ); | 410 | ); |
453 | 411 | ||
454 | } while (false); | 412 | } while (false); |
455 | - $log->LogInfo('=====[' . $orderCode . ']===微信支付时,处理微信支付的结果为:========'); | ||
456 | - $log->LogInfo(var_export($result, true)); | 413 | + UdpLog::info("【微信支付】,function:weixinQrcode,orderCode:{$orderCode},处理微信支付的结果为", array('uid' => $uid, 'result' => $result)); |
457 | 414 | ||
458 | return $result; | 415 | return $result; |
459 | } | 416 | } |
@@ -477,26 +434,19 @@ class PayModel | @@ -477,26 +434,19 @@ class PayModel | ||
477 | break; | 434 | break; |
478 | } | 435 | } |
479 | 436 | ||
480 | - // 初始化日志 | ||
481 | - $log = new PhpLog(self::ORDER_STATUS_LOG, 'PRC', self::LOG_LEVEL); | ||
482 | - $log->LogInfo('=====[' . $orderCode . ']===开始查询微信扫码支付状态========'); | ||
483 | - | ||
484 | // 组装微信支付的订单号 | 437 | // 组装微信支付的订单号 |
485 | $tradeNo = 'YOHOBuy_' . $orderCode; | 438 | $tradeNo = 'YOHOBuy_' . $orderCode; |
486 | $input = new WxPayOrderQuery(); | 439 | $input = new WxPayOrderQuery(); |
487 | $input->SetOut_trade_no($tradeNo); | 440 | $input->SetOut_trade_no($tradeNo); |
488 | $payResult = WxPayApi::orderQuery($input); | 441 | $payResult = WxPayApi::orderQuery($input); |
489 | - $log->LogInfo(var_export($payResult, true)); | ||
490 | - | 442 | + UdpLog::info("【微信支付】,function:checkWechatPayStatus,orderCode:{$orderCode},检查微信扫码支付结果", array('uid' => $uid, 'payResult' => $payResult)); |
491 | if (isset($payResult['trade_state']) && $payResult['trade_state'] === 'SUCCESS') { | 443 | if (isset($payResult['trade_state']) && $payResult['trade_state'] === 'SUCCESS') { |
492 | - $log->LogInfo('====[' . $orderCode . ']====微信扫码支付成功========'); | ||
493 | $result = array( | 444 | $result = array( |
494 | 'code' => '200', | 445 | 'code' => '200', |
495 | 'message' => 'success' | 446 | 'message' => 'success' |
496 | ); | 447 | ); |
497 | } | 448 | } |
498 | 449 | ||
499 | - $log->LogInfo('====[' . $orderCode . ']====微信扫码支付失败========'); | ||
500 | } while (false); | 450 | } while (false); |
501 | 451 | ||
502 | return $result; | 452 | return $result; |
@@ -518,18 +468,10 @@ class PayModel | @@ -518,18 +468,10 @@ class PayModel | ||
518 | ); | 468 | ); |
519 | 469 | ||
520 | do { | 470 | do { |
521 | - // 初始化日志 | ||
522 | - $log = new PhpLog(self::ORDER_STATUS_LOG, 'PRC', self::LOG_LEVEL); | ||
523 | - $log->LogInfo('========[' . $payResult->orderCode . ']========'); | ||
524 | - $log->LogInfo(var_export($payResult, true)); | ||
525 | 471 | ||
526 | - $log->LogInfo('==[' . $payResult->orderCode . ']=开始调用获取订单详情方式接口,接口方法为app.SpaceOrders.detail==='); | ||
527 | $orderInfo = OrderData::getOrderDetail($uid, $payResult->orderCode); | 472 | $orderInfo = OrderData::getOrderDetail($uid, $payResult->orderCode); |
528 | - $log->LogInfo('==[' . $payResult->orderCode . ']=结束调用获取订单详情方式接口,返回结果为==='); | ||
529 | - $log->LogInfo(var_export($orderInfo, true)); | ||
530 | - | 473 | + UdpLog::info("【订单支付后处理】,function:procOrderData,orderCode:{$payResult->orderCode},订单信息", $orderInfo); |
531 | if (!isset($orderInfo['data']) || empty($orderInfo['data'])) { | 474 | if (!isset($orderInfo['data']) || empty($orderInfo['data'])) { |
532 | - $log->LogInfo('==[' . $payResult->orderCode . ']=订单支付失败,未获取到订单详情信息==='); | ||
533 | break; | 475 | break; |
534 | } | 476 | } |
535 | 477 | ||
@@ -541,14 +483,11 @@ class PayModel | @@ -541,14 +483,11 @@ class PayModel | ||
541 | // 订单已取消 | 483 | // 订单已取消 |
542 | if ($orderData['is_cancel'] === 'Y' && $paymentStatus === 'N') { | 484 | if ($orderData['is_cancel'] === 'Y' && $paymentStatus === 'N') { |
543 | // 给用户发送短信 | 485 | // 给用户发送短信 |
544 | - // 初始化日志 | ||
545 | - $log = new PhpLog(self::SEND_MESSAGE_LOG, 'PRC', self::LOG_LEVEL); | ||
546 | - $log->LogInfo('===[' . $orderCode . ']==='); | ||
547 | - $log->LogInfo('==[' . $orderCode . ']=开始调用订单取消时给用户发短信接口,接口方法为app.message.sendMsg==='); | ||
548 | $messageReturn = PayData::sendMessage($orderData['mobile'], 'error_sms', '支付成功,但订单已取消,订单号为' . $orderCode); | 486 | $messageReturn = PayData::sendMessage($orderData['mobile'], 'error_sms', '支付成功,但订单已取消,订单号为' . $orderCode); |
549 | - $log->LogInfo('==[' . $orderCode . ']=结束调用给用户发短信接口,返回结果为==='); | ||
550 | - $log->LogInfo(var_export($messageReturn, true)); | ||
551 | - | 487 | + UdpLog::info( |
488 | + "【订单支付后处理】,function:procOrderData,orderCode:{$payResult->orderCode},支付成功,但订单已取消,给用户发信息", | ||
489 | + array('orderInfo' => $orderInfo, 'messageReturn' => $messageReturn) | ||
490 | + ); | ||
552 | $result['code'] = 417; | 491 | $result['code'] = 417; |
553 | $result['message'] = '支付成功,但订单已取消,需联系客服'; | 492 | $result['message'] = '支付成功,但订单已取消,需联系客服'; |
554 | break; | 493 | break; |
@@ -556,8 +495,10 @@ class PayModel | @@ -556,8 +495,10 @@ class PayModel | ||
556 | 495 | ||
557 | // 支付金额与订单金额不一致 | 496 | // 支付金额与订单金额不一致 |
558 | if (round($amount, 2) != round($payResult->totalFee, 2)) { | 497 | if (round($amount, 2) != round($payResult->totalFee, 2)) { |
559 | - $log = new PhpLog(self::ORDER_STATUS_LOG, 'PRC', self::LOG_LEVEL); | ||
560 | - $log->LogInfo('==[' . $orderCode . ']=订单支付失败,支付金额与订单金额不一致==='); | 498 | + UdpLog::info( |
499 | + "【订单支付后处理】,function:procOrderData,orderCode:{$payResult->orderCode},订单支付失败,支付金额与订单金额不一致", | ||
500 | + array('orderInfo' => $orderInfo) | ||
501 | + ); | ||
561 | $result['code'] = 415; | 502 | $result['code'] = 415; |
562 | $result['message'] = '支付金额与订单金额不一致'; | 503 | $result['message'] = '支付金额与订单金额不一致'; |
563 | break; | 504 | break; |
@@ -570,14 +511,12 @@ class PayModel | @@ -570,14 +511,12 @@ class PayModel | ||
570 | $bankName = $payResult->bankName; | 511 | $bankName = $payResult->bankName; |
571 | $bankCode = $payResult->bankCode; | 512 | $bankCode = $payResult->bankCode; |
572 | 513 | ||
573 | - // 初始化日志 | ||
574 | - $log = new PhpLog(self::ORDER_STATUS_LOG, 'PRC', self::LOG_LEVEL); | ||
575 | - $log->LogInfo('===[' . $orderCode . ']==='); | ||
576 | //更新订单状态 | 514 | //更新订单状态 |
577 | $updateOrderStatus = PayData::pcpayNotify($orderCode, $payment, $amount, $bankName, $bankCode, $tradeNo, $bankBillNo); | 515 | $updateOrderStatus = PayData::pcpayNotify($orderCode, $payment, $amount, $bankName, $bankCode, $tradeNo, $bankBillNo); |
578 | - $log->LogInfo('==[' . $orderCode . ']=结束调用更新订单状态接口,返回结果为==='); | ||
579 | - $log->LogInfo(var_export($updateOrderStatus, true)); | ||
580 | - $log->LogInfo('==[' . $orderCode . ']=订单支付成功,请等待发货==='); | 516 | + UdpLog::info( |
517 | + "【订单支付后处理】,function:procOrderData,orderCode:{$payResult->orderCode},更新订单状态", | ||
518 | + array('orderInfo' => $orderInfo, 'updateOrderStatus' => $updateOrderStatus) | ||
519 | + ); | ||
581 | 520 | ||
582 | $result['code'] = 200; | 521 | $result['code'] = 200; |
583 | $result['message'] = '支付成功,请等待发货'; | 522 | $result['message'] = '支付成功,请等待发货'; |
@@ -16,6 +16,8 @@ use WebPlugin\Pay\weixin\lib\WxPayNativePay; | @@ -16,6 +16,8 @@ use WebPlugin\Pay\weixin\lib\WxPayNativePay; | ||
16 | use WebPlugin\Pay\weixin\lib\WxPayOrderQuery; | 16 | use WebPlugin\Pay\weixin\lib\WxPayOrderQuery; |
17 | use WebPlugin\Pay\weixin\lib\WxPayUnifiedOrder; | 17 | use WebPlugin\Pay\weixin\lib\WxPayUnifiedOrder; |
18 | use Api\Yohobuy; | 18 | use Api\Yohobuy; |
19 | +use WebPlugin\UdpLog; | ||
20 | + | ||
19 | /** | 21 | /** |
20 | * 支付有关方法 改版 | 22 | * 支付有关方法 改版 |
21 | * @copyright 2016/5/22 14:19 xiaoxiao<xiaoxiao.hao@yoho.cn> | 23 | * @copyright 2016/5/22 14:19 xiaoxiao<xiaoxiao.hao@yoho.cn> |
@@ -235,6 +237,10 @@ class PaymentModel | @@ -235,6 +237,10 @@ class PaymentModel | ||
235 | $amount = $orderData['payment_amount']; | 237 | $amount = $orderData['payment_amount']; |
236 | 238 | ||
237 | if ($orderData['is_cancel'] === 'Y') { | 239 | if ($orderData['is_cancel'] === 'Y') { |
240 | + UdpLog::warn( | ||
241 | + "【支付成功】,但订单已取消,orderCode:{$orderData},参数", | ||
242 | + array('payResult' => $payResult, 'orderData' => $orderData) | ||
243 | + ); | ||
238 | // 给用户发送短信 | 244 | // 给用户发送短信 |
239 | PayData::sendMessage($orderData['mobile'], 'error_sms', '支付成功,但订单已取消,订单号为' . $orderCode); | 245 | PayData::sendMessage($orderData['mobile'], 'error_sms', '支付成功,但订单已取消,订单号为' . $orderCode); |
240 | self::$code['code'] = 417; | 246 | self::$code['code'] = 417; |
@@ -242,15 +248,19 @@ class PaymentModel | @@ -242,15 +248,19 @@ class PaymentModel | ||
242 | break; | 248 | break; |
243 | } | 249 | } |
244 | 250 | ||
245 | -// if ($orderData['payment_status'] === 'N') { | ||
246 | -// UdpLog::info( | ||
247 | -// '【用户支付成功,同步地址返回】,查询订单状态为未付款,有可能异步地址还未即时更新状态,参数', | ||
248 | -// array('payResult' => $payResult, 'orderData' => $orderData) | ||
249 | -// ); | ||
250 | -// } | 251 | + if ($orderData['payment_status'] === 'N') { |
252 | + UdpLog::warn( | ||
253 | + "【支付成功,同步地址返回】,查询订单状态为未付款,有可能异步地址还未即时更新状态,orderCode:{$orderCode},参数", | ||
254 | + array('payResult' => $payResult, 'orderData' => $orderData) | ||
255 | + ); | ||
256 | + } | ||
251 | 257 | ||
252 | // 支付金额与订单金额不一致 | 258 | // 支付金额与订单金额不一致 |
253 | if (round($amount, 2) !== round($payResult->totalFee, 2)) { | 259 | if (round($amount, 2) !== round($payResult->totalFee, 2)) { |
260 | + UdpLog::warn( | ||
261 | + "【支付成功】,支付金额与订单金额不一致,orderCode:{$orderCode},参数", | ||
262 | + array('payResult' => $payResult, 'orderData' => $orderData) | ||
263 | + ); | ||
254 | self::$code['code'] = 415; | 264 | self::$code['code'] = 415; |
255 | self::$code['message'] = '支付金额与订单金额不一致,订单状态更新失败!'; | 265 | self::$code['message'] = '支付金额与订单金额不一致,订单状态更新失败!'; |
256 | break; | 266 | break; |
@@ -422,7 +432,10 @@ class PaymentModel | @@ -422,7 +432,10 @@ class PaymentModel | ||
422 | */ | 432 | */ |
423 | public static function sendPayConfirm($orderCode, $paymentId, $uid) | 433 | public static function sendPayConfirm($orderCode, $paymentId, $uid) |
424 | { | 434 | { |
425 | -// UdpLog::info("【支付成功-发送确认接口】,function:sendPayConfirm,支付方式ID:{$paymentId},参数", $payResult); | 435 | + UdpLog::info( |
436 | + "【支付成功-发送确认接口】,function:sendPayConfirm,支付方式ID:{$paymentId},参数", | ||
437 | + array('orderCode' => $orderCode, 'paymentId' => $paymentId, 'uid' => $uid) | ||
438 | + ); | ||
426 | if (empty($orderCode)) { | 439 | if (empty($orderCode)) { |
427 | return self::$code; | 440 | return self::$code; |
428 | } | 441 | } |
@@ -431,10 +444,10 @@ class PaymentModel | @@ -431,10 +444,10 @@ class PaymentModel | ||
431 | $uid = empty($uid) ? self::getUid($orderCode) : $uid; | 444 | $uid = empty($uid) ? self::getUid($orderCode) : $uid; |
432 | $confirm = PayData::payConfirm($orderCode, $paymentId, $uid); | 445 | $confirm = PayData::payConfirm($orderCode, $paymentId, $uid); |
433 | 446 | ||
434 | -// UdpLog::info( | ||
435 | -// "【支付成功-发送确认接口】,function:sendPayConfirm,orderCode:{$orderCode},支付方式ID:{$paymentId},接口返回", | ||
436 | -// array('confirm' => $confirm, '$payResult' => $payResult) | ||
437 | -// ); | 447 | + UdpLog::info( |
448 | + "【支付成功-发送确认接口】,function:sendPayConfirm,orderCode:{$orderCode},支付方式ID:{$paymentId},接口返回", | ||
449 | + array('orderCode' => $orderCode, 'paymentId' => $paymentId, 'uid' => $uid, 'confirm' => $confirm) | ||
450 | + ); | ||
438 | return $confirm; | 451 | return $confirm; |
439 | } | 452 | } |
440 | 453 |
@@ -5,26 +5,17 @@ use Shopping\PayModel; | @@ -5,26 +5,17 @@ use Shopping\PayModel; | ||
5 | use WebPlugin\Pay\PayFactory; | 5 | use WebPlugin\Pay\PayFactory; |
6 | use WebPlugin\Pay\Rspparams; | 6 | use WebPlugin\Pay\Rspparams; |
7 | use WebPlugin\Pay\weixin\PayNotifyCallBack; | 7 | use WebPlugin\Pay\weixin\PayNotifyCallBack; |
8 | -use WebPlugin\PhpLog; | ||
9 | 8 | ||
10 | /** | 9 | /** |
11 | * 支付Notice | 10 | * 支付Notice |
12 | */ | 11 | */ |
13 | class NoticeController extends WebAction | 12 | class NoticeController extends WebAction |
14 | { | 13 | { |
15 | - | ||
16 | - // 日志等级,2表示记录信息等级的日志 | ||
17 | - const LOG_LEVEL = 2; | ||
18 | - // 向回调通知有关调用日志 | ||
19 | - const ORDER_STATUS_LOG = '/Data/logs/pc_pay/order_status'; | ||
20 | // 存储的UID键名 | 14 | // 存储的UID键名 |
21 | const SESSION_UID_KEY = 'payUserid'; | 15 | const SESSION_UID_KEY = 'payUserid'; |
22 | 16 | ||
23 | - private $log = null; | ||
24 | - | ||
25 | public function init() { | 17 | public function init() { |
26 | parent::init(); | 18 | parent::init(); |
27 | - $this->log = new PhpLog(self::ORDER_STATUS_LOG, 'PRC', self::LOG_LEVEL); | ||
28 | } | 19 | } |
29 | 20 | ||
30 | /** | 21 | /** |
@@ -35,8 +26,6 @@ class NoticeController extends WebAction | @@ -35,8 +26,6 @@ class NoticeController extends WebAction | ||
35 | $payment = PayModel::getPaymentById(2); | 26 | $payment = PayModel::getPaymentById(2); |
36 | $payService = PayFactory::factory($payment); | 27 | $payService = PayFactory::factory($payment); |
37 | 28 | ||
38 | - $this->log->LogInfo("begin alipaynoticeAction"); | ||
39 | - | ||
40 | $res = $payService->parseResponse($_POST); //支付宝通知使用的 | 29 | $res = $payService->parseResponse($_POST); //支付宝通知使用的 |
41 | if ($res->payResult != -1) { | 30 | if ($res->payResult != -1) { |
42 | $this->payResultProc($res, 2); | 31 | $this->payResultProc($res, 2); |
@@ -50,8 +39,6 @@ class NoticeController extends WebAction | @@ -50,8 +39,6 @@ class NoticeController extends WebAction | ||
50 | */ | 39 | */ |
51 | public function alipayreturnAction() | 40 | public function alipayreturnAction() |
52 | { | 41 | { |
53 | - $this->log->LogInfo("begin alipayreturnAction"); | ||
54 | - | ||
55 | $payment = PayModel::getPaymentById(2); | 42 | $payment = PayModel::getPaymentById(2); |
56 | $payService = PayFactory::factory($payment); | 43 | $payService = PayFactory::factory($payment); |
57 | $res = $payService->parseResponse($_GET); | 44 | $res = $payService->parseResponse($_GET); |
@@ -65,7 +52,6 @@ class NoticeController extends WebAction | @@ -65,7 +52,6 @@ class NoticeController extends WebAction | ||
65 | */ | 52 | */ |
66 | public function alibarcodenoticeAction() | 53 | public function alibarcodenoticeAction() |
67 | { | 54 | { |
68 | - $this->log->LogInfo("begin alibarcodenoticeAction"); | ||
69 | $payment = PayModel::getPaymentById(17); | 55 | $payment = PayModel::getPaymentById(17); |
70 | $payService = PayFactory::factory($payment); | 56 | $payService = PayFactory::factory($payment); |
71 | $res = $payService->parseResponse($_POST); //支付宝通知使用的 | 57 | $res = $payService->parseResponse($_POST); //支付宝通知使用的 |
@@ -81,7 +67,6 @@ class NoticeController extends WebAction | @@ -81,7 +67,6 @@ class NoticeController extends WebAction | ||
81 | */ | 67 | */ |
82 | public function alibarcodereturnAction() | 68 | public function alibarcodereturnAction() |
83 | { | 69 | { |
84 | - $this->log->LogInfo("begin alibarcodereturnAction"); | ||
85 | $payment = PayModel::getPaymentById(17); | 70 | $payment = PayModel::getPaymentById(17); |
86 | $payService = PayFactory::factory($payment); | 71 | $payService = PayFactory::factory($payment); |
87 | $res = $payService->parseResponse($_GET); | 72 | $res = $payService->parseResponse($_GET); |
@@ -95,7 +80,6 @@ class NoticeController extends WebAction | @@ -95,7 +80,6 @@ class NoticeController extends WebAction | ||
95 | */ | 80 | */ |
96 | public function allinpaynoticeAction() | 81 | public function allinpaynoticeAction() |
97 | { | 82 | { |
98 | - $this->log->LogInfo("begin allinpaynoticeAction"); | ||
99 | $payment = PayModel::getPaymentById(16); | 83 | $payment = PayModel::getPaymentById(16); |
100 | $payService = PayFactory::factory($payment); | 84 | $payService = PayFactory::factory($payment); |
101 | $res = $payService->parseResponse($_POST); | 85 | $res = $payService->parseResponse($_POST); |
@@ -111,7 +95,6 @@ class NoticeController extends WebAction | @@ -111,7 +95,6 @@ class NoticeController extends WebAction | ||
111 | */ | 95 | */ |
112 | public function allinpayreturnAction() | 96 | public function allinpayreturnAction() |
113 | { | 97 | { |
114 | - $this->log->LogInfo("begin allinpayreturnAction"); | ||
115 | $payment = PayModel::getPaymentById(16); | 98 | $payment = PayModel::getPaymentById(16); |
116 | $payService = PayFactory::factory($payment); | 99 | $payService = PayFactory::factory($payment); |
117 | $res = $payService->parseResponse($_POST); | 100 | $res = $payService->parseResponse($_POST); |
@@ -125,7 +108,6 @@ class NoticeController extends WebAction | @@ -125,7 +108,6 @@ class NoticeController extends WebAction | ||
125 | */ | 108 | */ |
126 | public function aliexpressgatewayreturnAction() | 109 | public function aliexpressgatewayreturnAction() |
127 | { | 110 | { |
128 | - $this->log->LogInfo("begin aliexpressgatewayreturnAction"); | ||
129 | $payment = PayModel::getPaymentById(13); | 111 | $payment = PayModel::getPaymentById(13); |
130 | $payService = PayFactory::factory($payment); | 112 | $payService = PayFactory::factory($payment); |
131 | $res = $payService->parseResponse($_GET); | 113 | $res = $payService->parseResponse($_GET); |
@@ -139,7 +121,6 @@ class NoticeController extends WebAction | @@ -139,7 +121,6 @@ class NoticeController extends WebAction | ||
139 | */ | 121 | */ |
140 | public function aliexpressgatewaynoticeAction() | 122 | public function aliexpressgatewaynoticeAction() |
141 | { | 123 | { |
142 | - $this->log->LogInfo("begin aliexpressgatewaynoticeAction"); | ||
143 | $payment = PayModel::getPaymentById(13); | 124 | $payment = PayModel::getPaymentById(13); |
144 | $payService = PayFactory::factory($payment); | 125 | $payService = PayFactory::factory($payment); |
145 | $res = $payService->parseResponse($_POST); //支付宝通知使用的 | 126 | $res = $payService->parseResponse($_POST); //支付宝通知使用的 |
@@ -155,7 +136,6 @@ class NoticeController extends WebAction | @@ -155,7 +136,6 @@ class NoticeController extends WebAction | ||
155 | */ | 136 | */ |
156 | public function alibanknoticeAction() | 137 | public function alibanknoticeAction() |
157 | { | 138 | { |
158 | - $this->log->LogInfo("begin alibanknoticeAction"); | ||
159 | $payment = PayModel::getPaymentById(12); | 139 | $payment = PayModel::getPaymentById(12); |
160 | $payService = PayFactory::factory($payment); | 140 | $payService = PayFactory::factory($payment); |
161 | $res = $payService->parseResponse($_POST); | 141 | $res = $payService->parseResponse($_POST); |
@@ -173,7 +153,6 @@ class NoticeController extends WebAction | @@ -173,7 +153,6 @@ class NoticeController extends WebAction | ||
173 | */ | 153 | */ |
174 | public function alibankreturnAction() | 154 | public function alibankreturnAction() |
175 | { | 155 | { |
176 | - $this->log->LogInfo("begin alibanknoticeAction"); | ||
177 | $payment = PayModel::getPaymentById(12); | 156 | $payment = PayModel::getPaymentById(12); |
178 | $payService = PayFactory::factory($payment); | 157 | $payService = PayFactory::factory($payment); |
179 | $res = $payService->parseResponse($_GET); | 158 | $res = $payService->parseResponse($_GET); |
@@ -187,7 +166,6 @@ class NoticeController extends WebAction | @@ -187,7 +166,6 @@ class NoticeController extends WebAction | ||
187 | */ | 166 | */ |
188 | public function chinabankAction() | 167 | public function chinabankAction() |
189 | { | 168 | { |
190 | - $this->log->LogInfo("begin chinabankAction"); | ||
191 | $payment = PayModel::getPaymentById(4); | 169 | $payment = PayModel::getPaymentById(4); |
192 | $payService = PayFactory::factory($payment); | 170 | $payService = PayFactory::factory($payment); |
193 | $res = $payService->parseResponse($_POST); | 171 | $res = $payService->parseResponse($_POST); |
@@ -201,7 +179,6 @@ class NoticeController extends WebAction | @@ -201,7 +179,6 @@ class NoticeController extends WebAction | ||
201 | */ | 179 | */ |
202 | public function chinabankautorevAction() | 180 | public function chinabankautorevAction() |
203 | { | 181 | { |
204 | - $this->log->LogInfo("begin chinabankautorevAction"); | ||
205 | $payment = PayModel::getPaymentById(4); | 182 | $payment = PayModel::getPaymentById(4); |
206 | $payService = PayFactory::factory($payment); | 183 | $payService = PayFactory::factory($payment); |
207 | $res = $payService->parseResponse($_POST); | 184 | $res = $payService->parseResponse($_POST); |
@@ -219,7 +196,6 @@ class NoticeController extends WebAction | @@ -219,7 +196,6 @@ class NoticeController extends WebAction | ||
219 | */ | 196 | */ |
220 | public function tenpayAction() | 197 | public function tenpayAction() |
221 | { | 198 | { |
222 | - $this->log->LogInfo("begin tenpayAction"); | ||
223 | $payment = PayModel::getPaymentById(1); | 199 | $payment = PayModel::getPaymentById(1); |
224 | $payService = PayFactory::factory($payment); | 200 | $payService = PayFactory::factory($payment); |
225 | $rspParams = $payService->parseResponse($_GET); //财付通是以get方式回复的。 | 201 | $rspParams = $payService->parseResponse($_GET); //财付通是以get方式回复的。 |
@@ -235,7 +211,6 @@ class NoticeController extends WebAction | @@ -235,7 +211,6 @@ class NoticeController extends WebAction | ||
235 | */ | 211 | */ |
236 | public function shengpayreturnAction() | 212 | public function shengpayreturnAction() |
237 | { | 213 | { |
238 | - $this->log->LogInfo("begin shengpayreturnAction"); | ||
239 | $payment = PayModel::getPaymentById(11); | 214 | $payment = PayModel::getPaymentById(11); |
240 | $payService = PayFactory::factory($payment); | 215 | $payService = PayFactory::factory($payment); |
241 | $res = $payService->parseResponse($_POST); | 216 | $res = $payService->parseResponse($_POST); |
@@ -249,7 +224,6 @@ class NoticeController extends WebAction | @@ -249,7 +224,6 @@ class NoticeController extends WebAction | ||
249 | */ | 224 | */ |
250 | public function shengpaynoticeAction() | 225 | public function shengpaynoticeAction() |
251 | { | 226 | { |
252 | - $this->log->LogInfo("begin shengpaynoticeAction"); | ||
253 | $payment = PayModel::getPaymentById(11); | 227 | $payment = PayModel::getPaymentById(11); |
254 | $payService = PayFactory::factory($payment); | 228 | $payService = PayFactory::factory($payment); |
255 | $res = $payService->parseResponse($_POST); | 229 | $res = $payService->parseResponse($_POST); |
@@ -265,7 +239,6 @@ class NoticeController extends WebAction | @@ -265,7 +239,6 @@ class NoticeController extends WebAction | ||
265 | */ | 239 | */ |
266 | public function wechatcallbackAction() | 240 | public function wechatcallbackAction() |
267 | { | 241 | { |
268 | - $this->log->LogInfo("begin wechatcallbackAction"); | ||
269 | $callback = $this->get('callback'); | 242 | $callback = $this->get('callback'); |
270 | $orderCode = $this->get('ordercode'); | 243 | $orderCode = $this->get('ordercode'); |
271 | 244 | ||
@@ -280,14 +253,11 @@ class NoticeController extends WebAction | @@ -280,14 +253,11 @@ class NoticeController extends WebAction | ||
280 | */ | 253 | */ |
281 | public function wechatqrcodenotifyAction() | 254 | public function wechatqrcodenotifyAction() |
282 | { | 255 | { |
283 | - $this->log->LogInfo("begin wechatqrcodenotifyAction"); | ||
284 | - | ||
285 | $uid = $this->getUid(); | 256 | $uid = $this->getUid(); |
286 | if (empty($uid)) { // cookie中获取为空时再从之前保存的session中获取 | 257 | if (empty($uid)) { // cookie中获取为空时再从之前保存的session中获取 |
287 | $uid = $this->getSession(self::SESSION_UID_KEY); | 258 | $uid = $this->getSession(self::SESSION_UID_KEY); |
288 | $this->setSession(self::SESSION_UID_KEY, null); | 259 | $this->setSession(self::SESSION_UID_KEY, null); |
289 | } | 260 | } |
290 | - $this->log->LogInfo($uid); | ||
291 | $notify = new PayNotifyCallBack($uid); | 261 | $notify = new PayNotifyCallBack($uid); |
292 | $notify->handle(false); | 262 | $notify->handle(false); |
293 | } | 263 | } |
@@ -297,7 +267,6 @@ class NoticeController extends WebAction | @@ -297,7 +267,6 @@ class NoticeController extends WebAction | ||
297 | */ | 267 | */ |
298 | public function wechatqrcodereturnAction() | 268 | public function wechatqrcodereturnAction() |
299 | { | 269 | { |
300 | - $this->log->LogInfo("begin wechatqrcodereturnAction"); | ||
301 | $dealResult = array( | 270 | $dealResult = array( |
302 | 'code' => 500, | 271 | 'code' => 500, |
303 | 'message' => '支付失败' | 272 | 'message' => '支付失败' |
@@ -324,7 +293,6 @@ class NoticeController extends WebAction | @@ -324,7 +293,6 @@ class NoticeController extends WebAction | ||
324 | */ | 293 | */ |
325 | public function unionpaywebreturnAction() | 294 | public function unionpaywebreturnAction() |
326 | { | 295 | { |
327 | - $this->log->LogInfo("begin unionpaywebreturnAction"); | ||
328 | $payment = PayModel::getPaymentById(25); | 296 | $payment = PayModel::getPaymentById(25); |
329 | $payService = PayFactory::factory($payment); | 297 | $payService = PayFactory::factory($payment); |
330 | $res = $payService->parseResponse($_REQUEST); | 298 | $res = $payService->parseResponse($_REQUEST); |
@@ -338,7 +306,6 @@ class NoticeController extends WebAction | @@ -338,7 +306,6 @@ class NoticeController extends WebAction | ||
338 | */ | 306 | */ |
339 | public function unionpaywebnoticeAction() | 307 | public function unionpaywebnoticeAction() |
340 | { | 308 | { |
341 | - $this->log->LogInfo("begin unionpaywebnoticeAction"); | ||
342 | $payment = PayModel::getPaymentById(25); | 309 | $payment = PayModel::getPaymentById(25); |
343 | $payService = PayFactory::factory($payment); | 310 | $payService = PayFactory::factory($payment); |
344 | $res = $payService->parseResponse($_REQUEST); | 311 | $res = $payService->parseResponse($_REQUEST); |
@@ -355,7 +322,6 @@ class NoticeController extends WebAction | @@ -355,7 +322,6 @@ class NoticeController extends WebAction | ||
355 | */ | 322 | */ |
356 | public function alimobilenoticeminiAction() | 323 | public function alimobilenoticeminiAction() |
357 | { | 324 | { |
358 | - $this->log->LogInfo("begin alimobilenoticeminiAction"); | ||
359 | $payment = PayModel::getPaymentById(20); | 325 | $payment = PayModel::getPaymentById(20); |
360 | $payService = PayFactory::factory($payment); | 326 | $payService = PayFactory::factory($payment); |
361 | $res = $payService->parseResponse($_POST); //支付宝通知使用的 | 327 | $res = $payService->parseResponse($_POST); //支付宝通知使用的 |
@@ -408,12 +374,6 @@ class NoticeController extends WebAction | @@ -408,12 +374,6 @@ class NoticeController extends WebAction | ||
408 | */ | 374 | */ |
409 | private function payResultProc($payResult, $payment) | 375 | private function payResultProc($payResult, $payment) |
410 | { | 376 | { |
411 | - // 初始化日志 | ||
412 | - $log = $this->log; | ||
413 | - $log->LogInfo('================开始验证登录状态============'); | ||
414 | - $log->LogInfo('================支付结果数据为============'); | ||
415 | - $log->LogInfo(var_export($payResult, true)); | ||
416 | - | ||
417 | //判断是否登录 | 377 | //判断是否登录 |
418 | $uid = $this->getUid(); | 378 | $uid = $this->getUid(); |
419 | if (empty($uid)) { // cookie中获取为空时再从之前保存的session中获取 | 379 | if (empty($uid)) { // cookie中获取为空时再从之前保存的session中获取 |
@@ -421,8 +381,6 @@ class NoticeController extends WebAction | @@ -421,8 +381,6 @@ class NoticeController extends WebAction | ||
421 | $this->setSession(self::SESSION_UID_KEY, null); | 381 | $this->setSession(self::SESSION_UID_KEY, null); |
422 | } | 382 | } |
423 | 383 | ||
424 | - $log->LogInfo('================已登录,获取到用户ID============'); | ||
425 | - | ||
426 | $result = array( | 384 | $result = array( |
427 | 'code' => 500, | 385 | 'code' => 500, |
428 | 'message' => '支付失败' | 386 | 'message' => '支付失败' |
@@ -433,9 +391,6 @@ class NoticeController extends WebAction | @@ -433,9 +391,6 @@ class NoticeController extends WebAction | ||
433 | $result = PayModel::procOrderData($uid, $payResult, $payment); | 391 | $result = PayModel::procOrderData($uid, $payResult, $payment); |
434 | } | 392 | } |
435 | 393 | ||
436 | - $log->LogInfo('================支付结果为============'); | ||
437 | - $log->LogInfo(var_export($result, true)); | ||
438 | - | ||
439 | return $result; | 394 | return $result; |
440 | } | 395 | } |
441 | } | 396 | } |
-
Please register or login to post a comment