作者 Cool
1 个管道 的构建 通过 耗费 0 秒

退款回调调试

@@ -10,6 +10,7 @@ use EasyWeChat\Foundation\Application as WXPAY_APP; @@ -10,6 +10,7 @@ use EasyWeChat\Foundation\Application as WXPAY_APP;
10 use EasyWeChat\Foundation\Application; 10 use EasyWeChat\Foundation\Application;
11 use think\Db; 11 use think\Db;
12 use think\Lang; 12 use think\Lang;
  13 +use think\Log;
13 14
14 /** 15 /**
15 * Ajax异步请求接口 16 * Ajax异步请求接口
@@ -273,7 +274,7 @@ class Ajax extends Frontend @@ -273,7 +274,7 @@ class Ajax extends Frontend
273 public function refund_notify() { 274 public function refund_notify() {
274 $app = new Application(ConfigService::load()); 275 $app = new Application(ConfigService::load());
275 $response = $app->payment->handleRefundNotify(function ($message, $reqInfo) { 276 $response = $app->payment->handleRefundNotify(function ($message, $reqInfo) {
276 -// Log::write(date('Y-m-d H:i') . '订单退款操作,返回数据:' . json_encode($message, JSON_UNESCAPED_UNICODE), 'order_refund'); 277 + Log::write(date('Y-m-d H:i') . '订单退款操作,返回数据:' . json_encode($message, JSON_UNESCAPED_UNICODE), 'order_refund');
277 // 其中 $message['req_info'] 获取到的是加密解密信息 278 // 其中 $message['req_info'] 获取到的是加密解密信息
278 // $reqInfo 成功时为1 279 // $reqInfo 成功时为1
279 // 你的业务逻辑... 280 // 你的业务逻辑...
@@ -284,7 +285,7 @@ class Ajax extends Frontend @@ -284,7 +285,7 @@ class Ajax extends Frontend
284 'out_refund_no' => $message['req_info']['out_refund_no'] 285 'out_refund_no' => $message['req_info']['out_refund_no']
285 ]; 286 ];
286 $refund = Db::name('Refund')->where($refund_where)->find(); 287 $refund = Db::name('Refund')->where($refund_where)->find();
287 -// Log::write(date('Y-m-d H:i') . '订单退款操作1,返回数据:' . json_encode($refund, JSON_UNESCAPED_UNICODE), 'order_refund'); 288 + Log::write(date('Y-m-d H:i') . '订单退款操作1,返回数据:' . json_encode($refund, JSON_UNESCAPED_UNICODE), 'order_refund');
288 if($refund['status'] == 1) { 289 if($refund['status'] == 1) {
289 return true; 290 return true;
290 } else { 291 } else {
@@ -302,7 +303,7 @@ class Ajax extends Frontend @@ -302,7 +303,7 @@ class Ajax extends Frontend
302 if($message['req_info']['refund_status'] == 'SUCCESS') { 303 if($message['req_info']['refund_status'] == 'SUCCESS') {
303 $update['status'] = 1; 304 $update['status'] = 1;
304 $update['success_time'] = strtotime($message['req_info']['success_time']); 305 $update['success_time'] = strtotime($message['req_info']['success_time']);
305 -//// Log::write(date('Y-m-d H:i') . '订单退款操作2,返回数据:' . json_encode($update, JSON_UNESCAPED_UNICODE), 'order_refund'); 306 + Log::write(date('Y-m-d H:i') . '订单退款操作2,返回数据:' . json_encode($update, JSON_UNESCAPED_UNICODE), 'order_refund');
306 // if($refund['type'] == 1) { 307 // if($refund['type'] == 1) {
307 // // 修改订单状态为已退款 308 // // 修改订单状态为已退款
308 // $ask_order_update = [ 309 // $ask_order_update = [
@@ -324,14 +325,14 @@ class Ajax extends Frontend @@ -324,14 +325,14 @@ class Ajax extends Frontend
324 } elseif($message['req_info']['refund_status'] == 'REFUNDCLOSE') { 325 } elseif($message['req_info']['refund_status'] == 'REFUNDCLOSE') {
325 $update['status'] = 3; 326 $update['status'] = 3;
326 } 327 }
327 -// Log::write(date('Y-m-d H:i') . '订单退款操作3,返回数据:' . json_encode($refund_where, JSON_UNESCAPED_UNICODE), 'order_refund'); 328 + Log::write(date('Y-m-d H:i') . '订单退款操作3,返回数据:' . json_encode($refund_where, JSON_UNESCAPED_UNICODE), 'order_refund');
328 $result = Db::name('Refund')->where($refund_where)->update($update); 329 $result = Db::name('Refund')->where($refund_where)->update($update);
329 if(!$result || !$ask_order_result) { 330 if(!$result || !$ask_order_result) {
330 -// Log::write(date('Y-m-d H:i') . '订单退款操作5,返回数据:' . json_encode([$result,$ask_order_result], JSON_UNESCAPED_UNICODE), 'order_refund'); 331 + Log::write(date('Y-m-d H:i') . '订单退款操作5,返回数据:' . json_encode([$result,$ask_order_result], JSON_UNESCAPED_UNICODE), 'order_refund');
331 Db::rollback(); 332 Db::rollback();
332 return false; 333 return false;
333 } 334 }
334 -// Log::write(date('Y-m-d H:i') . '订单退款操作4,返回数据:' . json_encode([$result], JSON_UNESCAPED_UNICODE), 'order_refund'); 335 + Log::write(date('Y-m-d H:i') . '订单退款操作4,返回数据:' . json_encode([$result], JSON_UNESCAPED_UNICODE), 'order_refund');
335 Db::commit(); 336 Db::commit();
336 } 337 }
337 } 338 }