WIN-2308041133\Administrator 1 year ago
parent
commit
216a5b84ac
1 changed files with 13 additions and 1 deletions
  1. 13 1
      extend/liuniu/WechatService.php

+ 13 - 1
extend/liuniu/WechatService.php

@@ -342,7 +342,6 @@ class WechatService
     public static function handleNotify($cid)
     {
         $response = self::payment(true, $cid)->handlePaidNotify(function ($notify, $successful) use ($cid) {
-            @file_put_contents("quanju.txt", json_encode($notify)."-签约成功内容\r\n", 8);
             if ($successful && isset($notify['out_trade_no'])) {
                 if (isset($notify['attach']) && $notify['attach']) {
                     if (($count = strpos($notify['out_trade_no'], '_')) !== false) {
@@ -355,6 +354,19 @@ class WechatService
                 $wechatContext = WechatContext::create($data, true);
                 return true;
             }
+            @file_put_contents("quanju.txt", json_encode($notify)."-签约成功内容\r\n", 8);
+            if ($successful && isset($notify['plan_id'])) {
+//                if (isset($notify['attach']) && $notify['attach']) {
+//                    if (($count = strpos($notify['out_trade_no'], '_')) !== false) {
+//                        $notify['out_trade_no'] = substr($notify['out_trade_no'], $count + 1);
+//                    }
+//                    $params = [$cid, $notify['out_trade_no']];
+//                    Hook::exec("\\liuniu\\repositories\\PaymentRepositories", "wechat" . ucfirst($notify['attach']), $params);
+//                }
+//                $data = ['eventkey' => 'notify', 'command' => '', 'refreshtime' => time(), 'openid' => $notify['openid'], 'message' => json_encode($notify)];
+//                $wechatContext = WechatContext::create($data, true);
+                return true;
+            }
         });
         $response->send();
     }