|
@@ -185,6 +185,59 @@ class Wechat extends Api
|
|
|
@file_put_contents("error.txt", $e->getFile() . '-', $e->getLine(), '-' . $e->getMessage());
|
|
|
}
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 解约扣款服务
|
|
|
+ * @param Request $request
|
|
|
+ * @return mixed
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
+ * @throws \think\exception\DbException
|
|
|
+ */
|
|
|
+ public function delete_signing(Request $request)
|
|
|
+ {
|
|
|
+ $record_id = intval($request->param('id'));
|
|
|
+ $uid = intval($request->param('uid'));
|
|
|
+ try {
|
|
|
+// $notify_url=Request::instance()->domain() . "/api/wechat/notify/" . $cid; //回调接口
|
|
|
+ $app_id = 'wx5681205d1ef4d9d3';
|
|
|
+ $mch_id = '1623907696';
|
|
|
+ $contract_code = WechatPlanRecord::where('id', $record_id)->value('contract_code');
|
|
|
+ $plan_id = WechatPlanRecord::where('id', $record_id)->value('wechat_plan_id');
|
|
|
+ $contract_termination_remark='解约备注';
|
|
|
+ $version = '1.0';
|
|
|
+ $array = array(
|
|
|
+ 'appid' => $app_id,
|
|
|
+ 'mch_id' => $mch_id,
|
|
|
+ 'plan_id' => $plan_id,
|
|
|
+ 'contract_code' => $contract_code,
|
|
|
+ 'contract_termination_remark' => $contract_termination_remark,
|
|
|
+ 'version' => $version
|
|
|
+ );
|
|
|
+
|
|
|
+
|
|
|
+ ksort($array);
|
|
|
+ $xml = '';
|
|
|
+ foreach ($array as $key => $value) {
|
|
|
+ $xml = $xml . $key . '=' . $value . '&';
|
|
|
+ }
|
|
|
+ $xml = substr($xml, 0, -1);
|
|
|
+ @file_put_contents("quanju.txt", json_encode($xml) . "-签约内容\r\n", 8);
|
|
|
+ $sign = $this->md5_sign($xml, '192006250b4c09247ec02edce69f6a2d');
|
|
|
+ @file_put_contents("quanju.txt", $sign . "-签名\r\n", 8);
|
|
|
+ $url = 'https://api.mch.weixin.qq.com/papay/deletecontract?' . $xml . '&sign=' . $sign;
|
|
|
+ @file_put_contents("quanju.txt", $url . "-链接\r\n", 8);
|
|
|
+ var_dump($url);
|
|
|
+// $response = $this->curl_get($url);
|
|
|
+// $url=$this->OfficialAccountSigning($app_id,$mch_id,$plan_id,$contract_code,$request_serial,$contract_display_account,$notify_url,$version,$sign,$timestamp);
|
|
|
+// @file_put_contents("quanju.txt", $response.'返回链接');
|
|
|
+
|
|
|
+ WechatPlanRecord::where('id', $record_id)->update(['is_signing' => 1]);
|
|
|
+ die();
|
|
|
+ return 1;
|
|
|
+ } catch (Exception $e) {
|
|
|
+ @file_put_contents("error.txt", $e->getFile() . '-', $e->getLine(), '-' . $e->getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
public function generateRandomString($length)
|
|
|
{
|
|
@@ -312,14 +365,12 @@ class Wechat extends Api
|
|
|
|
|
|
public function signing_plan()
|
|
|
{
|
|
|
-// if ($this->cid<=0){
|
|
|
-// $a=WechatPlan::where('cid', 12)->select();
|
|
|
-// }else{
|
|
|
-// $a=WechatPlan::where('cid', $this->cid)->select();
|
|
|
-// }
|
|
|
-//
|
|
|
-// var_dump($a);die();
|
|
|
$this->success('获取成功', WechatPlan::where('cid', 12)->select());
|
|
|
}
|
|
|
-
|
|
|
+// 用户签约列表
|
|
|
+ public function user_signing(Request $request)
|
|
|
+ {
|
|
|
+ $uid = intval($request->param('uid'));
|
|
|
+ $this->success('获取成功', WechatPlanRecord::where('uid', $uid)->where('is_signing', 0)->select());
|
|
|
+ }
|
|
|
}
|