WIN-2308041133\Administrator před 8 měsíci
rodič
revize
dc024c2cda

+ 11 - 0
application/api/controller/Lave.php

@@ -423,6 +423,17 @@ class Lave extends Api
         );
         $this->success('获取成功', WechatService::querySignOrder($where['order_id']));
     }
+    public function querycontract(Request $request)
+    {
+        $where = UtilService::getMore(
+            [
+                ['contract_id', 0],
+                ['cid', 0],
+            ], $request
+        );
+        $mch_id = Company::where('id', $where['cid'])->value('pay_weixin_mchid');
+        $this->success('获取成功', WechatService::querycontract($mch_id,$where['contract_id'],'','',$where['cid']));
+    }
 }
 
 ?>

+ 1 - 0
application/route.php

@@ -90,6 +90,7 @@ Route::group('api', function () {
         Route::get('query_sign', 'api/lave/querySign');  //查询签约
         Route::get('query_sign_order', 'api/lave/query_sign_order');  //查询签约订单
         Route::get('cs_query_sign', 'api/lave/csquerySign');  //测试查询签约
+        Route::get('querycontract', 'api/lave/querycontract');  //查询签约合同
         Route::get('plan_lst', 'api/lave/plan_lst');  //模版列表
         Route::get('plan_info', 'api/lave/plan_read');  //模版列表
         Route::get('user_lst', 'api/lave/user_plan_lst');  //用户签约模版列表

+ 18 - 0
extend/liuniu/WechatService.php

@@ -636,6 +636,24 @@ class WechatService
             $order_id
         );
         @file_put_contents("quanju.txt", json_encode($result) . "-查询签约状态返回结果\r\n", 8);
+        if ($result['return_code'] == 'SUCCESS' && $result['trade_state_desc'] == '支付成功'){
+            LaveMonth::where(['order_id' => $order_id])->update(['status' => 1]);  //修改订单状态
+        }
+        return $result;
+    }
+    /**
+     * 查询签约关系
+     */
+    public static function querycontract($mch_id,$contract_id,$version='1.0',$options=[],$cid=0)
+    {
+        $appid='wx5681205d1ef4d9d3';
+        $order = array_merge(compact('appid','mch_id','contract_id','version'), $options);
+//        if ($order['detail'] == '') unset($order['detail']);
+//        $order['notify_url']=Request::instance()->domain() . "/api/wechat/notify/" . $cid;
+        $result = self::payment(false, $cid)->contract->querycontract(
+            $order
+        );
+//        @file_put_contents("quanju.txt", json_encode($result) . "-查询签约状态返回结果\r\n", 8);
         return $result;
     }
 }

+ 15 - 0
vendor/overtrue/wechat/src/Payment/Contract/Client.php

@@ -99,4 +99,19 @@ class Client extends BaseClient
 
         return $this->safeRequest('papay/deletecontract', $params);
     }
+    /**
+     * querycontract papay.
+     *
+     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
+     *
+     * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException
+     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
+     * @throws \GuzzleHttp\Exception\GuzzleException
+     */
+    public function querycontract(array $params)
+    {
+        $params['appid'] = $this->app['config']->app_id;
+
+        return $this->safeRequest('papay/querycontract', $params);
+    }
 }