WIN-2308041133\Administrator 6 hónapja
szülő
commit
0a80431e12

+ 15 - 9
extend/liuniu/WechatService.php

@@ -3,6 +3,7 @@
 namespace liuniu;
 
 use app\admin\model\Company;
+use app\admin\model\WechatPlanRecord;
 use app\common\model\WechatContext;
 use EasyWeChat\Factory;
 use EasyWeChat\Kernel\Messages\Article;
@@ -356,15 +357,20 @@ class WechatService
             }
             @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);
+                if (isset($notify['change_type']) && $notify['change_type']) {
+                    if (($count = strpos($notify['contract_code'], '_')) !== false) {
+                        $notify['contract_code'] = substr($notify['contract_code'], $count + 1);
+                    }
+                    $params = [$cid, $notify['contract_code']];
+                    Hook::exec("\\liuniu\\repositories\\PaymentRepositories", "wechat" . ucfirst('lavesign'), $params);
+                    if ($notify['change_type']=='ADD'){
+                        WechatPlanRecord::where('contract_code',$notify['contract_code'])->where('cid',$cid)->Update(['contract_id' => $notify['contract_id']]);
+                    }elseif ($notify['change_type']=='DELETE'){
+                        WechatPlanRecord::where('contract_code',$notify['contract_code'])->where('cid',$cid)->Update(['is_signing' => 1]);
+                    }
+                }
+                $data = ['eventkey' => 'notify', 'command' => '', 'refreshtime' => time(), 'openid' => $notify['openid'], 'message' => json_encode($notify)];
+                $wechatContext = WechatContext::create($data, true);
                 return true;
             }
         });

+ 1 - 1
vendor/overtrue/wechat/src/Payment/Order/Client.php

@@ -47,7 +47,7 @@ class Client extends BaseClient
             $params['contract_mchid'] = $this->app['config']['mch_id'];
             $params['request_serial'] = $params['request_serial'] ?? time();
             $params['contract_notify_url'] = $params['contract_notify_url'] ?? $this->app['config']['contract_notify_url'];
-            @file_put_contents("quanju.txt", json_encode($params) . "-传参\r\n", 8);
+//            @file_put_contents("quanju.txt", json_encode($params) . "-传参\r\n", 8);
             return $this->request($this->wrap('pay/contractorder'), $params);
         }