|
|
@@ -291,56 +291,31 @@ class Lave extends Api
|
|
|
$where1['help_id']='0';
|
|
|
$order = LaveModel::create($where1);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+ }
|
|
|
+// 解除签约
|
|
|
+ public function deleteSign(Request $request){
|
|
|
+ var_dump(123);die();
|
|
|
$where = UtilService::postMore(
|
|
|
[
|
|
|
['cid', $this->cid],
|
|
|
['user_id', $this->auth->getUserinfo()['id']],
|
|
|
- ['order_name', 'order_name'],
|
|
|
- ['category_id', 0],
|
|
|
- ['amount', 0],
|
|
|
- ['name', ''],
|
|
|
- ['contact', ''],
|
|
|
- ['tel', 0],
|
|
|
- ['address', ''],
|
|
|
- ['is_open', '0'],
|
|
|
- ['is_ticket', '0'],
|
|
|
- ['type', '0'],
|
|
|
- ['help_id', 0],
|
|
|
], $request
|
|
|
);
|
|
|
- $where1 = $where;
|
|
|
- unset($where1['from']);
|
|
|
- $where1['order_id'] = LaveModel::getNewOrderId();
|
|
|
- if (cache('lave_' . $where['user_id'])) $this->error('正在处理中');
|
|
|
- @file_put_contents("lave.txt", json_encode($where1));
|
|
|
- $order = LaveModel::create($where1);
|
|
|
- cache('lave_' . $where['user_id'], '1', 10);
|
|
|
- if (!$order) $this->error(LaveModel::getErrorInfo());
|
|
|
- $orderId = $order['order_id'];
|
|
|
- $info = compact('orderId');
|
|
|
- $order['plan_id'] = WechatPlan::where('price', $where['amount'])->value('plan_id');
|
|
|
- if ($orderId) {
|
|
|
- $orderInfo = LaveModel::where('order_id', $orderId)->find();
|
|
|
- if (!$orderInfo || !isset($orderInfo['paid'])) $this->error('支付订单不存在!');
|
|
|
- if ($orderInfo['paid']) $this->error('支付已支付!');
|
|
|
- try {
|
|
|
- if ($where['from'] == 'routine') {
|
|
|
- $jsConfig = LaveRepository::jsPaySign($this->cid, $orderId); //创建订单jspay
|
|
|
- } else if ($where['from'] == 'weixinh5') {
|
|
|
- $jsConfig = LaveRepository::h5PaySign($this->cid, $orderId);
|
|
|
- } else {
|
|
|
- $jsConfig = LaveRepository::wxPaySign($this->cid, $orderId);
|
|
|
- }
|
|
|
- } catch (\Exception $e) {
|
|
|
- return $this->error($e->getMessage());
|
|
|
- }
|
|
|
- $info['jsConfig'] = $jsConfig;
|
|
|
-
|
|
|
- return $this->success('订单创建成功', $info);
|
|
|
-
|
|
|
- } else $this->error(LaveModel::getErrorInfo());
|
|
|
+ $sign_info=WechatPlanRecord::where('cid', $where['cid'])->where('uid', $where['user_id'])->where('is_signing',1)->find();
|
|
|
+ if (!$sign_info){
|
|
|
+ $this->error('未找到签约信息!');
|
|
|
+ }
|
|
|
+ $mch_id =Company::where('id', $where['cid'])->value('mch_id');
|
|
|
+ $plan_id=$sign_info['plan_id'];
|
|
|
+ $contract_code=$sign_info['contract_code'];
|
|
|
+// $mch_id,$contract_code,$pan_id,$version='1.0',$options=[],$cid=0)
|
|
|
+ $rs=WechatService::deleteSign($mch_id,$contract_code,$plan_id,'1.0',[],$where['cid']);
|
|
|
+ if ($rs){
|
|
|
+ WechatPlanRecord::where('cid', $where['cid'])->where('uid', $where['user_id'])->where('is_signing',0)->update(['is_signing'=>1]);
|
|
|
+ $this->success('解除签约成功!');
|
|
|
+ }else{
|
|
|
+ $this->error('解除签约失败!');
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|