上传自有车辆图片
This commit is contained in:
parent
ad44ac2844
commit
9250233746
@ -32,6 +32,7 @@ class VehicleValidate extends BaseValidate
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'license' => 'require|unique:vehicle',
|
||||
'pic' => 'require',
|
||||
'gps_imei' => 'require|number|unique:vehicle',
|
||||
'type' => 'require|in:0,1',
|
||||
'status' => 'require|in:0,1,2',
|
||||
@ -45,6 +46,7 @@ class VehicleValidate extends BaseValidate
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'license' => '车辆牌照',
|
||||
'pic' => '车辆图片',
|
||||
'gps_imei' => 'gps定位器设备标志',
|
||||
'type' => '车辆类型:0:平台自营 1:社会车辆',
|
||||
'status' => '车辆状态:0:未出租 1:签约中 2:已出租',
|
||||
@ -59,7 +61,7 @@ class VehicleValidate extends BaseValidate
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['license','gps_imei']);
|
||||
return $this->only(['license','pic','gps_imei']);
|
||||
}
|
||||
|
||||
|
||||
@ -71,7 +73,7 @@ class VehicleValidate extends BaseValidate
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','license','gps_imei','status','type'])->remove('license', 'unique')->remove('gps_imei', 'unique');
|
||||
return $this->only(['id','license','pic','gps_imei','status','type'])->remove('license', 'unique')->remove('gps_imei', 'unique');
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\api\logic\VehicleLogic;
|
||||
use app\common\model\contract\Contract;
|
||||
use app\common\model\vehicle\Vehicle;
|
||||
use app\common\model\vehicle\VehicleRent;
|
||||
use think\facade\Db;
|
||||
@ -56,8 +55,8 @@ class VehicleController extends BaseApiController
|
||||
//添加自有车辆
|
||||
public function addSelfCar() {
|
||||
//获取参数
|
||||
$params = $this->request->post(['license','company_id','company_name','company_user','company_phone']);
|
||||
if(empty($params['license']) || empty($params['company_id']) || empty($params['company_name']) || empty($params['company_user']) || empty($params['company_phone'])){
|
||||
$params = $this->request->post(['license','pic','company_id','company_name','company_user','company_phone']);
|
||||
if(empty($params['license']) || empty($params['pic']) || empty($params['company_id']) || empty($params['company_name']) || empty($params['company_user']) || empty($params['company_phone'])){
|
||||
return $this->fail('缺少必要参数');
|
||||
}
|
||||
Db::startTrans();
|
||||
@ -70,6 +69,7 @@ class VehicleController extends BaseApiController
|
||||
//写入数据
|
||||
$vehicle = Vehicle::create([
|
||||
'license' => $params['license'],
|
||||
'pic' => $params['pic'],
|
||||
'gps_imei' => '',
|
||||
'type' => 1,
|
||||
'status' => 2,
|
||||
|
Loading…
x
Reference in New Issue
Block a user