diff --git a/app/Console/Commands/Test.php b/app/Console/Commands/Test.php index 3841e76..90eb988 100644 --- a/app/Console/Commands/Test.php +++ b/app/Console/Commands/Test.php @@ -39,8 +39,8 @@ class Test extends Command */ public function handle() { - - var_dump($columns = collect(DB::select('show columns from uc_car_brand_t'))->keyBy('Field')->toArray()); + $client = new \Hprose\Socket\Client('tcp://127.0.0.1:1317', false); + var_dump($client->demo()); exit(); } } diff --git a/app/Http/Controllers/Api/CarInfoController.php b/app/Http/Controllers/Api/CarInfoController.php index 75b4d35..cb43713 100644 --- a/app/Http/Controllers/Api/CarInfoController.php +++ b/app/Http/Controllers/Api/CarInfoController.php @@ -8,7 +8,7 @@ use App\Models\CarInfoT; use Illuminate\Http\Request; /** - * @title CarInfoController + * @title 车辆管理 * @description CarInfoController * @package App\Http\Controllers\Api * @author zcstatham @@ -19,8 +19,28 @@ class CarInfoController extends BaseController protected $rules = [ 'store' => [ 'rules' => [ - 'car_no' => 'required', - 'frame_no' => 'required', + 'model_id' => 'numeric', + 'car_no' => 'required|string', + 'frame_no' => 'required|string', + 'engine_no' => 'string', + 'factory_model' => 'string', + 'car_used_type' => 'string', + 'car_man' => 'string', + 'purchase_price' => 'string', + 'register_date' => 'string', + 'seat_count' => 'string', + 'insurance_times' => 'numeric', + 'insurance_serial_times' => 'numeric', + 'repair_times' => 'numeric', + 'insurance_repair_times' => 'numeric', + 'last_insurance_company' => 'string', + 'last_insurance_type' => 'string', + 'last_insurance_rate' => 'numeric', + 'last_insurance_salesman' => 'string', + 'last_insurance_date' => 'string', + 'force_expire_date' => 'string', + 'business_expire_date' => 'string', + 'status' => 'numeric', ] ], 'show' => [ @@ -32,8 +52,28 @@ class CarInfoController extends BaseController 'update' => [ 'rules' => [ 'id' => 'bail|min:1', - 'car_no' => 'required', - 'frame_no' => 'required', + 'model_id' => 'numeric', + 'car_no' => 'required|string', + 'frame_no' => 'required|string', + 'engine_no' => 'string', + 'factory_model' => 'string', + 'car_used_type' => 'string', + 'car_man' => 'string', + 'purchase_price' => 'string', + 'register_date' => 'string', + 'seat_count' => 'string', + 'insurance_times' => 'numeric', + 'insurance_serial_times' => 'numeric', + 'repair_times' => 'numeric', + 'insurance_repair_times' => 'numeric', + 'last_insurance_company' => 'string', + 'last_insurance_type' => 'string', + 'last_insurance_rate' => 'numeric', + 'last_insurance_salesman' => 'string', + 'last_insurance_date' => 'string', + 'force_expire_date' => 'string', + 'business_expire_date' => 'string', + 'status' => 'numeric', ], 'custom' => [ 'exists,App\Models\CarInfoT,id', @@ -56,8 +96,8 @@ class CarInfoController extends BaseController } /** - * @title 基础列表 - * @description 基础列表 + * @title 车辆列表 + * @description 车辆列表 * @return \Illuminate\Http\JsonResponse * @author zcstatham */ @@ -65,7 +105,51 @@ class CarInfoController extends BaseController { $query = $this->model->query(); - if(isset($this->params['name']) && $this->params['name'] != ''){ + if(isset($this->params['model_id']) && $this->params['model_id'] != ''){ + $query->where('model_id', $this->params['model_id']); + } + + if(isset($this->params['car_no']) && $this->params['car_no'] != ''){ + $query->where('car_no', $this->params['car_no']); + } + + if(isset($this->params['frame_no']) && $this->params['frame_no'] != ''){ + $query->where('frame_no', $this->params['frame_no']); + } + + if(isset($this->params['engine_no']) && $this->params['engine_no'] != ''){ + $query->where('engine_no', $this->params['engine_no']); + } + + if(isset($this->params['factory_model']) && $this->params['factory_model'] != ''){ + $query->where('factory_model', $this->params['factory_model']); + } + + if(isset($this->params['car_used_type']) && $this->params['car_used_type'] != ''){ + $query->where('car_used_type', $this->params['car_used_type']); + } + + if(isset($this->params['car_man']) && $this->params['car_man'] != ''){ + $query->where('car_man', $this->params['car_man']); + } + + if(isset($this->params['purchase_price']) && $this->params['purchase_price'] != ''){ + $query->where('purchase_price', $this->params['purchase_price']); + } + + if(isset($this->params['register_date']) && $this->params['register_date'] != ''){ + $query->where('register_date', $this->params['register_date']); + } + + if(isset($this->params['last_insurance_date']) && $this->params['name'] != ''){ + $query->where('name', $this->params['name']); + } + + if(isset($this->params['business_expire_date']) && $this->params['name'] != ''){ + $query->where('name', $this->params['name']); + } + + if(isset($this->params['force_expire_date']) && $this->params['name'] != ''){ $query->where('name', $this->params['name']); } @@ -75,44 +159,45 @@ class CarInfoController extends BaseController } /** - * @title 基础保存 - * @description 基础保存 + * @title 车辆保存 + * @description 车辆保存 * @return \Illuminate\Http\JsonResponse * @author zcstatham */ public function store() { - $this->model->car_no = $this->params['car_no']; - $this->model->frame_no = $this->params['frame_no']; - $this->model->engine_no = $this->params['engine_no']; - $this->model->factory_model = $this->params['factory_model']; - $this->model->car_used_type = $this->params['car_used_type']; - $this->model->car_man = $this->params['car_man']; - $this->model->purchase_price = $this->params['purchase_price']; - $this->model->register_date = $this->params['register_date']; - $this->model->seat_count = $this->params['seat_count']; - $this->model->insurance_times = $this->params['insurance_times']; - $this->model->insurance_serial_times = $this->params['insurance_serial_times']; - $this->model->repair_times = $this->params['repair_times']; - $this->model->insurance_repair_times = $this->params['insurance_repair_times']; - $this->model->last_insurance_company = $this->params['last_insurance_company']; - $this->model->last_insurance_type = $this->params['last_insurance_type']; - $this->model->last_insurance_rate = $this->params['last_insurance_rate']; - $this->model->last_insurance_salesman = $this->params['last_insurance_salesman']; - $this->model->last_insurance_date = $this->params['last_insurance_date']; - $this->model->force_expire_date = $this->params['force_expire_date']; - $this->model->business_expire_date = $this->params['business_expire_date']; - $this->model->status = $this->params['status']; + $this->model->model_id = $this->params['model_id'] ?? 0; + $this->model->car_no = $this->params['car_no'] ?? ''; + $this->model->frame_no = $this->params['frame_no'] ?? ''; + $this->model->engine_no = $this->params['engine_no'] ?? ''; + $this->model->factory_model = $this->params['factory_model'] ?? ''; + $this->model->car_used_type = $this->params['car_used_type'] ?? ''; + $this->model->car_man = $this->params['car_man'] ?? ''; + $this->model->purchase_price = $this->params['purchase_price'] ?? ''; + $this->model->register_date = $this->params['register_date'] ?? ''; + $this->model->seat_count = $this->params['seat_count'] ?? ''; + $this->model->insurance_times = $this->params['insurance_times'] ?? 0; + $this->model->insurance_serial_times = $this->params['insurance_serial_times'] ?? 0; + $this->model->repair_times = $this->params['repair_times'] ?? 0; + $this->model->insurance_repair_times = $this->params['insurance_repair_times'] ?? 0; + $this->model->last_insurance_company = $this->params['last_insurance_company'] ?? ''; + $this->model->last_insurance_type = $this->params['last_insurance_type'] ?? ''; + $this->model->last_insurance_rate = $this->params['last_insurance_rate'] ?? 0; + $this->model->last_insurance_salesman = $this->params['last_insurance_salesman'] ?? ''; + $this->model->last_insurance_date = $this->params['last_insurance_date'] ?? ''; + $this->model->force_expire_date = $this->params['force_expire_date'] ?? ''; + $this->model->business_expire_date = $this->params['business_expire_date'] ?? ''; + $this->model->status = $this->params['status'] ?? 0; if($this->model->save()){ return $this->success(new CarInfo($this->model)); } else { - return $this->error(500, '基础信息保存失败'); + return $this->error(500, '车辆信息保存失败'); } } /** - * @title 基础详情 - * @description 基础详情 + * @title 车辆详情 + * @description 车辆详情 * @param $id * @return mixed * @author zcstatham @@ -123,8 +208,8 @@ class CarInfoController extends BaseController } /** - * @title 基础更新 - * @description 基础更新 + * @title 车辆更新 + * @description 车辆更新 * @param $id * @return \Illuminate\Http\JsonResponse * @author zcstatham @@ -132,47 +217,50 @@ class CarInfoController extends BaseController public function update($id) { $this->model = $this->model->where('id', $id)->first(); - $this->model->car_no = $this->params['car_no']; - $this->model->frame_no = $this->params['frame_no']; - $this->model->engine_no = $this->params['engine_no']; - $this->model->factory_model = $this->params['factory_model']; - $this->model->car_used_type = $this->params['car_used_type']; - $this->model->car_man = $this->params['car_man']; - $this->model->purchase_price = $this->params['purchase_price']; - $this->model->register_date = $this->params['register_date']; - $this->model->seat_count = $this->params['seat_count']; - $this->model->insurance_times = $this->params['insurance_times']; - $this->model->insurance_serial_times = $this->params['insurance_serial_times']; - $this->model->repair_times = $this->params['repair_times']; - $this->model->insurance_repair_times = $this->params['insurance_repair_times']; - $this->model->last_insurance_company = $this->params['last_insurance_company']; - $this->model->last_insurance_type = $this->params['last_insurance_type']; - $this->model->last_insurance_rate = $this->params['last_insurance_rate']; - $this->model->last_insurance_salesman = $this->params['last_insurance_salesman']; - $this->model->last_insurance_date = $this->params['last_insurance_date']; - $this->model->force_expire_date = $this->params['force_expire_date']; - $this->model->business_expire_date = $this->params['business_expire_date']; - $this->model->status = $this->params['status']; + $this->model->model_id = $this->params['model_id'] ?? 0; + $this->model->car_no = $this->params['car_no'] ?? ''; + $this->model->frame_no = $this->params['frame_no'] ?? ''; + $this->model->engine_no = $this->params['engine_no'] ?? ''; + $this->model->factory_model = $this->params['factory_model'] ?? ''; + $this->model->car_used_type = $this->params['car_used_type'] ?? ''; + $this->model->car_man = $this->params['car_man'] ?? ''; + $this->model->purchase_price = $this->params['purchase_price'] ?? ''; + $this->model->register_date = $this->params['register_date'] ?? ''; + $this->model->seat_count = $this->params['seat_count'] ?? ''; + $this->model->insurance_times = $this->params['insurance_times'] ?? 0; + $this->model->insurance_serial_times = $this->params['insurance_serial_times'] ?? 0; + $this->model->repair_times = $this->params['repair_times'] ?? 0; + $this->model->insurance_repair_times = $this->params['insurance_repair_times'] ?? 0; + $this->model->last_insurance_company = $this->params['last_insurance_company'] ?? ''; + $this->model->last_insurance_type = $this->params['last_insurance_type'] ?? ''; + $this->model->last_insurance_rate = $this->params['last_insurance_rate'] ?? 0; + $this->model->last_insurance_salesman = $this->params['last_insurance_salesman'] ?? ''; + $this->model->last_insurance_date = $this->params['last_insurance_date'] ?? ''; + $this->model->force_expire_date = $this->params['force_expire_date'] ?? ''; + $this->model->business_expire_date = $this->params['business_expire_date'] ?? ''; + $this->model->status = $this->params['status'] ?? 0; if($this->model->save()){ return $this->success(new CarInfo($this->model)); } else { - return $this->error(500, '基础信息保存失败'); + return $this->error(500, '车辆信息保存失败'); } } /** - * @title 基础删除 - * @description 基础删除 + * @title 车辆删除 + * @description 车辆删除 * @param $id * @return \Illuminate\Http\JsonResponse * @author zcstatham */ public function destroy($id) { - if($this->model->destroy($id)){ + $this->model = $this->model->where('id', $id)->first(); + $this->model->status = 0; + if($this->model->save()){ return $this->success(); } else { - return $this->error(500, '基础信息保存失败'); + return $this->error(500, '车辆信息保存失败'); } } } diff --git a/app/Http/Controllers/Api/CarManController.php b/app/Http/Controllers/Api/CarManController.php new file mode 100644 index 0000000..8f9a39b --- /dev/null +++ b/app/Http/Controllers/Api/CarManController.php @@ -0,0 +1,116 @@ + [ + 'rules' => [ + 'car_id' => 'required|numeric', + 'type' => 'numeric', + 'name' => 'required|string', + 'phone' => 'required|string', + 'id_card_type' => 'numeric', + 'id_card' => 'required|string', + ], + 'custom' => 'regx,id_type,id_card,id_card_type' + ], + 'update' => [ + 'rules' => [ + 'id' => 'bail|min:1', + 'car_id' => 'required|numeric', + 'type' => 'numeric', + 'name' => 'required|string', + 'phone' => 'required|string', + 'id_card_type' => 'numeric', + 'id_card' => 'required|string', + ], + 'custom' => [ + 'exists,App\Models\CarManT,id', + 'regx,id_type,id_card,id_card_type' + ] + ], + ]; + + public function __construct(Request $request) + { + $this->model = new CarManT(); + parent::__construct($request); + } + + /** + * @title 车辆联系人列表 + * @description 车辆联系人列表 + * @return \Illuminate\Http\JsonResponse + * @author zcstatham + */ + public function index() + { + $query = $this->model->query(); + + if(isset($this->params['name']) && $this->params['name'] != ''){ + $query->where('name', $this->params['name']); + } + + $data = $query->paginate(); + + return $this->success(new CarManCollection($data)); + } + + /** + * @title 车辆联系人保存 + * @description 车辆联系人保存 + * @return \Illuminate\Http\JsonResponse + * @author zcstatham + */ + public function store() + { + $this->model->car_id = $this->params['car_id'] ?? 0; + $this->model->type = $this->params['type'] ?? 0; + $this->model->name = $this->params['name'] ?? ''; + $this->model->phone = $this->params['phone'] ?? ''; + $this->model->id_card_type = $this->params['id_card_type'] ?? 0; + $this->model->id_card = $this->params['id_card'] ?? ''; + if($this->model->save()){ + return $this->success(new CarMan($this->model)); + } else { + return $this->error(500, '车辆联系人信息保存失败'); + } + } + + /** + * @title 车辆联系人更新 + * @description 车辆联系人更新 + * @param $id + * @return \Illuminate\Http\JsonResponse + * @author zcstatham + */ + public function update($id) + { + $this->model = $this->model->where('id', $id)->first(); + $this->model->car_id = $this->params['car_id'] ?? 0; + $this->model->type = $this->params['type'] ?? 0; + $this->model->name = $this->params['name'] ?? ''; + $this->model->phone = $this->params['phone'] ?? ''; + $this->model->id_card_type = $this->params['id_card_type'] ?? 0; + $this->model->id_card = $this->params['id_card'] ?? ''; + if($this->model->save()){ + return $this->success(new CarMan($this->model)); + } else { + return $this->error(500, '车辆联系人信息保存失败'); + } + } +} diff --git a/app/Http/Controllers/Api/CarModelController.php b/app/Http/Controllers/Api/CarModelController.php index 06953a8..bb84657 100644 --- a/app/Http/Controllers/Api/CarModelController.php +++ b/app/Http/Controllers/Api/CarModelController.php @@ -8,7 +8,7 @@ use App\Models\CarModelT; use Illuminate\Http\Request; /** - * @title CarModelController + * @title 车型管理 * @description CarModelController * @package App\Http\Controllers\Api * @author zcstatham @@ -19,9 +19,29 @@ class CarModelController extends BaseController protected $rules = [ 'store' => [ 'rules' => [ - 'car_series_id' => 'required', - 'name' => 'required', - 'year' => 'required', + 'car_series_id' => 'required|numeric', + 'name' => 'required|string', + 'year' => 'required|string', + 'modelYears' => 'string', + 'vehicle_type' => 'string', + 'vehicle_size' => 'string', + 'engine_model' => 'string', + 'emission_standard' => 'string', + 'displacement' => 'string', + 'induction' => 'string', + 'fuel_type' => 'string', + 'cylinder_arrangement' => 'string', + 'cylinders' => 'numeric', + 'valves_per_cylinder' => 'numeric', + 'transmission_type' => 'string', + 'transmission_description' => 'string', + 'gear_number' => 'string', + 'front_tyre' => 'string', + 'rear_tyre' => 'string', + 'doors' => 'string', + 'seats' => 'string', + 'tuhu_code' => 'string', + 'guidance_price' => 'string', ] ], 'show' => [ @@ -33,14 +53,42 @@ class CarModelController extends BaseController 'update' => [ 'rules' => [ 'id' => 'bail|min:1', - 'car_series_id' => 'required', - 'name' => 'required', - 'year' => 'required', + 'car_series_id' => 'required|numeric', + 'name' => 'required|string', + 'year' => 'required|string', + 'modelYears' => 'string', + 'vehicle_type' => 'string', + 'vehicle_size' => 'string', + 'engine_model' => 'string', + 'emission_standard' => 'string', + 'displacement' => 'string', + 'induction' => 'string', + 'fuel_type' => 'string', + 'cylinder_arrangement' => 'string', + 'cylinders' => 'numeric', + 'valves_per_cylinder' => 'numeric', + 'transmission_type' => 'string', + 'transmission_description' => 'string', + 'gear_number' => 'string', + 'front_tyre' => 'string', + 'rear_tyre' => 'string', + 'doors' => 'string', + 'seats' => 'string', + 'tuhu_code' => 'string', + 'guidance_price' => 'string', ], 'custom' => [ 'exists,App\Models\CarModelT,id', ] ], + 'destroy' => [ + 'rules' => [ + 'id' => 'bail|min:1', + ], + 'custom' => [ + 'exists,App\Models\CarModelT,id', + ] + ] ]; public function __construct(Request $request) @@ -50,8 +98,8 @@ class CarModelController extends BaseController } /** - * @title 基础列表 - * @description 基础列表 + * @title 车型列表 + * @description 车型列表 * @return \Illuminate\Http\JsonResponse * @author zcstatham */ @@ -63,53 +111,82 @@ class CarModelController extends BaseController $query->where('name', $this->params['name']); } + if(isset($this->params['year']) && $this->params['name'] != ''){ + $query->where('name', $this->params['name']); + } + + if(isset($this->params['modelYears']) && $this->params['modelYears'] != ''){ + $query->whereRaw('FIND_IN_SET('. $this->params['modelYears'] .', modelYears)'); + } + + if(isset($this->params['displacement']) && $this->params['displacement'] != ''){ + $query->where('displacement', $this->params['displacement']); + } + + if(isset($this->params['transmission_type']) && $this->params['transmission_type'] != ''){ + $query->where('transmission_type', $this->params['transmission_type']); + } + + if(isset($this->params['transmission_description']) && $this->params['transmission_description'] != ''){ + $query->where('transmission_description', $this->params['transmission_description']); + } + + if(isset($this->params['car_series_id']) && $this->params['car_series_id'] > 0){ + $query->where('car_series_id', $this->params['car_series_id']); + } + + if(!isset($this->params['is_all']) || $this->params['is_all'] == 0){ + $query->select(['id', 'car_series_id', 'name']); + } + if(isset($this->params['is_page']) && $this->params['is_page'] == 1){ - $data = $query->paginate(); + return $this->success(new CarModelCollection($query->paginate())); } else { - $data = $query->get(); + return $this->success($query->get()); } - - return $this->success(new CarModelCollection($data)); } /** - * @title 基础保存 - * @description 基础保存 + * @title 车型保存 + * @description 车型保存 * @return \Illuminate\Http\JsonResponse * @author zcstatham */ public function store() { - $this->model->car_series_id = $this->params['car_series_id']; - $this->model->name = $this->params['name']; - $this->model->year = $this->params['year']; - $this->model->modelYears = $this->params['modelYears']; - $this->model->vehicle_type = $this->params['vehicle_type']; - $this->model->vehicle_size = $this->params['vehicle_size']; - $this->model->engine_model = $this->params['engine_model']; - $this->model->emission_standard = $this->params['emission_standard']; - $this->model->displacement = $this->params['displacement']; - $this->model->induction = $this->params['induction']; - $this->model->fuel_type = $this->params['fuel_type']; - $this->model->transmission_type = $this->params['transmission_type']; - $this->model->transmission_description = $this->params['transmission_description']; - $this->model->gear_number = $this->params['gear_number']; - $this->model->front_tyre = $this->params['front_tyre']; - $this->model->rear_tyre = $this->params['rear_tyre']; - $this->model->doors = $this->params['doors']; - $this->model->seats = $this->params['seats']; - $this->model->tuhu_code = $this->params['tuhu_code']; - $this->model->guidance_price = $this->params['guidance_price']; + $this->model->car_series_id = $this->params['car_series_id'] ?? 0; + $this->model->name = $this->params['name'] ?? ''; + $this->model->year = $this->params['year'] ?? ''; + $this->model->modelYears = $this->params['modelYears'] ?? ''; + $this->model->vehicle_type = $this->params['vehicle_type'] ?? ''; + $this->model->vehicle_size = $this->params['vehicle_size'] ?? ''; + $this->model->engine_model = $this->params['engine_model'] ?? ''; + $this->model->emission_standard = $this->params['emission_standard'] ?? ''; + $this->model->displacement = $this->params['displacement'] ?? ''; + $this->model->induction = $this->params['induction'] ?? ''; + $this->model->fuel_type = $this->params['fuel_type'] ?? ''; + $this->model->cylinder_arrangement = $this->params['cylinder_arrangement'] ?? ''; + $this->model->cylinders = $this->params['cylinders'] ?? 0; + $this->model->valves_per_cylinder = $this->params['valves_per_cylinder'] ?? 0; + $this->model->transmission_type = $this->params['transmission_type'] ?? ''; + $this->model->transmission_description = $this->params['transmission_description'] ?? ''; + $this->model->gear_number = $this->params['gear_number'] ?? ''; + $this->model->front_tyre = $this->params['front_tyre'] ?? ''; + $this->model->rear_tyre = $this->params['rear_tyre'] ?? ''; + $this->model->doors = $this->params['doors'] ?? ''; + $this->model->seats = $this->params['seats'] ?? ''; + $this->model->tuhu_code = $this->params['tuhu_code'] ?? ''; + $this->model->guidance_price = $this->params['guidance_price'] ?? ''; if($this->model->save()){ return $this->success(new CarModel($this->model)); } else { - return $this->error(500, '基础信息保存失败'); + return $this->error(500, '车型信息保存失败'); } } /** - * @title 基础详情 - * @description 基础详情 + * @title 车型详情 + * @description 车型详情 * @param $id * @return mixed * @author zcstatham @@ -120,8 +197,8 @@ class CarModelController extends BaseController } /** - * @title 基础更新 - * @description 基础更新 + * @title 车型更新 + * @description 车型更新 * @param $id * @return \Illuminate\Http\JsonResponse * @author zcstatham @@ -129,30 +206,33 @@ class CarModelController extends BaseController public function update($id) { $this->model = $this->model->where('id', $id)->first(); - $this->model->car_series_id = $this->params['car_series_id']; - $this->model->name = $this->params['name']; - $this->model->year = $this->params['year']; - $this->model->modelYears = $this->params['modelYears']; - $this->model->vehicle_type = $this->params['vehicle_type']; - $this->model->vehicle_size = $this->params['vehicle_size']; - $this->model->engine_model = $this->params['engine_model']; - $this->model->emission_standard = $this->params['emission_standard']; - $this->model->displacement = $this->params['displacement']; - $this->model->induction = $this->params['induction']; - $this->model->fuel_type = $this->params['fuel_type']; - $this->model->transmission_type = $this->params['transmission_type']; - $this->model->transmission_description = $this->params['transmission_description']; - $this->model->gear_number = $this->params['gear_number']; - $this->model->front_tyre = $this->params['front_tyre']; - $this->model->rear_tyre = $this->params['rear_tyre']; - $this->model->doors = $this->params['doors']; - $this->model->seats = $this->params['seats']; - $this->model->tuhu_code = $this->params['tuhu_code']; - $this->model->guidance_price = $this->params['guidance_price']; + $this->model->car_series_id = $this->params['car_series_id'] ?? 0; + $this->model->name = $this->params['name'] ?? ''; + $this->model->year = $this->params['year'] ?? ''; + $this->model->modelYears = $this->params['modelYears'] ?? ''; + $this->model->vehicle_type = $this->params['vehicle_type'] ?? ''; + $this->model->vehicle_size = $this->params['vehicle_size'] ?? ''; + $this->model->engine_model = $this->params['engine_model'] ?? ''; + $this->model->emission_standard = $this->params['emission_standard'] ?? ''; + $this->model->displacement = $this->params['displacement'] ?? ''; + $this->model->induction = $this->params['induction'] ?? ''; + $this->model->fuel_type = $this->params['fuel_type'] ?? ''; + $this->model->cylinder_arrangement = $this->params['cylinder_arrangement'] ?? ''; + $this->model->cylinders = $this->params['cylinders'] ?? 0; + $this->model->valves_per_cylinder = $this->params['valves_per_cylinder'] ?? 0; + $this->model->transmission_type = $this->params['transmission_type'] ?? ''; + $this->model->transmission_description = $this->params['transmission_description'] ?? ''; + $this->model->gear_number = $this->params['gear_number'] ?? ''; + $this->model->front_tyre = $this->params['front_tyre'] ?? ''; + $this->model->rear_tyre = $this->params['rear_tyre'] ?? ''; + $this->model->doors = $this->params['doors'] ?? ''; + $this->model->seats = $this->params['seats'] ?? ''; + $this->model->tuhu_code = $this->params['tuhu_code'] ?? ''; + $this->model->guidance_price = $this->params['guidance_price'] ?? ''; if($this->model->save()){ return $this->success(new CarModel($this->model)); } else { - return $this->error(500, '基础信息保存失败'); + return $this->error(500, '车型信息保存失败'); } } } diff --git a/app/Http/Controllers/Api/CarSeriesController.php b/app/Http/Controllers/Api/CarSeriesController.php index 70551ec..550087a 100644 --- a/app/Http/Controllers/Api/CarSeriesController.php +++ b/app/Http/Controllers/Api/CarSeriesController.php @@ -8,7 +8,7 @@ use App\Models\CarSeriesT; use Illuminate\Http\Request; /** - * @title 基础管理 + * @title 车系管理 * @description CarSeriesController * @package App\Http\Controllers\Api * @author zcstatham @@ -82,8 +82,8 @@ class CarSeriesController extends BaseController } /** - * @title 基础列表 - * @description 基础列表 + * @title 车系列表 + * @description 车系列表 * @return \Illuminate\Http\JsonResponse * @author zcstatham */ @@ -91,18 +91,28 @@ class CarSeriesController extends BaseController { $query = $this->model->query(); - if(isset($this->params['name']) && $this->params['name'] > 0){ + if(isset($this->params['name']) && $this->params['name'] != ''){ $query->where('name', $this->params['name']); } - $data = $query->paginate(); + if(isset($this->params['car_sub_brand_id']) && $this->params['car_sub_brand_id'] > 0){ + $query->where('car_sub_brand_id', $this->params['car_sub_brand_id']); + } + + if(!isset($this->params['is_all']) || $this->params['is_all'] == 0){ + $query->select(['id', 'car_sub_brand_id', 'name', 'level']); + } - return $this->success(new CarSeriesCollection($data)); + if(isset($this->params['is_page']) && $this->params['is_page'] == 1){ + return $this->success(new CarSeriesCollection($query->paginate())); + } else { + return $this->success($query->get()); + } } /** - * @title 基础保存 - * @description 基础保存 + * @title 车系保存 + * @description 车系保存 * @return \Illuminate\Http\JsonResponse * @author zcstatham */ @@ -126,13 +136,13 @@ class CarSeriesController extends BaseController if($this->model->save()){ return $this->success(new CarSeries($this->model)); } else { - return $this->error(500, '基础信息保存失败'); + return $this->error(500, '车系信息保存失败'); } } /** - * @title 基础详情 - * @description 基础详情 + * @title 车系详情 + * @description 车系详情 * @param $id * @return mixed * @author zcstatham @@ -143,8 +153,8 @@ class CarSeriesController extends BaseController } /** - * @title 基础更新 - * @description 基础更新 + * @title 车系更新 + * @description 车系更新 * @param $id * @return \Illuminate\Http\JsonResponse * @author zcstatham @@ -170,23 +180,7 @@ class CarSeriesController extends BaseController if($this->model->save()){ return $this->success(new CarSeries($this->model)); } else { - return $this->error(500, '基础信息保存失败'); - } - } - - /** - * @title 基础删除 - * @description 基础删除 - * @param $id - * @return \Illuminate\Http\JsonResponse - * @author zcstatham - */ - public function destroy($id) - { - if($this->model->destroy($id)){ - return $this->success(); - } else { - return $this->error(500, '基础信息保存失败'); + return $this->error(500, '车系信息保存失败'); } } } diff --git a/app/Http/Middleware/ParamVerify.php b/app/Http/Middleware/ParamVerify.php index ac66925..bfcf2ea 100644 --- a/app/Http/Middleware/ParamVerify.php +++ b/app/Http/Middleware/ParamVerify.php @@ -96,6 +96,17 @@ class ParamVerify return ['field' => 'ip', 'message' => '禁止外网访问']; } break; + case 'regx': + $pattern = config('patterns.' . $rule[1]); + if(isset($pattern[$param[$rule[3]]])){ + $pattern = $pattern[$param[$rule[3]]]; + } + if (preg_match($pattern['pattern'], $param[$rule[2]]) > 0) { + return true; + } else { + return ['field' => '$rule[2]', 'message' => $attributes[$rule[2]] . ' 字段格式错误']; + } + break; } } diff --git a/app/Http/Resources/CarInfo.php b/app/Http/Resources/CarInfo.php index 0891dd2..164e9ef 100644 --- a/app/Http/Resources/CarInfo.php +++ b/app/Http/Resources/CarInfo.php @@ -37,8 +37,8 @@ class CarInfo extends JsonResource 'force_expire_date' => $this->force_expire_date, 'business_expire_date' => $this->business_expire_date, 'status' => $this->status, - 'created_at' => $this->created_at, - 'updated_at' => $this->updated_at, + 'created_at' => $this->created_at->toDateTimeString(), + 'updated_at' => $this->updated_at->toDateTimeString(), ]; } } diff --git a/app/Http/Resources/CarMan.php b/app/Http/Resources/CarMan.php new file mode 100644 index 0000000..8717831 --- /dev/null +++ b/app/Http/Resources/CarMan.php @@ -0,0 +1,31 @@ + '车主', 2 => '被保险人', 3 => '联系人']; + return [ + 'id' => $this->id, + 'car_id' => $this->car_id, + 'type' => $this->type, + 'type_txt' => $type_txt[$this->type], + 'name' => $this->name, + 'phone' => $this->phone, + 'id_card_type' => $this->id_card_type, + 'id_card' => $this->id_card, + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, + ]; + } +} diff --git a/app/Http/Resources/CarManCollection.php b/app/Http/Resources/CarManCollection.php new file mode 100644 index 0000000..583f032 --- /dev/null +++ b/app/Http/Resources/CarManCollection.php @@ -0,0 +1,17 @@ + ['name' => 'car_no', 'title' => '车牌号', 'type' => 'varchar', 'is_must' => '1'], - 'frame_no' => ['name' => 'frame_no', 'title' => '车架号', 'type' => 'varchar', 'is_must' => '1'], - 'engine_no' => ['name' => 'engine_no', 'title' => '发动机号', 'type' => 'varchar', 'is_must' => '0'], - 'factory_model' => ['name' => 'factory_model', 'title' => '厂牌型号', 'type' => 'varchar', 'is_must' => '0'], - 'car_used_type' => ['name' => 'car_used_type', 'title' => '车辆使用性质', 'type' => 'varchar', 'is_must' => '0'], - 'car_man' => ['name' => 'car_man', 'title' => '车主姓名', 'type' => 'varchar', 'is_must' => '0'], - 'purchase_price' => ['name' => 'purchase_price', 'title' => '新车购置价', 'type' => 'varchar', 'is_must' => '0'], - 'register_date' => ['name' => 'register_date', 'title' => '初登日期', 'type' => 'varchar', 'is_must' => '0'], - 'seat_count' => ['name' => 'seat_count', 'title' => '座位数', 'type' => 'varchar', 'is_must' => '0'], - 'insurance_times' => ['name' => 'insurance_times', 'title' => '投保次数', 'type' => 'tinyint', 'is_must' => '0'], - 'insurance_serial_times' => ['name' => 'insurance_serial_times', 'title' => '连续投保次数', 'type' => 'tinyint', 'is_must' => '0'], - 'repair_times' => ['name' => 'repair_times', 'title' => '维修次数', 'type' => 'tinyint', 'is_must' => '0'], - 'insurance_repair_times' => ['name' => 'insurance_repair_times', 'title' => '回修次数', 'type' => 'tinyint', 'is_must' => '0'], - 'last_insurance_company' => ['name' => 'last_insurance_company', 'title' => '上年承保公司', 'type' => 'varchar', 'is_must' => '0'], - 'last_insurance_type' => ['name' => 'last_insurance_type', 'title' => '上年承保险种', 'type' => 'varchar', 'is_must' => '0'], - 'last_insurance_rate' => ['name' => 'last_insurance_rate', 'title' => '上年保险折扣率', 'type' => 'tinyint', 'is_must' => '0'], - 'last_insurance_salesman' => ['name' => 'last_insurance_salesman', 'title' => '上年保险业务', 'type' => 'varchar', 'is_must' => '0'], - 'last_insurance_date' => ['name' => 'last_insurance_date', 'title' => '上年正本日期', 'type' => 'varchar', 'is_must' => '0'], - 'force_expire_date' => ['name' => 'force_expire_date', 'title' => '交强到期日期', 'type' => 'varchar', 'is_must' => '0'], - 'business_expire_date' => ['name' => 'business_expire_date', 'title' => '商业到期日期', 'type' => 'varchar', 'is_must' => '0'], - 'status' => ['name' => 'status', 'title' => '数据状态', 'type' => 'tinyint', 'is_must' => '0'], + 'model_id' => ['name' => 'model_id', 'title' => '车型', 'type' => 'bigint', 'is_must' => '0'], + 'car_no' => ['name' => 'car_no', 'title' => '车牌号', 'type' => 'varchar', 'is_must' => '1'], + 'frame_no' => ['name' => 'frame_no', 'title' => '车架号', 'type' => 'varchar', 'is_must' => '1'], + 'engine_no' => ['name' => 'engine_no', 'title' => '发动机号', 'type' => 'varchar', 'is_must' => '0'], + 'factory_model' => ['name' => 'factory_model', 'title' => '厂牌型号', 'type' => 'varchar', 'is_must' => '0'], + 'car_used_type' => ['name' => 'car_used_type', 'title' => '车辆使用性质', 'type' => 'varchar', 'is_must' => '0'], + 'car_man' => ['name' => 'car_man', 'title' => '车主姓名', 'type' => 'varchar', 'is_must' => '0'], + 'purchase_price' => ['name' => 'purchase_price', 'title' => '新车购置价', 'type' => 'varchar', 'is_must' => '0'], + 'register_date' => ['name' => 'register_date', 'title' => '初登日期', 'type' => 'varchar', 'is_must' => '0'], + 'seat_count' => ['name' => 'seat_count', 'title' => '座位数', 'type' => 'varchar', 'is_must' => '0'], + 'insurance_times' => ['name' => 'insurance_times', 'title' => '投保次数', 'type' => 'tinyint', 'is_must' => '0'], + 'insurance_serial_times' => ['name' => 'insurance_serial_times', 'title' => '连续投保次数', 'type' => 'tinyint', 'is_must' => '0'], + 'repair_times' => ['name' => 'repair_times', 'title' => '维修次数', 'type' => 'tinyint', 'is_must' => '0'], + 'insurance_repair_times' => ['name' => 'insurance_repair_times', 'title' => '回修次数', 'type' => 'tinyint', 'is_must' => '0'], + 'last_insurance_company' => ['name' => 'last_insurance_company', 'title' => '上年承保公司', 'type' => 'varchar', 'is_must' => '0'], + 'last_insurance_type' => ['name' => 'last_insurance_type', 'title' => '上年承保险种', 'type' => 'varchar', 'is_must' => '0'], + 'last_insurance_rate' => ['name' => 'last_insurance_rate', 'title' => '上年保险折扣率', 'type' => 'tinyint', 'is_must' => '0'], + 'last_insurance_salesman' => ['name' => 'last_insurance_salesman', 'title' => '上年保险业务', 'type' => 'varchar', 'is_must' => '0'], + 'last_insurance_date' => ['name' => 'last_insurance_date', 'title' => '上年正本日期', 'type' => 'varchar', 'is_must' => '0'], + 'force_expire_date' => ['name' => 'force_expire_date', 'title' => '交强到期日期', 'type' => 'varchar', 'is_must' => '0'], + 'business_expire_date' => ['name' => 'business_expire_date', 'title' => '商业到期日期', 'type' => 'varchar', 'is_must' => '0'], + 'status' => ['name' => 'status', 'title' => '数据状态', 'type' => 'tinyint', 'is_must' => '0'], ]; } diff --git a/app/Models/CarManT.php b/app/Models/CarManT.php new file mode 100644 index 0000000..5421d83 --- /dev/null +++ b/app/Models/CarManT.php @@ -0,0 +1,35 @@ + ['name' => 'car_id', 'title' => '车辆ID', 'type' => 'bigint', 'is_must' => '1'], + 'type' => ['name' => 'type', 'title' => '联系人类型', 'type' => 'tinyint', 'is_must' => '0'], + 'name' => ['name' => 'name', 'title' => '姓名', 'type' => 'varchar', 'is_must' => '1'], + 'phone' => ['name' => 'phone', 'title' => '手机号', 'type' => 'varchar', 'is_must' => '1'], + 'id_card_type' => ['name' => 'id_card_type', 'title' => '证件类型', 'type' => 'tinyint', 'is_must' => '0'], + 'id_card' => ['name' => 'id_card', 'title' => '证件号', 'type' => 'varchar', 'is_must' => '1'], + ]; +} diff --git a/app/Models/CarModelT.php b/app/Models/CarModelT.php index 3a34fc7..92d43ef 100644 --- a/app/Models/CarModelT.php +++ b/app/Models/CarModelT.php @@ -20,6 +20,9 @@ use Illuminate\Database\Eloquent\Model; * @property $displacement varchar * @property $induction varchar * @property $fuel_type varchar + * @property $cylinder_arrangement char + * @property $cylinders tinyint + * @property $valves_per_cylinder tinyint * @property $transmission_type varchar * @property $transmission_description varchar * @property $gear_number varchar @@ -50,6 +53,9 @@ class CarModelT extends Model 'displacement' => ['name' => 'displacement', 'title' => '排量', 'type' => 'varchar', 'is_must' => '0'], 'induction' => ['name' => 'induction', 'title' => '进气形式', 'type' => 'varchar', 'is_must' => '0'], 'fuel_type' => ['name' => 'fuel_type', 'title' => '燃油类型', 'type' => 'varchar', 'is_must' => '0'], + 'cylinder_arrangement' => ['name' => 'cylinder_arrangement', 'title' => '气缸排列形式', 'type' => 'char', 'is_must' => '0'], + 'cylinders' => ['name' => 'cylinders', 'title' => '气缸数', 'type' => 'tinyint', 'is_must' => '0'], + 'valves_per_cylinder' => ['name' => 'valves_per_cylinder', 'title' => '每缸气门数', 'type' => 'tinyint', 'is_must' => '0'], 'transmission_type' => ['name' => 'transmission_type', 'title' => '变速器类型', 'type' => 'varchar', 'is_must' => '0'], 'transmission_description' => ['name' => 'transmission_description', 'title' => '变速器描述', 'type' => 'varchar', 'is_must' => '0'], 'gear_number' => ['name' => 'gear_number', 'title' => '档位数', 'type' => 'varchar', 'is_must' => '0'], diff --git a/composer.json b/composer.json index 885df8f..e2bf2e6 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,8 @@ "iidestiny/laravel-filesystem-oss": "^2.1", "laravel/framework": "^8.12", "laravel/tinker": "^2.5", - "tymon/jwt-auth": "^1.0" + "tymon/jwt-auth": "^1.0", + "zhuqipeng/laravel-hprose": "v1.0.*" }, "require-dev": { "facade/ignition": "^2.5", diff --git a/composer.lock b/composer.lock index 1a4420d..38b5661 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "89e830c2ea322cb898c94664d79e1f9a", + "content-hash": "f4b86984c7875266a63799ac3e085339", "packages": [ { "name": "aliyuncs/oss-sdk-php", @@ -937,6 +937,90 @@ }, "time": "2020-09-30T07:37:11+00:00" }, + { + "name": "hprose/hprose", + "version": "v2.0.40", + "source": { + "type": "git", + "url": "https://github.com/hprose/hprose-php.git", + "reference": "ab4955a31596a71b0ba205e18a8598a95ef005b4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/hprose/hprose-php/zipball/ab4955a31596a71b0ba205e18a8598a95ef005b4", + "reference": "ab4955a31596a71b0ba205e18a8598a95ef005b4", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": ">=4.0.0" + }, + "suggest": { + "ext-hprose": "Faster serialize and unserialize hprose extension." + }, + "type": "library", + "autoload": { + "files": [ + "src/init.php" + ], + "psr-4": { + "Hprose\\": "src/Hprose" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ma Bingyao", + "email": "andot@hprose.com", + "homepage": "http://hprose.com", + "role": "Developer" + } + ], + "description": "It is a modern, lightweight, cross-language, cross-platform, object-oriented, high performance, remote dynamic communication middleware. It is not only easy to use, but powerful. You just need a little time to learn, then you can use it to easily construct cross language cross platform distributed application system.", + "homepage": "http://hprose.com/", + "keywords": [ + "HTML5", + "Hprose", + "Socket", + "ajax", + "async", + "communication", + "cross-domain", + "cross-language", + "cross-platform", + "framework", + "future", + "game", + "http", + "json", + "jsonrpc", + "library", + "middleware", + "phprpc", + "protocol", + "rpc", + "serialization", + "serialize", + "service", + "tcp", + "unix", + "web", + "webapi", + "webservice", + "websocket", + "xmlrpc" + ], + "support": { + "issues": "https://github.com/hprose/hprose-php/issues", + "source": "https://github.com/hprose/hprose-php/tree/v2.0.40" + }, + "time": "2020-03-30T15:33:41+00:00" + }, { "name": "iidestiny/flysystem-oss", "version": "2.5", @@ -5297,6 +5381,61 @@ "source": "https://github.com/webmozart/assert/tree/master" }, "time": "2020-07-08T17:02:28+00:00" + }, + { + "name": "zhuqipeng/laravel-hprose", + "version": "v1.0.2", + "source": { + "type": "git", + "url": "https://github.com/zhuqipeng/laravel-hprose.git", + "reference": "38afe2b5632ebe17f1fcab2aba35a1134cff8d18" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zhuqipeng/laravel-hprose/zipball/38afe2b5632ebe17f1fcab2aba35a1134cff8d18", + "reference": "38afe2b5632ebe17f1fcab2aba35a1134cff8d18", + "shasum": "" + }, + "require": { + "hprose/hprose": "v2.0.*", + "php": ">=7.0.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Zhuqipeng\\LaravelHprose\\ServiceProvider" + ], + "aliases": { + "LaravelHproseRouter": "Zhuqipeng\\LaravelHprose\\Facades\\Router" + } + } + }, + "autoload": { + "psr-4": { + "Zhuqipeng\\LaravelHprose\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "朱其鹏", + "email": "28942998@qq.com" + } + ], + "description": "Hprose for Laravel", + "keywords": [ + "Hprose", + "laravel" + ], + "support": { + "issues": "https://github.com/zhuqipeng/laravel-hprose/issues", + "source": "https://github.com/zhuqipeng/laravel-hprose/tree/master" + }, + "time": "2018-11-26T02:48:13+00:00" } ], "packages-dev": [ diff --git a/config/hprose.php b/config/hprose.php new file mode 100644 index 0000000..5cb8e0b --- /dev/null +++ b/config/hprose.php @@ -0,0 +1,19 @@ + json_decode(env('HPROSE_URIS', '["tcp://0.0.0.0:1314"]')), + + /** + * true开启 false关闭,开启后将自动对外发布一个远程调用方法 `demo` + * $client->demo() + */ + 'demo' => env('HPROSE_DEMO'), + + 'parameter' => 'App\\Controllers\\Parameters', + + 'controller' => 'App\\Controllers', +]; \ No newline at end of file diff --git a/config/patterns.php b/config/patterns.php new file mode 100644 index 0000000..bc837ca --- /dev/null +++ b/config/patterns.php @@ -0,0 +1,21 @@ + [ + 1 => ['name' => '身份证', 'pattern' => '/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}(\d|x|X)$/'], + 2 => ['name' => '组织机构代码证', 'pattern' => '/^[a-zA-Z0-9]{10,20}$/'], + 3 => ['name' => '护照', 'pattern' => '/^[a-zA-Z0-9]{5,17}$/'], + 4 => ['name' => '军官证', 'pattern' => '/^[0-9]{8}$/'], + 5 => ['name' => '港澳居民来往内地通行证', 'pattern' => '/(H|M)(\d{10})$/'], + 6 => ['name' => '其他', 'pattern' => '1'], + 7 => ['name' => '港澳通行证', 'pattern' => '/^[CW]\d{8}$/'], + 8 => ['name' => '出生证', 'pattern' => '/^[a-zA-Z0-9]{5,21}$/'], + 9 => ['name' => '营业执照(社会统一信用代码)', 'pattern' => '/^[0-9A-HJ-NPQRTUWXY]{2}\d{6}[0-9A-HJ-NPQRTUWXY]{10}$/'], + 10 => ['name' => '税务登记证', 'pattern' => '/^[0-9a-zA-z_]{18}$/'], + 11 => ['name' => '驾驶证', 'pattern' => '/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}(\d|x|X)$/'], + 12 => ['name' => '营业执照(区别与9,这是三证合一之前的)', 'pattern' => '/^[a-zA-Z0-9]{10,20}$/'], + 13 => ['name' => '台胞证', 'pattern' => '/^([0-9]{8}|[0-9]{10})$/'], + 14 => ['name' => '港澳身份证', 'pattern' => '1'] + ], + 'email' => '/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/', + 'phone' => '/^1(3|5|8|7|8|9)\d{9}$/', +]; diff --git a/database/migrations/2021_02_03_094810_create_car_model_table.php b/database/migrations/2021_02_03_094810_create_car_model_table.php index 25ac357..e7b4847 100644 --- a/database/migrations/2021_02_03_094810_create_car_model_table.php +++ b/database/migrations/2021_02_03_094810_create_car_model_table.php @@ -26,6 +26,9 @@ class CreateCarModelTable extends Migration $table->string('displacement', 100)->default('')->comment('排量'); $table->string('induction', 100)->default('')->comment('进气形式'); $table->string('fuel_type', 100)->default('')->comment('燃油类型'); + $table->char('cylinder_arrangement', 1)->default('')->comment('气缸排列形式'); + $table->tinyInteger('cylinders', 100)->default(0)->comment('气缸数'); + $table->tinyInteger('valves_per_cylinder', 100)->default(0)->comment('每缸气门数'); $table->string('transmission_type', 100)->default('')->comment('变速器类型'); $table->string('transmission_description', 100)->default('')->comment('变速器描述'); $table->string('gear_number', 100)->default('')->comment('档位数'); diff --git a/database/migrations/2021_02_04_035947_create_car_into_table.php b/database/migrations/2021_02_04_035947_create_car_into_table.php index a0352e2..2f941d9 100644 --- a/database/migrations/2021_02_04_035947_create_car_into_table.php +++ b/database/migrations/2021_02_04_035947_create_car_into_table.php @@ -15,6 +15,7 @@ class CreateCarIntoTable extends Migration { Schema::create('uc_car_info_t', function (Blueprint $table) { $table->id(); + $table->bigInteger('model_id')->default(0)->comment('车型'); $table->string('car_no',50)->unique()->comment('车牌号'); $table->string('frame_no',100)->unique()->comment('车架号'); $table->string('engine_no',50)->default('')->comment('发动机号'); diff --git a/database/migrations/2021_02_07_075836_create_car_man_table.php b/database/migrations/2021_02_07_075836_create_car_man_table.php new file mode 100644 index 0000000..6dc616d --- /dev/null +++ b/database/migrations/2021_02_07_075836_create_car_man_table.php @@ -0,0 +1,37 @@ +id(); + $table->bigInteger('car_id')->comment('车辆ID'); + $table->tinyInteger('type')->default(1)->comment('联系人类型: 1 车主 2 被保险人 3 保险联系人'); + $table->string('name', 20)->comment('姓名'); + $table->string('phone',20)->comment('手机号'); + $table->tinyInteger('id_card_type')->default(1)->comment('证件类型'); + $table->string('id_card', 20)->comment('证件号'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('uc_car_man_t'); + } +} diff --git a/routes/api.php b/routes/api.php index 9e2ac7f..cac3f12 100644 --- a/routes/api.php +++ b/routes/api.php @@ -57,13 +57,22 @@ Route::namespace('App\Http\Controllers\Api')->group(function(){ Route::resources([ 'car-brand' => CarBrandController::class, 'car-sub-brand' => CarSubBrandController::class, - 'car-series' => CarSeriesController::class, - 'car-model' => CarModelController::class, + 'car-man' => CarManController::class, ], [ 'only' => ['index', 'store', 'update'], 'parameters' => [ 'car-brand' => 'id', 'car-sub-brand' => 'id', + 'car-man' => 'id', + ] + ]); + + Route::resources([ + 'car-series' => CarSeriesController::class, + 'car-model' => CarModelController::class, + ], [ + 'except' => ['delete'], + 'parameters' => [ 'car-series' => 'id', 'car-model' => 'id', ] diff --git a/routes/rpc.php b/routes/rpc.php new file mode 100644 index 0000000..111419a --- /dev/null +++ b/routes/rpc.php @@ -0,0 +1,5 @@ +model->query(); - if(isset($this->params['name']) && $this->params['name'] > 0){ + if(isset($this->params['name']) && $this->params['name'] != ''){ $query->where('name', $this->params['name']); }