|
@@ -3,6 +3,7 @@
|
|
namespace app\api\controller;
|
|
namespace app\api\controller;
|
|
|
|
|
|
use app\common\controller\Api;
|
|
use app\common\controller\Api;
|
|
|
|
+use app\common\service\PreOrderService;
|
|
use app\common\service\UserService;
|
|
use app\common\service\UserService;
|
|
use think\Db;
|
|
use think\Db;
|
|
use think\Exception;
|
|
use think\Exception;
|
|
@@ -70,6 +71,8 @@ class PreOrder extends Api
|
|
$id = $this->request->param('id',0);
|
|
$id = $this->request->param('id',0);
|
|
$carId = $this->request->param('car_id',0);
|
|
$carId = $this->request->param('car_id',0);
|
|
$preTime = $this->request->param('pre_time','');
|
|
$preTime = $this->request->param('pre_time','');
|
|
|
|
+ $name = $this->request->param('name', '');
|
|
|
|
+ $mobile = $this->request->param('mobile', '');
|
|
$userId = $this->auth->id;
|
|
$userId = $this->auth->id;
|
|
$companyId = $this->auth->company_id;
|
|
$companyId = $this->auth->company_id;
|
|
$scene = !empty($id) ? 'edit' : 'add';
|
|
$scene = !empty($id) ? 'edit' : 'add';
|
|
@@ -86,13 +89,14 @@ class PreOrder extends Api
|
|
throw new Exception('未找到车辆信息');
|
|
throw new Exception('未找到车辆信息');
|
|
}
|
|
}
|
|
$time = time();
|
|
$time = time();
|
|
|
|
+ $carNo = isset($userCar['car_number']) ? $userCar['car_number'] : '';
|
|
$data = [
|
|
$data = [
|
|
- 'name' => $this->request->param('name', ''),
|
|
|
|
- 'mobile' => $this->request->param('mobile', ''),
|
|
|
|
- 'address' => $this->request->param('address', ''),
|
|
|
|
|
|
+ 'name' => $name,
|
|
|
|
+ 'mobile' => $mobile,
|
|
|
|
+ 'address' => $this->request->param('address', ''),
|
|
'remark' => $this->request->param('remark', ''),
|
|
'remark' => $this->request->param('remark', ''),
|
|
'car_id' => $carId,
|
|
'car_id' => $carId,
|
|
- 'car_number' => isset($userCar['car_number']) ? $userCar['car_number'] : '',
|
|
|
|
|
|
+ 'car_number' => $carNo,
|
|
'servicetype_id' => $this->request->param('servicetype_id', 0),
|
|
'servicetype_id' => $this->request->param('servicetype_id', 0),
|
|
'pre_time' => $preTime,
|
|
'pre_time' => $preTime,
|
|
];
|
|
];
|
|
@@ -108,12 +112,21 @@ class PreOrder extends Api
|
|
$userParams = [
|
|
$userParams = [
|
|
'user_id' => $userId,
|
|
'user_id' => $userId,
|
|
'company_id' => $companyId,
|
|
'company_id' => $companyId,
|
|
- 'comefrom' => '',//来源
|
|
|
|
|
|
+ 'comefrom' => '平台引流',//来源
|
|
];
|
|
];
|
|
$userBindRes = $userService->userWallet($userParams);
|
|
$userBindRes = $userService->userWallet($userParams);
|
|
if (!$userBindRes['status']) {
|
|
if (!$userBindRes['status']) {
|
|
throw new Exception($userBindRes['msg']);
|
|
throw new Exception($userBindRes['msg']);
|
|
}
|
|
}
|
|
|
|
+ //用户预约发送短信通知
|
|
|
|
+ $service = new PreOrderService();
|
|
|
|
+ $params = [
|
|
|
|
+ 'company_id' => $companyId,//门店ID
|
|
|
|
+ 'name' => $name,//联系人
|
|
|
|
+ 'mobile' => $mobile,//手机号
|
|
|
|
+ 'pre_time' => $preTime,//预约时间
|
|
|
|
+ ];
|
|
|
|
+ $service->preOrderToUser($params);
|
|
} else {
|
|
} else {
|
|
$data['updatetime'] = $time;
|
|
$data['updatetime'] = $time;
|
|
$where['id'] = $id;
|
|
$where['id'] = $id;
|