ADD:添加后台管理端接口;

DEL:删除不必要的头部注释;
FIX:修正若干已知错误;
This commit is contained in:
2025-07-13 19:40:10 +08:00
parent 0a45e55cca
commit 270b881437
66 changed files with 8618 additions and 8129 deletions
+260 -457
View File
@@ -1,11 +1,4 @@
<?php
# @Author: 嗨噜客(三亚) <fm453>
# @Date: 2022-05-22T07:29:34+08:00
# @Email: fm453@lukegzs.com
# @Last modified by: fm453
# @Last modified time: 2024-08-09T09:17:16+08:00
# @Copyright: www.hiluker.cn
namespace api\controllers\gm\v1;
@@ -21,51 +14,189 @@
class CarController extends Common
{
public function beforeAction($action)
{
if (!$this->pid) {
$this->result('您正使用本系统内部接口,禁止非法链接使用!');
}
return parent::beforeAction($action);
}
//主界面
public function actionIndex()
{
return $this->render('../layouts/dev', []);
$apis = [
'list'=>'车辆列表',
'detail'=>'详情',
'add'=>'添加',
'edit'=>'编辑',
'delete'=>'删除',
'show'=>'显示',
'hide'=>'隐藏',
'ajax'=>'ajax操作'
];
$this->result('您正使用CMTS-GM系统车辆管理接口!', $apis, 200);
}
//车辆列表
public function actionList()
{
$pid = Yii::$app->session->get('pid');
$session = Yii::$app->session;
$AcCar = new AcCar();
$s = $this->search();
$res = $s['res'];
if (!$res) {
$this->result('没有查询到相应的数据!', [], 0);
}
$return = [];
$return['code'] = 200;
$return['msg'] = '车辆查询成功!';
$return['data']= [
'total'=>$s['query']->count(),
'cars' => $res,
'series' => $s['series'],
'brands' => $s['brands'],
'owners' => $s['owners'],
'users' => $s['users'],
'page'=>$this->page
];
$this->result($return['msg'], $return['data'], $return['code']);
}
public function actionDetail()
{
$id = (int)Yii::$app->request->get('id');
if(!$id) $this->result('请求错误,未携带ID参数');
$model = new AcCar();
$res = $model->findOne($id)->toArray();
if(!$res) $this->result('未查询到相应数据');
$car = $this->showCar($res);
$this->result('车辆信息查询完成', $car, 200);
}
public function actionAdd()
{
//数据预检查、编排
$data = $this->preSave('add');
if(!$data) $this->result('数据预检查未通过,保存失败', $data, 100);
//保存资料
$model = new AcCar();
foreach ($data as $key=>$val) {
$model->$key = $val;
}
$res = $model->save();
$msg = '数据保存失败!';
if(!$res) $this->result($msg, [], 100);
$msg = '数据保存成功!';
$return = [];
$return['id']= $model->attributes['id']; //获取插入后id;
$this->result($msg,$return, 200);
}
//编辑客车资料
public function actionEdit()
{
$detail = $this->preUpdate();
//数据预检查、编排
$data = $this->preSave('edit');
if(!$data) $this->result('数据预检查未通过,保存失败', $data, 100);
//保存资料
foreach ($data as $key=>$val) {
$detail->$key = $val;
}
$res = $detail->save();
$msg = '数据编辑失败!';
if(!$res) $this->result($msg, [], 100);
$msg = '数据编辑成功!';
$return = [];
$return['data']= $detail;
$this->result($msg,$return, 200);
}
//删除车辆
public function actionDelete()
{
$detail = $this->preUpdate();
$data = [];
$data['update_at'] = time();
$data['deleted'] = $detail->deleted + 1;
//保存资料
foreach ($data as $key=>$val) {
$detail->$key = $val;
}
$res = $detail->save();
$msg = '车型数据删除失败!';
if(!$res) $this->result($msg, [], 100);
$msg = '车型数据删除成功!';
$this->result($msg,[], 200);
}
public function actionAjax()
{
$detail = $this->preUpdate();
$get = Yii::$app->request->get();
$msg = '';
$errorCode = 0;
$detail->update_at = time();
switch ($get['do']) {
case 'hide':
$detail->status_code = 0;
$res = $detail->save();
if ($res) {
$msg = '车型隐藏标记成功';
$errorCode = 200;
} else {
$msg = '车型隐藏标记失败';
}
break;
case 'show':
$detail->status_code = 1;
$res = $detail->save();
if ($res) {
$msg = '车型显示标记成功';
$errorCode = 200;
} else {
$msg = '车型显示标记失败';
}
break;
default:
break;
}
$this->result($msg,[], $errorCode);
}
private function search(){
$pid = $this->pid;
$return = [];
$model = new AcCar();
$where = $where2 = [];
$where['pid'] = $pid;
$post = Yii::$app->request->post();
$search = [];
$searchSession = 'cars::search';
if (isset($_GET['reset']) && $_GET['reset'] == 1) {
$post['search'] = [];
}
if (isset($post['search'])) {
$search = $post['search'];
$session->set($searchSession, $search);
// }elseif($session->get($searchSession)){
// $search = $session->get($searchSession);
}
$post = $this->postdata;
$search = $post['search'] ?? [];
$search['title'] = isset($search['title']) ? trim(htmlspecialchars_decode($search['title'])) : '';
if (!empty($search['title'])) {
$where2[] = 'or';
$where2[] = ['LIKE', 'car_no', $search['title']];
$where2[] = ['LIKE', 'num_left', $search['title']];
$where2[] = ['LIKE', 'num_frame', $search['title']];
}
$search['brand'] = isset($search['brand_id']) ? trim(htmlspecialchars_decode($search['brand'])) : '';
$search['brand_id'] = isset($search['brand_id']) ? (int)$search['brand_id'] : 0;
if (!empty($search['brand_id'])) {
$where['brand_id'] = $search['brand_id'];
}
$search['series_id'] = isset($search['series_id']) ? (int)$search['series_id'] : 0;
if (!empty($search['series_id'])) {
$where['series_id'] = $search['series_id'];
}
$where['deleted'] = 0;
$data = $AcCar->find()->where($where);
$data = $model->find()->where($where);
if ($search['title']) {
$data = $data->andwhere($where2);
}
$pages = new Pagination(['totalCount' => $data->count(), 'pageSize' => '20']);
$pages = new Pagination(['totalCount' => $data->count(), 'pageSize' => $this->pageSize]);
$res = $data->offset($pages->offset)->limit($pages->limit)->orderby('id DESC')->all();
$oids = $mids = $bids = $sids = [];
@@ -77,7 +208,6 @@
$sids[] = $r->series_id;
}
}
$status = Yii::$app->params['CommonStatus'];
$AcCarOwner = new AcCarOwner();
$where = [];
$where['pid'] = $pid;
@@ -135,337 +265,86 @@
$brands[$r->id] = $r->toArray();
}
}
$cars = [];
if ($res) {
foreach ($res as $r) {
$car = $r->toArray();
$t = '';
if (isset($series[$r->series_id]['title'])) {
$t .= $brands[$r->brand_id]['title'];
}
$t .= '-';
if (isset($series[$r->series_id]['title'])) {
$t .= $series[$r->series_id]['title'];
}
$car['title2'] = $t;
$car['numbers'] = $car['num_p'] . $car['num_area'] . $car['num_left'];
$car['numbers'] = $car['numbers'] ? $car['numbers'] : $car['num_frame'];
$car['numbers'] = $car['num_p'] ? $car['numbers'] : $car['num_frame'];
$cars[$r->id] = $car;
}
}
return $this->render('list', [
'cars' => $cars,
'pager' => $pages,
'owners' => $owners,
'users' => $users,
'status' => $status,
'search' => $search
]);
return ['res'=>$cars,'query'=>$data,'owners'=>$owners,'users'=>$users,'brands'=>$brands,'series'=>$series];
}
public function actionSelect()
{
$pid = Yii::$app->session->get('pid');
$session = Yii::$app->session;
$AcCar = new AcCar();
$where = $where2 = [];
$where['pid'] = $pid;
$post = Yii::$app->request->post();
$search = [];
$searchSession = 'cars::search';
if (isset($_GET['reset']) && $_GET['reset'] == 1) {
$post['search'] = [];
}
if (isset($post['search'])) {
$search = $post['search'];
$session->set($searchSession, $search);
// }elseif($session->get($searchSession)){
// $search = $session->get($searchSession);
}
$search['title'] = isset($search['title']) ? trim(htmlspecialchars_decode($search['title'])) : '';
if (!empty($search['title'])) {
$where2[] = 'or';
$where2[] = ['LIKE', 'num_left', $search['title']];
$where2[] = ['LIKE', 'num_frame', $search['title']];
}
$search['brand'] = isset($search['brand_id']) ? trim(htmlspecialchars_decode($search['brand'])) : '';
$search['brand_id'] = isset($search['brand_id']) ? (int)$search['brand_id'] : 0;
if (!empty($search['brand_id'])) {
$where['brand_id'] = $search['brand_id'];
}
$where['deleted'] = 0;
$data = $AcCar->find()->where($where);
if ($search['title']) {
$data = $data->andWhere($where2);
}
$pages = new Pagination(['totalCount' => $data->count(), 'pageSize' => '20']);
$res = $data->offset($pages->offset)->limit($pages->limit)->orderby(' id DESC')->all();
$oids = $mids = $bids = $sids = [];
if ($res) {
foreach ($res as $r) {
$oids[] = $r->owner_id;
$mids[] = $r->mid;
$bids[] = $r->brand_id;
$sids[] = $r->series_id;
}
}
$status = Yii::$app->params['CommonStatus'];
$AcCarOwner = new AcCarOwner();
$where = [];
$where['pid'] = $pid;
$_owners = $AcCarOwner->find()->where($where)->andwhere(['in', 'id', $oids])->all();
$owners = [];
foreach ($_owners as $s) {
$owners[$s->id] = $s->toArray();
}
$User = new User();
$where = [];
$_users = $User->find()->where($where)->andwhere(['in', 'id', $mids])->all();
$users = [];
foreach ($_users as $s) {
$users[$s->id] = $s->toArray();
}
$AcUserExt = new AcUserExt();
$userExts = $AcUserExt->find()->where(['pid' => $pid, 'deleted' => 0])->andWhere(['in', 'mid', $mids])->all();
$exts = [];
if ($userExts) {
foreach ($userExts as $v) {
$exts[$v->mid][$v->key] = $v->value;
}
foreach ($exts as $i => $ext) {
$_owner = $users[$i] ? $users[$i] : [];
if ($ext['title']) {
$_owner['owner_title'] = $ext['title'];
}
if ($ext['nickname']) {
$_owner['owner_title'] = $ext['nickname'];
}
if ($ext['realname']) {
$_owner['owner_title'] = $ext['realname'];
}
$users[$i]['username'] = $_owner['owner_title'] . '【' . $users[$i]['mobile'] . '】';
}
}
$AcCarSeries = new AcCarSeries();
$where = [];
$series = [];
$_series = $AcCarSeries->find()->where($where)->andwhere(['in', 'id', $sids])->all();
if ($_series) {
foreach ($_series as $r) {
$series[$r->id] = $r->toArray();
}
}
$AcCarBrand = new AcCarBrand();
$where = [];
$_brands = $AcCarBrand->find()->where($where)->andwhere(['in', 'id', $bids])->all();
if ($_brands) {
foreach ($_brands as $r) {
$brands[$r->id] = $r->toArray();
}
}
$cars = [];
if ($res) {
foreach ($res as $r) {
$car = $r->toArray();
$t = '';
if (isset($series[$r->series_id]['title'])) {
$t .= $brands[$r->brand_id]['title'];
}
$t .= '-';
if (isset($series[$r->series_id]['title'])) {
$t .= $series[$r->series_id]['title'];
}
$car['title2'] = $t;
$car['numbers'] = $car['num_p'] . $car['num_area'] . $car['num_left'];
$car['numbers'] = $car['numbers'] ? $car['numbers'] : $car['num_frame'];
$cars[$r->id] = $car;
}
}
$callback = !empty(Yii::$app->request->get('callback')) ? Yii::$app->request->get('callback') : 'truck';
return $this->render('select', [
'cars' => $cars,
'pager' => $pages,
'owners' => $owners,
'users' => $users,
'status' => $status,
'search' => $search,
'callback' => $callback
]);
}
public function actionNew()
{
$status = Yii::$app->params['CommonStatus'];
$AcCar = new AcCar();
$AcCar->status_code = 0;
return $this->render('modify', ['status' => $status, 'detail' => $AcCar]);
}
//编辑客车资料
public function actionEdit()
/*
* 数据更新前的预检查,返回对应关联数据
* 必须确保get与post数据中均包含需更新的数据id且一致
* */
private function preUpdate()
{
$id = (int)Yii::$app->request->get('id');
if(!$id) $this->result('请求错误,未携带ID参数');
$post = $this->postdata;
if($post['id'] != $id) $this->result('传参id与请求数据不匹配',[],403);
$model = new AcCar();
$id = Yii::$app->request->get('id');
$res = $model->find()->where(['id' => $id])->one();
if ($res) {
$res = $res->toArray();
}
$pid = Yii::$app->session->get('pid');
$AcCarOwner = new AcCarOwner();
$owner = $AcCarOwner->find()->where(['id' => $res['owner_id']])->one();
if ($owner) {
$mid = $owner->mid;
$User = new User();
$user = $User->find()->where(['id' => $mid])->one();
if ($user) {
$res['owner_title'] = $user->username . '【' . $user->mobile . '】';
}
$AcUserExt = new AcUserExt();
$userExt = $AcUserExt->find()->where(['pid' => $pid, 'mid' => $res['mid'], 'deleted' => 0])->all();
$exts = [];
if ($userExt) {
foreach ($userExt as $v) {
$exts[$v->key] = $v->value;
}
if ($exts['title']) {
$res['owner_title'] = $exts['title'];
}
if ($exts['nickname']) {
$res['owner_title'] = $exts['nickname'];
}
if ($exts['realname']) {
$res['owner_title'] = $exts['realname'];
}
$res['owner_title'] = $res['owner_title'] . '【' . $user->mobile . '】';
}
}
$AcCarSeries = new AcCarSeries();
$series = $AcCarSeries->find()->where(['id' => $res['series_id']])->one();
if ($series) {
$res['series_title'] = $series->title;
}
$AcCarBrand = new AcCarBrand();
$brand = $AcCarBrand->find()->where(['id' => $res['brand_id']])->one();
if ($brand) {
$res['brand_title'] = $brand->title;
}
$status = Yii::$app->params['CommonStatus'];
return $this->render('modify', ['status' => $status, 'detail' => $res]);
$res = $model->findOne($id);
if(!$res) $this->result('未查询到相应数据',[],404);
return $res;
}
//复制客车资料后新建
public function actionCopy()
{
$model = new AcCar();
$id = Yii::$app->request->get('id');
$res = $model->find()->where(['id' => $id])->one();
if ($res) {
$res = $res->toArray();
}
$pid = Yii::$app->session->get('pid');
$AcCarSeries = new AcCarSeries();
$series = $AcCarSeries->find()->where(['id' => $res['series_id']])->one();
if ($series) {
$res['series_title'] = $series->title;
}
$AcCarBrand = new AcCarBrand();
$brand = $AcCarBrand->find()->where(['id' => $res['brand_id']])->one();
if ($brand) {
$res['brand_title'] = $brand->title;
}
$status = Yii::$app->params['CommonStatus'];
$res['id'] = 0;
$res['num_p'] = $res['num_area'] = $res['num_left'] = $res['num_frame'] = '';
return $this->render('modify', ['status' => $status, 'detail' => $res]);
}
//浏览客车详情
public function actionDetail()
{
$model = new AcCar();
$id = Yii::$app->request->get('id');
$res = $model->find()->where(['id' => $id])->one();
if ($res) {
$res = $res->toArray();
}
$pid = Yii::$app->session->get('pid');
$AcCarOwner = new AcCarOwner();
$owner = $AcCarOwner->find()->where(['id' => $res['owner_id']])->one();
$User = new User();
$user = $User->find()->where(['id' => $res['mid']])->one();
if ($user) {
$res['owner_title'] = $user->username . '【' . $user->mobile . '】';
}
$AcUserExt = new AcUserExt();
$userExt = $AcUserExt->find()->where(['pid' => $pid, 'mid' => $res['mid'], 'deleted' => 0])->all();
$exts = [];
if ($userExt) {
foreach ($userExt as $v) {
$exts[$v->key] = $v->value;
}
if ($exts['title']) {
$res['owner_title'] = $exts['title'];
}
if ($exts['nickname']) {
$res['owner_title'] = $exts['nickname'];
}
if ($exts['realname']) {
$res['owner_title'] = $exts['realname'];
}
$res['owner_title'] = $res['owner_title'] . '【' . $user->mobile . '】';
}
$AcCarSeries = new AcCarSeries();
$series = $AcCarSeries->find()->where(['id' => $res['series_id']])->one();
if ($series) {
$res['series_title'] = $series->title;
}
$AcCarBrand = new AcCarBrand();
$brand = $AcCarBrand->find()->where(['id' => $res['brand_id']])->one();
if ($brand) {
$res['brand_title'] = $brand->title;
}
$status = Yii::$app->params['CommonStatus'];
return $this->render('detail', ['status' => $status, 'detail' => $res]);
}
//保存车辆资料
public function actionSave()
{
$post = Yii::$app->request->post();
$id = (int)$post['id'];
$pid = Yii::$app->session->get('pid');
/*
* 数据保存前的预检查(查重、参数校验等)
* 要保存的数据[],直接从post中取出
* @op,操作类型(add,edit……)
* 校验机制:
* 编辑数据时,必须用get方式传入参数id,并与post进来的数据id进行比对,只有一致时才能继续;
* 查重:禁止录入重复数据
* 返回:校验重组后的数据
* */
private function preSave($op)
{
$post = $this->postdata;
$car_no = trim($post['car_no']) ?? '';//车牌号
$num_frame = trim($post['num_frame']) ?? '';//车架号
if(!$car_no && !$num_frame) $this->result('请传入车牌/架号');
$data = [];
//格式化数据
//目标键=》POST键
$cols = ['title' => 'title', 'num_frame' => 'num_frame', 'num_p' => 'num_p', 'num_area' => 'num_area', 'num_left' => 'num_left'];
$cols = ['title' => 'title', 'num_frame' => 'num_frame', 'num_p' => 'num_p', 'num_area' => 'num_area', 'num_left' => 'num_left','car_no'=>'car_no'];
foreach ($cols as $col => $key) {
$data[$col] = isset($post[$key]) ? trim($post[$key]) : '';
}
//查询车牌号是否在库
$hasCar = FALSE;
if (!$data['num_frame']) {
$hasCar = AcCar::find()->where(['num_p' => $data['num_p'], 'num_area' => $data['num_area'], 'num_left' => $data['num_left']])->one();
}
if ($hasCar) {
if ($id && $id != $hasCar->id) {
\Yii::$app->getSession()->setFlash('danger', '保存失败,该车牌号已在库!');
return $this->goBack();
} else {
$id = $hasCar->id;
}
$model = new AcCar();
switch ($op) {
case 'add':
if(!$num_frame){
$error = "车牌号已存在";
$hasOne = $model->find()->where(['deleted'=>0,'pid'=>$this->pid,'car_no'=>$car_no])->one();
}else{
$error = "车架/牌号已存在";
$hasOne = $model->find()->where(['deleted'=>0,'pid'=>$this->pid])->andWhere(['OR',['LIKE', 'car_no', $car_no],['LIKE', 'num_frame', $num_frame]])->one();
}
if ($hasOne) {
$this->result($error);
}
$data['create_at'] = time();
$data['update_at'] = $data['create_at'];
break;
case 'edit':
$id = (int)Yii::$app->request->get('id');
$_id = (int)$post['id'];
if(!$id != $_id) $this->result('id参数不匹配,请检查');
$hasOne = $model->find()->select('id')->where(['car_no'=>$car_no,'id'<>$id,'pid'=>$this->pid,'deleted'=>0])->indexBy('id')->one();
if ($hasOne) {
$this->result('车牌号重复,请检查');
}
$data['update_at'] = time();
break;
}
$data['pid'] = $this->pid;
$cols = ['brand_id' => 'brand_id', 'series_id' => 'series_id', 'owner_id' => 'owner_id', 'status_code' => 'status_code', 'deleted' => 'deleted'];
foreach ($cols as $col => $key) {
$data[$col] = isset($post[$key]) ? (int)$post[$key] : 0;
@@ -474,131 +353,55 @@
foreach ($cols as $col => $key) {
$data[$col] = isset($post[$key]) ? htmlspecialchars($post[$key]) : '';
}
$data['create_at'] = time();
$data['update_at'] = $data['create_at'];
// $data['status_code'] = 1;
$data['pid'] = $pid;
//填补mid参数
if($data['owner_id']){
$AcCarOwner = new AcCarOwner();
$owner = $AcCarOwner->findOne($data['owner_id']);
if ($owner) {
$data['mid'] = $owner->mid;
}
}
return $data;
}
//格式化显示车辆信息 @car 车辆信息原始数据 []
private function showCar($car){
$oid = $car['owner_id'];
$mid = $car['mid'];
$bid = $car['brand_id'];
$sid = $car['series_id'];
$AcCarSeries = new AcCarSeries();
$series = $AcCarSeries->findOne($sid);
$car['series'] = $series;
$AcCarBrand = new AcCarBrand();
$brand = $AcCarBrand->findOne($bid);
$car['brand'] = $brand;
$AcCarOwner = new AcCarOwner();
$owner = $AcCarOwner->findOne($data['owner_id']);
if ($owner) {
$data['mid'] = $owner->mid;
}
$owner = $AcCarOwner->findOne($oid);
$car['owner'] = $owner;
//保存车辆资料
$AcCar = new AcCar();
foreach ($data as $key => $val) {
$AcCar->$key = $val;
$CUser = new User();
$user = $CUser->findOne($mid)->toArray();
$AcUserExt = new AcUserExt();
$userExts = $AcUserExt->find()->where(['pid' => $this->pid, 'deleted' => 0,'mid'=>$mid])->all();
$ext = [];
foreach ($userExts as $v) {
$ext[$v->key] = $v->value;
}
if ($id) {
$AcCar->id = $id;
unset($data['create_at']);
$res = $AcCar->updateAll($data, ['id' => $id]);
} else {
$res = $AcCar->save();
$id = $AcCar->attributes['id']; //获取插入后id
if ($ext['title']) {
$user['owner_title'] = $ext['title'];
}
if ($res) {
\Yii::$app->getSession()->setFlash('success', '车辆资料保存成功!');
return $this->redirect(['edit', 'id' => $id]);
} else {
\Yii::$app->getSession()->setFlash('warning', '车辆资料保存失败!');
return $this->goBack();
if ($ext['nickname']) {
$user['owner_title'] = $ext['nickname'];
}
}
//删除车辆
public function actionDelete()
{
$get = Yii::$app->request->get();
$post = Yii::$app->request->post();
$id = (int)$get['id'];
$data = $where = [];
$where['pid'] = Yii::$app->session->get('pid');
$where['id'] = $id;
$data['update_at'] = time();
$data['deleted'] = 1;
$model = new AcCar();
foreach ($data as $key => $val) {
$model->$key = $val;
if ($ext['realname']) {
$user['owner_title'] = $ext['realname'];
}
$car['user'] = $user;
$model->id = $id;
$res = $model->updateAll($data, $where);
$return = [];
$return['url'] = Url::toRoute('car/list');
$return['timeout'] = 3; //3秒后自动跳转
$return['status'] = 0;
if ($res) {
$return['msg'] = '车辆删除成功';
$return['errorcode'] = 200;
$return['data'] = $id;
} else {
$return['msg'] = '车辆删除失败';
$return['errorcode'] = 0;
}
exit(json_encode($return, JSON_UNESCAPED_UNICODE));
}
public function actionAjax()
{
$get = Yii::$app->request->get();
$post = Yii::$app->request->post();
$id = (int)$get['id'];
$data = $where = [];
$where['pid'] = Yii::$app->session->get('pid');
$where['id'] = $id;
$data['update_at'] = time();
$model = new AcCar();
$res = $model->find()->where(['id' => $id])->one();
$return = [];
$return['timeout'] = 1; //3秒后自动跳转
// $return['status_code'] = 0;
$return['ajax'] = 1;
if ($res) {
$res = $res->toArray();
} else {
$return['msg'] = '车辆数据不存在';
$return['errorcode'] = 404;
exit(json_encode($return, JSON_UNESCAPED_UNICODE));
}
switch ($get['do']) {
case 'hide':
$data['status_code'] = 0;
$model->id = $id;
$res = $model->updateAll($data, $where);
if ($res) {
$return['msg'] = '车辆隐藏标记成功';
$return['errorcode'] = 200;
$return['data'] = ['css' => 'default'];
} else {
$return['msg'] = '车辆隐藏标记失败';
$return['errorcode'] = 0;
}
break;
case 'show':
$data['status_code'] = 1;
$model->id = $id;
$res = $model->updateAll($data, $where);
if ($res) {
$return['msg'] = '车辆显示记成功';
$return['errorcode'] = 200;
$return['data'] = ['css' => 'primary'];
} else {
$return['msg'] = '车辆显示标记失败';
$return['errorcode'] = 0;
}
break;
default:
break;
}
exit(json_encode($return, JSON_UNESCAPED_UNICODE));
$car['numbers'] = $car['num_p'] . $car['num_area'] . $car['num_left'];
$car['numbers'] = $car['num_p'] ? $car['numbers'] : $car['num_frame'];
return $car;
}
}