Authored by Rock Zhang

细化一些支付的日志记录

@@ -113,8 +113,8 @@ class Service extends PayAbstract @@ -113,8 +113,8 @@ class Service extends PayAbstract
113 * http://www.yohobuy.com/pay/notice/alipayreturn?buyer_email=tds%40smartunite.com&buyer_id=2088302294447308&exterface=create_direct_pay_by_user&is_success=T&notify_id=RqPnCoPT3K9%252Fvwbh3I7xtEV5W65QRToFQ5fPrXsVxt12e%252FExCtC1XNiKnuRwupLaVLAR&notify_time=2011-06-11+07%3A48%3A10&notify_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 113 * http://www.yohobuy.com/pay/notice/alipayreturn?buyer_email=tds%40smartunite.com&buyer_id=2088302294447308&exterface=create_direct_pay_by_user&is_success=T&notify_id=RqPnCoPT3K9%252Fvwbh3I7xtEV5W65QRToFQ5fPrXsVxt12e%252FExCtC1XNiKnuRwupLaVLAR&notify_time=2011-06-11+07%3A48%3A10&notify_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
114 */ 114 */
115 $this->log->LogInfo("===开始解析支付宝银行的回调参数==="); 115 $this->log->LogInfo("===开始解析支付宝银行的回调参数===");
116 - $this->log->logInfo("-----回调参数为---");  
117 - $this->log->logInfo(var_export($arrResponse), true); 116 + $this->log->LogInfo("-----回调参数为---");
  117 + $this->log->LogInfo(var_export($arrResponse, true));
118 118
119 if (isset($arrResponse['q'])) { 119 if (isset($arrResponse['q'])) {
120 unset($arrResponse['q']); 120 unset($arrResponse['q']);
@@ -63,13 +63,13 @@ class Service extends PayAbstract @@ -63,13 +63,13 @@ class Service extends PayAbstract
63 $rsp->tradeNo = $arrResponse['trade_no']; 63 $rsp->tradeNo = $arrResponse['trade_no'];
64 $rsp->bankBillNo = ""; 64 $rsp->bankBillNo = "";
65 65
66 - $this->log->logInfo(var_export($arrResponse, true));  
67 - $this->log->logInfo('======alimobilemini成功==='); 66 + $this->log->LogInfo(var_export($arrResponse, true));
  67 + $this->log->LogInfo('======alimobilemini成功===');
68 } else { 68 } else {
69 //不成功 69 //不成功
70 $rsp->payResult = -1; 70 $rsp->payResult = -1;
71 - $this->log->logInfo(var_export($arrResponse, true));  
72 - $this->log->logInfo('======alimobilemini失败===订单号----->' . $arrResponse['out_trade_no']); 71 + $this->log->LogInfo(var_export($arrResponse, true));
  72 + $this->log->LogInfo('======alimobilemini失败===订单号----->' . $arrResponse['out_trade_no']);
73 } 73 }
74 74
75 return $rsp; 75 return $rsp;
@@ -47,8 +47,8 @@ class Service extends PayAbstract @@ -47,8 +47,8 @@ class Service extends PayAbstract
47 public function getPayRequestPars(Reqparams $params) 47 public function getPayRequestPars(Reqparams $params)
48 { 48 {
49 $this->log->LogInfo("===开始处理支付宝的请求参数==="); 49 $this->log->LogInfo("===开始处理支付宝的请求参数===");
50 - $this->log->logInfo("-----请求参数为---");  
51 - $this->log->logInfo(var_export($params, true)); 50 + $this->log->LogInfo("-----请求参数为---");
  51 + $this->log->LogInfo(var_export($params, true));
52 52
53 $baseUrl = $this->getBaseNoticeUrl($params->isTest); 53 $baseUrl = $this->getBaseNoticeUrl($params->isTest);
54 // $loseTime = intval(($params->orderTime + 7200 -time())/60); 54 // $loseTime = intval(($params->orderTime + 7200 -time())/60);
@@ -101,7 +101,7 @@ class Service extends PayAbstract @@ -101,7 +101,7 @@ class Service extends PayAbstract
101 'reqType' => 'get' 101 'reqType' => 'get'
102 ); 102 );
103 103
104 - $this->log->LogInfo('----支付宝回调处理结果为----'); 104 + $this->log->LogInfo('----支付宝请求处理结果为----');
105 $this->log->LogInfo(var_export($result, true)); 105 $this->log->LogInfo(var_export($result, true));
106 106
107 return $result; 107 return $result;
@@ -113,19 +113,19 @@ class Service extends PayAbstract @@ -113,19 +113,19 @@ class Service extends PayAbstract
113 * http://www.yohobuy.com/pay/notice/alipayreturn?buyer_email=tds%40smartunite.com&buyer_id=2088302294447308&exterface=create_direct_pay_by_user&is_success=T&notify_id=RqPnCoPT3K9%252Fvwbh3I7xtEV5W65QRToFQ5fPrXsVxt12e%252FExCtC1XNiKnuRwupLaVLAR&notify_time=2011-06-11+07%3A48%3A10&notify_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 113 * http://www.yohobuy.com/pay/notice/alipayreturn?buyer_email=tds%40smartunite.com&buyer_id=2088302294447308&exterface=create_direct_pay_by_user&is_success=T&notify_id=RqPnCoPT3K9%252Fvwbh3I7xtEV5W65QRToFQ5fPrXsVxt12e%252FExCtC1XNiKnuRwupLaVLAR&notify_time=2011-06-11+07%3A48%3A10&notify_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
114 */ 114 */
115 $this->log->LogInfo("===开始解析支付宝的回调参数==="); 115 $this->log->LogInfo("===开始解析支付宝的回调参数===");
116 - $this->log->logInfo("-----回调参数为---");  
117 - $this->log->logInfo(var_export($arrResponse, true)); 116 + $this->log->LogInfo("-----回调参数为---");
  117 + $this->log->LogInfo(var_export($arrResponse, true));
118 118
119 if (isset($arrResponse['q'])) { 119 if (isset($arrResponse['q'])) {
120 unset($arrResponse['q']); 120 unset($arrResponse['q']);
121 } 121 }
122 $rsp = new Rspparams(); 122 $rsp = new Rspparams();
123 if (!$this->checkResponse($arrResponse)) { 123 if (!$this->checkResponse($arrResponse)) {
124 - $this->log->logInfo("-----支付宝回调参数验证签名失败---"); 124 + $this->log->LogInfo("-----支付宝回调参数验证签名失败---");
125 //验证不成功 125 //验证不成功
126 $rsp->payResult = -1; 126 $rsp->payResult = -1;
127 } else { 127 } else {
128 - $this->log->logInfo("-----支付宝回调参数验证签名成功---"); 128 + $this->log->LogInfo("-----支付宝回调参数验证签名成功---");
129 $rsp->bankName = ""; 129 $rsp->bankName = "";
130 $outTradeNo = $arrResponse["out_trade_no"]; 130 $outTradeNo = $arrResponse["out_trade_no"];
131 $rsp->orderCode = $outTradeNo; 131 $rsp->orderCode = $outTradeNo;
@@ -138,6 +138,10 @@ class Service extends PayAbstract @@ -138,6 +138,10 @@ class Service extends PayAbstract
138 $rsp->tradeNo = $arrResponse['trade_no']; 138 $rsp->tradeNo = $arrResponse['trade_no'];
139 $rsp->bankBillNo = ""; 139 $rsp->bankBillNo = "";
140 } 140 }
  141 +
  142 + $this->log->LogInfo("-----解析支付宝回调参数的结果为---");
  143 + $this->log->LogInfo(var_export($rsp, true));
  144 +
141 return $rsp; 145 return $rsp;
142 } 146 }
143 147
@@ -68,16 +68,16 @@ class Service extends PayAbstract @@ -68,16 +68,16 @@ class Service extends PayAbstract
68 public function parseResponse(array $arrResponse) 68 public function parseResponse(array $arrResponse)
69 { 69 {
70 $this->log->LogInfo("===开始处理通联支付的回调参数==="); 70 $this->log->LogInfo("===开始处理通联支付的回调参数===");
71 - $this->log->logInfo("-----回调参数为---");  
72 - $this->log->logInfo(var_export($arrResponse, true)); 71 + $this->log->LogInfo("-----回调参数为---");
  72 + $this->log->LogInfo(var_export($arrResponse, true));
73 73
74 $rsp = new Rspparams(); 74 $rsp = new Rspparams();
75 if (!$this->checkResponse($arrResponse)) { 75 if (!$this->checkResponse($arrResponse)) {
76 - $this->log->logInfo("-----验证通联支付回调参数失败---"); 76 + $this->log->LogInfo("-----验证通联支付回调参数失败---");
77 77
78 $rsp->payResult = -1; 78 $rsp->payResult = -1;
79 } else { 79 } else {
80 - $this->log->logInfo("-----验证通联支付回调参数成功---"); 80 + $this->log->LogInfo("-----验证通联支付回调参数成功---");
81 81
82 $rsp->bankName = ""; 82 $rsp->bankName = "";
83 $rsp->orderCode = $arrResponse["orderNo"]; 83 $rsp->orderCode = $arrResponse["orderNo"];
@@ -32,8 +32,8 @@ class Service extends PayAbstract @@ -32,8 +32,8 @@ class Service extends PayAbstract
32 { 32 {
33 33
34 $this->log->LogInfo("===开始处理盛付通的请求参数==="); 34 $this->log->LogInfo("===开始处理盛付通的请求参数===");
35 - $this->log->logInfo("-----请求参数为---");  
36 - $this->log->logInfo(var_export($params, true)); 35 + $this->log->LogInfo("-----请求参数为---");
  36 + $this->log->LogInfo(var_export($params, true));
37 37
38 $bankCode = $params->paymentParameter == 'platform' ? '' : $params->paymentParameter; 38 $bankCode = $params->paymentParameter == 'platform' ? '' : $params->paymentParameter;
39 $baseUrl = $this->getBaseNoticeUrl($params->isTest); 39 $baseUrl = $this->getBaseNoticeUrl($params->isTest);
@@ -109,17 +109,17 @@ class Service extends PayAbstract @@ -109,17 +109,17 @@ class Service extends PayAbstract
109 function parseResponse(Array $arrResponse) 109 function parseResponse(Array $arrResponse)
110 { 110 {
111 $this->log->LogInfo("===开始处理盛付通的回调参数==="); 111 $this->log->LogInfo("===开始处理盛付通的回调参数===");
112 - $this->log->logInfo("-----回调参数为---");  
113 - $this->log->logInfo(var_export($arrResponse, true)); 112 + $this->log->LogInfo("-----回调参数为---");
  113 + $this->log->LogInfo(var_export($arrResponse, true));
114 114
115 $rsp = new Rspparams(); 115 $rsp = new Rspparams();
116 if (!$this->checkResponse($arrResponse)) { 116 if (!$this->checkResponse($arrResponse)) {
117 - $this->log->logInfo("-----验证盛付通回调参数失败---"); 117 + $this->log->LogInfo("-----验证盛付通回调参数失败---");
118 118
119 //验证不成功 119 //验证不成功
120 $rsp->payResult = -1; 120 $rsp->payResult = -1;
121 } else { 121 } else {
122 - $this->log->logInfo("-----验证盛付通回调参数成功---"); 122 + $this->log->LogInfo("-----验证盛付通回调参数成功---");
123 123
124 $rsp->bankName = ""; 124 $rsp->bankName = "";
125 $rsp->orderCode = $arrResponse["OrderNo"]; 125 $rsp->orderCode = $arrResponse["OrderNo"];
@@ -35,8 +35,8 @@ class Service extends PayAbstract @@ -35,8 +35,8 @@ class Service extends PayAbstract
35 public function getPayRequestPars(Reqparams $params) 35 public function getPayRequestPars(Reqparams $params)
36 { 36 {
37 $this->log->LogInfo("===开始处理财付通的请求参数==="); 37 $this->log->LogInfo("===开始处理财付通的请求参数===");
38 - $this->log->logInfo("-----请求参数为---");  
39 - $this->log->logInfo(var_export($params, true)); 38 + $this->log->LogInfo("-----请求参数为---");
  39 + $this->log->LogInfo(var_export($params, true));
40 40
41 parent::getPayRequestPars($params); 41 parent::getPayRequestPars($params);
42 $baseUrl = $this->getBaseNoticeUrl($params->isTest); 42 $baseUrl = $this->getBaseNoticeUrl($params->isTest);
@@ -77,8 +77,8 @@ class Service extends PayAbstract @@ -77,8 +77,8 @@ class Service extends PayAbstract
77 public function parseResponse(array $arrResponse) 77 public function parseResponse(array $arrResponse)
78 { 78 {
79 $this->log->LogInfo("===开始处理财付通的回调参数==="); 79 $this->log->LogInfo("===开始处理财付通的回调参数===");
80 - $this->log->logInfo("-----回调参数为---");  
81 - $this->log->logInfo(var_export($arrResponse, true)); 80 + $this->log->LogInfo("-----回调参数为---");
  81 + $this->log->LogInfo(var_export($arrResponse, true));
82 82
83 $rsp = new Rspparams(); 83 $rsp = new Rspparams();
84 if (!$this->checkResponse($arrResponse)) { 84 if (!$this->checkResponse($arrResponse)) {
@@ -24,7 +24,7 @@ function sign(&$params) @@ -24,7 +24,7 @@ function sign(&$params)
24 $log->LogInfo("摘要sha1x16 >" . $params_sha1x16); 24 $log->LogInfo("摘要sha1x16 >" . $params_sha1x16);
25 // 签名证书路径 25 // 签名证书路径
26 $cert_path = dirname(__FILE__) . '/../' . SDK_SIGN_CERT_PATH; 26 $cert_path = dirname(__FILE__) . '/../' . SDK_SIGN_CERT_PATH;
27 - $log->logInfo($cert_path); 27 + $log->LogInfo($cert_path);
28 $private_key = getPrivateKey($cert_path); 28 $private_key = getPrivateKey($cert_path);
29 // 签名 29 // 签名
30 $sign_falg = openssl_sign($params_sha1x16, $signature, $private_key, OPENSSL_ALGO_SHA1); 30 $sign_falg = openssl_sign($params_sha1x16, $signature, $private_key, OPENSSL_ALGO_SHA1);
@@ -35,8 +35,8 @@ class Service extends PayAbstract @@ -35,8 +35,8 @@ class Service extends PayAbstract
35 */ 35 */
36 public function parseResponse(array $package) 36 public function parseResponse(array $package)
37 { 37 {
38 - $this->log->logInfo("===开始解析银联支付的回调参数===");  
39 - $this->log->logInfo("===回调参数为==="); 38 + $this->log->LogInfo("===开始解析银联支付的回调参数===");
  39 + $this->log->LogInfo("===回调参数为===");
40 $this->log->LogInfo(var_export($package, true)); 40 $this->log->LogInfo(var_export($package, true));
41 41
42 $verify = false; 42 $verify = false;
@@ -69,7 +69,7 @@ class Service extends PayAbstract @@ -69,7 +69,7 @@ class Service extends PayAbstract
69 $responseData->payResult = -1; 69 $responseData->payResult = -1;
70 } 70 }
71 71
72 - $this->log->logInfo("===银联支付的回调参数处理结果为==="); 72 + $this->log->LogInfo("===银联支付的回调参数处理结果为===");
73 $this->log->LogInfo(var_export($responseData, true)); 73 $this->log->LogInfo(var_export($responseData, true));
74 74
75 return $responseData; 75 return $responseData;
@@ -54,8 +54,8 @@ class Service extends PayAbstract @@ -54,8 +54,8 @@ class Service extends PayAbstract
54 public function pay(array $orderInfo) 54 public function pay(array $orderInfo)
55 { 55 {
56 $this->log->LogInfo("===开始处理微信扫码支付的请求参数==="); 56 $this->log->LogInfo("===开始处理微信扫码支付的请求参数===");
57 - $this->log->logInfo("-----请求参数为---");  
58 - $this->log->logInfo(var_export($orderInfo, true)); 57 + $this->log->LogInfo("-----请求参数为---");
  58 + $this->log->LogInfo(var_export($orderInfo, true));
59 59
60 //生成签名 60 //生成签名
61 $this->orderCode = $orderInfo['order_code']; 61 $this->orderCode = $orderInfo['order_code'];
@@ -85,8 +85,8 @@ class Service extends PayAbstract @@ -85,8 +85,8 @@ class Service extends PayAbstract
85 ); 85 );
86 86
87 $this->log->LogInfo("===开始处理微信扫码支付的支付地址==="); 87 $this->log->LogInfo("===开始处理微信扫码支付的支付地址===");
88 - $this->log->logInfo("-----支付地址数据为---");  
89 - $this->log->logInfo(var_export($payUrlInfo, true)); 88 + $this->log->LogInfo("-----支付地址数据为---");
  89 + $this->log->LogInfo(var_export($payUrlInfo, true));
90 90
91 $payUrl = $payUrlInfo['pay_url'] . '?' . $payUrlInfo['pars']; 91 $payUrl = $payUrlInfo['pay_url'] . '?' . $payUrlInfo['pars'];
92 92
@@ -107,8 +107,8 @@ class Service extends PayAbstract @@ -107,8 +107,8 @@ class Service extends PayAbstract
107 $input->SetOut_trade_no($tradeNo); 107 $input->SetOut_trade_no($tradeNo);
108 $result = WxPayApi::orderQuery($input); 108 $result = WxPayApi::orderQuery($input);
109 109
110 - $this->log->logInfo("===查询微信扫码支付的结果结束,结果为===");  
111 - $this->log->logInfo(var_export($result, true)); 110 + $this->log->LogInfo("===查询微信扫码支付的结果结束,结果为===");
  111 + $this->log->LogInfo(var_export($result, true));
112 112
113 $rsp = new Rspparams(); 113 $rsp = new Rspparams();
114 // 支付成功 114 // 支付成功
@@ -124,10 +124,13 @@ class Service extends PayAbstract @@ -124,10 +124,13 @@ class Service extends PayAbstract
124 $rsp->tradeNo = $result["out_trade_no"]; 124 $rsp->tradeNo = $result["out_trade_no"];
125 $rsp->bankBillNo = $result['bank_type']; 125 $rsp->bankBillNo = $result['bank_type'];
126 } else { 126 } else {
127 - $this->log->logInfo("===微信扫码支付失败==="); 127 + $this->log->LogInfo("===微信扫码支付失败===");
128 $rsp->payResult = -1; 128 $rsp->payResult = -1;
129 } 129 }
130 130
  131 + $this->log->LogInfo("===微信扫码支付回调参数解析结果为===");
  132 + $this->log->LogInfo(var_export($rsp, true));
  133 +
131 return $rsp; 134 return $rsp;
132 } 135 }
133 136
@@ -5,12 +5,19 @@ use Shopping\PayModel; @@ -5,12 +5,19 @@ 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;
8 9
9 /** 10 /**
10 * 支付Notice 11 * 支付Notice
11 */ 12 */
12 class NoticeController extends WebAction 13 class NoticeController extends WebAction
13 { 14 {
  15 +
  16 + // 日志等级,2表示记录信息等级的日志
  17 + const LOG_LEVEL = 2;
  18 + // 向回调通知有关调用日志
  19 + const ORDER_STATUS_LOG = '/Data/logs/pc_pay/order_status';
  20 +
14 /** 21 /**
15 * 支付宝后台服务器返回,主要是用于补单 22 * 支付宝后台服务器返回,主要是用于补单
16 */ 23 */
@@ -352,9 +359,17 @@ class NoticeController extends WebAction @@ -352,9 +359,17 @@ class NoticeController extends WebAction
352 */ 359 */
353 private function payResultProc($payResult, $payment) 360 private function payResultProc($payResult, $payment)
354 { 361 {
  362 + // 初始化日志
  363 + $log = new PhpLog(self::ORDER_STATUS_LOG, 'PRC', self::LOG_LEVEL);
  364 + $log->LogInfo('================开始验证登录状态============');
  365 + $log->LogInfo('================支付结果数据为============');
  366 + $log->LogInfo(var_export($payResult, true));
  367 +
355 //判断是否登录 368 //判断是否登录
356 $uid = $this->auditJumpLogin(); 369 $uid = $this->auditJumpLogin();
357 370
  371 + $log->LogInfo('================已登录,获取到用户ID============');
  372 +
358 $result = array( 373 $result = array(
359 'code' => 500, 374 'code' => 500,
360 'message' => '支付失败' 375 'message' => '支付失败'
@@ -365,6 +380,9 @@ class NoticeController extends WebAction @@ -365,6 +380,9 @@ class NoticeController extends WebAction
365 $result = PayModel::procOrderData($uid, $payResult, $payment); 380 $result = PayModel::procOrderData($uid, $payResult, $payment);
366 } 381 }
367 382
  383 + $log->LogInfo('================支付结果为============');
  384 + $log->LogInfo(var_export($result, true));
  385 +
368 return $result; 386 return $result;
369 } 387 }
370 } 388 }