feat : basic
This commit is contained in:
@@ -13,7 +13,7 @@ namespace App\Service\Admin\System;
|
||||
use App\Cache\Redis\Common\CommonRedisKey;
|
||||
use App\Cache\Redis\RedisCache;
|
||||
use App\Constants\Common\SiteCode;
|
||||
use App\Exception\AdminException;
|
||||
use App\Exception\ErrException;
|
||||
use App\Model\Kitchen;
|
||||
use App\Model\Site;
|
||||
use App\Model\SystemCity;
|
||||
@@ -94,7 +94,7 @@ class KitchenService extends BaseService
|
||||
$name = $this->request->input('name');
|
||||
|
||||
$info = $this->kitchenModel->getInfoByName($name);
|
||||
if (!empty($info)) throw new AdminException('数据已存在');
|
||||
if (!empty($info)) throw new ErrException('数据已存在');
|
||||
|
||||
$model = new Kitchen();
|
||||
|
||||
@@ -105,7 +105,7 @@ class KitchenService extends BaseService
|
||||
$model->lat = $this->request->input('lat');
|
||||
$model->status = $this->request->input('status');
|
||||
|
||||
if (!$model->save()) throw new AdminException('添加失败');
|
||||
if (!$model->save()) throw new ErrException('添加失败');
|
||||
|
||||
// if ($model->status == SiteCode::KITCHEN_ENABLE) {
|
||||
// $this->setSiteCache(SiteCode::KITCHEN_REDIS_PREFIX.$model->id,$model->lng,$model->lat);
|
||||
@@ -124,10 +124,10 @@ class KitchenService extends BaseService
|
||||
$status = (int)$this->request->input('status');
|
||||
|
||||
$info = $this->kitchenModel->getInfoById($id);
|
||||
if (empty($info)) throw new AdminException('数据不存在');
|
||||
if (empty($info)) throw new ErrException('数据不存在');
|
||||
|
||||
$name = $this->kitchenModel->getInfoByName($name);
|
||||
if ($name->id != $info->id) throw new AdminException('数据已存在');
|
||||
if ($name->id != $info->id) throw new ErrException('数据已存在');
|
||||
|
||||
if ($info->status == SiteCode::KITCHEN_ENABLE && $status == SiteCode::KITCHEN_DISABLE) {
|
||||
$this->siteModel->disableStatusByKitchenId($info->id);
|
||||
@@ -139,7 +139,7 @@ class KitchenService extends BaseService
|
||||
$info->lat = $this->request->input('lat');
|
||||
$info->status = $status;
|
||||
|
||||
if (!$info->save()) throw new AdminException('修改失败');
|
||||
if (!$info->save()) throw new ErrException('修改失败');
|
||||
|
||||
return $this->return->success();
|
||||
}
|
||||
@@ -153,13 +153,13 @@ class KitchenService extends BaseService
|
||||
$id = (int)$this->request->input('id');
|
||||
|
||||
$info = $this->kitchenModel->getInfoById($id);
|
||||
if (empty($info)) throw new AdminException('数据不存在');
|
||||
if (empty($info)) throw new ErrException('数据不存在');
|
||||
|
||||
$this->siteModel->disableStatusByKitchenId($info->id);
|
||||
|
||||
$info->is_del = SiteCode::SITE_DEL;
|
||||
|
||||
if (!$info->save()) throw new AdminException('删除失败');
|
||||
if (!$info->save()) throw new ErrException('删除失败');
|
||||
|
||||
return $this->return->success();
|
||||
}
|
||||
@@ -171,7 +171,7 @@ class KitchenService extends BaseService
|
||||
{
|
||||
$data = $this->kitchenModel
|
||||
->getInfoById((int)$this->request->input('id'));
|
||||
if (empty($data)) throw new AdminException('数据不存在');
|
||||
if (empty($data)) throw new ErrException('数据不存在');
|
||||
|
||||
$res = [
|
||||
'id' => $data->id,
|
||||
|
||||
Reference in New Issue
Block a user