|
@@ -66,6 +66,7 @@ class PreOrder extends Api
|
|
|
$carId = $this->request->param('car_id',0);
|
|
|
$preTime = $this->request->param('pre_time','');
|
|
|
$userId = $this->auth->id;
|
|
|
+ $companyId = $this->auth->company_id;
|
|
|
$scene = !empty($id) ? 'edit' : 'add';
|
|
|
$validate = validate('PreOrder');
|
|
|
if(!$validate->check($this->request->param(),[],$scene)){
|
|
@@ -81,7 +82,7 @@ class PreOrder extends Api
|
|
|
}
|
|
|
$time = time();
|
|
|
$data = [
|
|
|
- 'company_id' => $this->request->param('company_id', 0),
|
|
|
+ 'company_id' => $companyId,
|
|
|
'name' => $this->request->param('name', ''),
|
|
|
'mobile' => $this->request->param('mobile', ''),
|
|
|
'address' => $this->request->param('address', ''),
|
|
@@ -96,6 +97,7 @@ class PreOrder extends Api
|
|
|
$data['user_id'] = $userId;
|
|
|
$data['createtime'] = $time;
|
|
|
$res = $this->model->insertGetId($data);
|
|
|
+ $id = $res;
|
|
|
} else {
|
|
|
$data['updatetime'] = $time;
|
|
|
$where['id'] = $id;
|
|
@@ -106,6 +108,7 @@ class PreOrder extends Api
|
|
|
throw new Exception('操作失败');
|
|
|
}
|
|
|
$result = [
|
|
|
+ 'pre_order_id' => $id,
|
|
|
'template_ids' => config('param.wechat_template_ids'),//微信消息模版ID
|
|
|
];
|
|
|
$this->success('操作成功',$result);
|