|
@@ -7,6 +7,7 @@ use app\admin\model\WechatPlan;
|
|
|
use app\admin\model\WechatPlanRecord;
|
|
use app\admin\model\WechatPlanRecord;
|
|
|
use app\common\controller\Api;
|
|
use app\common\controller\Api;
|
|
|
use app\common\model\{Category, Lave as LaveModel, User};
|
|
use app\common\model\{Category, Lave as LaveModel, User};
|
|
|
|
|
+use app\common\model\LaveMonth as LaveMonthModel;
|
|
|
use liuniu\repositories\LaveRepository;
|
|
use liuniu\repositories\LaveRepository;
|
|
|
use liuniu\UtilService;
|
|
use liuniu\UtilService;
|
|
|
use liuniu\WechatService;
|
|
use liuniu\WechatService;
|
|
@@ -154,7 +155,7 @@ class Lave extends Api
|
|
|
['user_id', $this->auth->getUserinfo()['id']],
|
|
['user_id', $this->auth->getUserinfo()['id']],
|
|
|
// ['user_id', 0],
|
|
// ['user_id', 0],
|
|
|
['order_name', ''],
|
|
['order_name', ''],
|
|
|
- ['category_id', 0],
|
|
|
|
|
|
|
+// ['category_id', 0],
|
|
|
['amount', 0],
|
|
['amount', 0],
|
|
|
['name', ''],
|
|
['name', ''],
|
|
|
['contact', ''],
|
|
['contact', ''],
|
|
@@ -171,7 +172,7 @@ class Lave extends Api
|
|
|
);
|
|
);
|
|
|
$where1 = $where;
|
|
$where1 = $where;
|
|
|
unset($where1['from']);
|
|
unset($where1['from']);
|
|
|
- $where1['order_id'] = LaveModel::getNewOrderId();
|
|
|
|
|
|
|
+ $where1['order_id'] = LaveMonthModel::getNewOrderId();
|
|
|
$contract_display_account = User::where('id', $where1['user_id'])->value('nickname');
|
|
$contract_display_account = User::where('id', $where1['user_id'])->value('nickname');
|
|
|
if (empty($contract_display_account)){
|
|
if (empty($contract_display_account)){
|
|
|
$this->error('用户不存在!');
|
|
$this->error('用户不存在!');
|
|
@@ -180,17 +181,17 @@ class Lave extends Api
|
|
|
if (cache('lave_' . $where['user_id'])) $this->error('正在处理中');
|
|
if (cache('lave_' . $where['user_id'])) $this->error('正在处理中');
|
|
|
@file_put_contents("lave.txt", json_encode($where1));
|
|
@file_put_contents("lave.txt", json_encode($where1));
|
|
|
$plan_id=$where1['plan_id'];
|
|
$plan_id=$where1['plan_id'];
|
|
|
- unset($where1['plan_id']);
|
|
|
|
|
- $order = LaveModel::create($where1);
|
|
|
|
|
|
|
+// unset($where1['plan_id']);
|
|
|
|
|
+ $order = LaveMonthModel::create($where1);
|
|
|
$where1['contract_code'] = WechatPlanRecord::getNewCode();
|
|
$where1['contract_code'] = WechatPlanRecord::getNewCode();
|
|
|
$where1['contract_display_account']=$contract_display_account;
|
|
$where1['contract_display_account']=$contract_display_account;
|
|
|
cache('lave_' . $where['user_id'], '1', 10);
|
|
cache('lave_' . $where['user_id'], '1', 10);
|
|
|
- if (!$order) $this->error(LaveModel::getErrorInfo());
|
|
|
|
|
|
|
+ if (!$order) $this->error(LaveMonthModel::getErrorInfo());
|
|
|
$orderId = $order['order_id'];
|
|
$orderId = $order['order_id'];
|
|
|
$info = compact('orderId');
|
|
$info = compact('orderId');
|
|
|
$order['plan_id'] = $plan_id;
|
|
$order['plan_id'] = $plan_id;
|
|
|
if ($orderId) {
|
|
if ($orderId) {
|
|
|
- $orderInfo = LaveModel::where('order_id', $orderId)->find();
|
|
|
|
|
|
|
+ $orderInfo = LaveMonthModel::where('order_id', $orderId)->find();
|
|
|
if (!$orderInfo || !isset($orderInfo['paid'])) $this->error('支付订单不存在!');
|
|
if (!$orderInfo || !isset($orderInfo['paid'])) $this->error('支付订单不存在!');
|
|
|
if ($orderInfo['paid']) $this->error('支付已支付!');
|
|
if ($orderInfo['paid']) $this->error('支付已支付!');
|
|
|
// 创建签约
|
|
// 创建签约
|
|
@@ -204,7 +205,7 @@ class Lave extends Api
|
|
|
'contract_display_account'=>$where1['contract_display_account'],
|
|
'contract_display_account'=>$where1['contract_display_account'],
|
|
|
'is_open'=>$where1['is_open'],
|
|
'is_open'=>$where1['is_open'],
|
|
|
'tel'=>$where1['tel'],
|
|
'tel'=>$where1['tel'],
|
|
|
- 'category_id'=>$where1['category_id'],
|
|
|
|
|
|
|
+// 'category_id'=>$where1['category_id'],
|
|
|
'order_name'=>$where1['order_name'],
|
|
'order_name'=>$where1['order_name'],
|
|
|
];
|
|
];
|
|
|
$record=WechatPlanRecord::create($plan_record);
|
|
$record=WechatPlanRecord::create($plan_record);
|
|
@@ -230,7 +231,7 @@ class Lave extends Api
|
|
|
}
|
|
}
|
|
|
return $this->success('订单创建成功', $info);
|
|
return $this->success('订单创建成功', $info);
|
|
|
|
|
|
|
|
- } else $this->error(LaveModel::getErrorInfo());
|
|
|
|
|
|
|
+ } else $this->error(LaveMonthModel::getErrorInfo());
|
|
|
}
|
|
}
|
|
|
/**
|
|
/**
|
|
|
* 签约订单支付
|
|
* 签约订单支付
|
|
@@ -246,7 +247,7 @@ class Lave extends Api
|
|
|
['from', 'weixin']
|
|
['from', 'weixin']
|
|
|
], $request, true);
|
|
], $request, true);
|
|
|
if (!$uni) $this->error('参数错误!');
|
|
if (!$uni) $this->error('参数错误!');
|
|
|
- $order = LaveModel::where('cid', $this->cid)->where('order_id', $uni)->find();
|
|
|
|
|
|
|
+ $order = LaveMonthModel::where('cid', $this->cid)->where('order_id', $uni)->find();
|
|
|
if (!$order)
|
|
if (!$order)
|
|
|
$this->error('订单不存在!');
|
|
$this->error('订单不存在!');
|
|
|
if ($order['paid'])
|
|
if ($order['paid'])
|
|
@@ -286,7 +287,7 @@ class Lave extends Api
|
|
|
$cid=$v['cid'];
|
|
$cid=$v['cid'];
|
|
|
// if ($this->querySign($cid,$v['uid'],$v['plan_id'],$v['contract_code'])){
|
|
// if ($this->querySign($cid,$v['uid'],$v['plan_id'],$v['contract_code'])){
|
|
|
$arr['mch_id'] =Company::where('id', $cid)->value('pay_weixin_mchid');
|
|
$arr['mch_id'] =Company::where('id', $cid)->value('pay_weixin_mchid');
|
|
|
- $arr['out_trade_no']=LaveModel::getNewOrderId();
|
|
|
|
|
|
|
+ $arr['out_trade_no']=LaveMonthModel::getNewOrderId();
|
|
|
$arr['total_fee'] = $v['price'];
|
|
$arr['total_fee'] = $v['price'];
|
|
|
// $arr['trade_type'] = 'PAP';
|
|
// $arr['trade_type'] = 'PAP';
|
|
|
$arr['contract_id'] = Company::where('id', $cid)->value('contract_id');
|
|
$arr['contract_id'] = Company::where('id', $cid)->value('contract_id');
|
|
@@ -305,7 +306,7 @@ class Lave extends Api
|
|
|
$where1['is_ticket']='0';
|
|
$where1['is_ticket']='0';
|
|
|
$where1['type']='0';
|
|
$where1['type']='0';
|
|
|
$where1['help_id']='0';
|
|
$where1['help_id']='0';
|
|
|
- $order = LaveModel::create($where1);
|
|
|
|
|
|
|
+ $order = LaveMonthModel::create($where1);
|
|
|
// }
|
|
// }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|