feat : basic
This commit is contained in:
@@ -12,7 +12,7 @@ namespace App\Service\Admin\System;
|
||||
|
||||
use App\Cache\Redis\Common\CityCache;
|
||||
use App\Constants\Common\CityCode;
|
||||
use App\Exception\AdminException;
|
||||
use App\Exception\ErrException;
|
||||
use App\Model\SystemCity;
|
||||
use App\Model\SystemCityConfig;
|
||||
use App\Service\Admin\BaseService;
|
||||
@@ -78,9 +78,9 @@ class CityService extends BaseService
|
||||
$cityId = (int)$this->request->input('city_id');
|
||||
|
||||
$info = $this->systemCityConfigModel->getAddressByIdAndPid($cityId,$provinceId);
|
||||
if (empty($info)) throw new AdminException('城市选择错误');
|
||||
if (empty($info)) throw new ErrException('城市选择错误');
|
||||
|
||||
if ($this->systemCityModel->getInfoByCityId($cityId)) throw new AdminException('城市已存在');
|
||||
if ($this->systemCityModel->getInfoByCityId($cityId)) throw new ErrException('城市已存在');
|
||||
|
||||
$model = new SystemCity();
|
||||
|
||||
@@ -90,7 +90,7 @@ class CityService extends BaseService
|
||||
$model->status = $this->request->input('status', 1);
|
||||
$model->is_del = 1;
|
||||
|
||||
if (!$model->save()) throw new AdminException('添加失败');
|
||||
if (!$model->save()) throw new ErrException('添加失败');
|
||||
|
||||
return $this->return->success();
|
||||
}
|
||||
@@ -101,11 +101,11 @@ class CityService extends BaseService
|
||||
|
||||
$model = $this->systemCityModel->getInfoById($id);
|
||||
|
||||
if (!$model) throw new AdminException('数据不存在');
|
||||
if (!$model) throw new ErrException('数据不存在');
|
||||
|
||||
$model->status = $model->status == CityCode::STATUS_ENABLE ? CityCode::STATUS_DISABLE : CityCode::STATUS_ENABLE;
|
||||
|
||||
if (!$model->save()) throw new AdminException('修改失败');
|
||||
if (!$model->save()) throw new ErrException('修改失败');
|
||||
|
||||
return $this->return->success();
|
||||
}
|
||||
@@ -119,11 +119,11 @@ class CityService extends BaseService
|
||||
|
||||
$model = $this->systemCityModel->getInfoById($id);
|
||||
|
||||
if (!$model) throw new AdminException('数据不存在');
|
||||
if (!$model) throw new ErrException('数据不存在');
|
||||
|
||||
$model->is_del = CityCode::IS_DELETE;
|
||||
|
||||
if (!$model->save()) throw new AdminException('删除失败');
|
||||
if (!$model->save()) throw new ErrException('删除失败');
|
||||
|
||||
return $this->return->success();
|
||||
}
|
||||
@@ -140,7 +140,7 @@ class CityService extends BaseService
|
||||
|
||||
$info = $this->systemCityModel->getInfoById($id);
|
||||
|
||||
if (!$info) throw new AdminException('数据不存在');
|
||||
if (!$info) throw new ErrException('数据不存在');
|
||||
|
||||
$allInfo = $this->cityCache->getCityList();
|
||||
$allInfo = array_column($allInfo,'title','id');
|
||||
|
||||
Reference in New Issue
Block a user