feat : basic
This commit is contained in:
@@ -11,7 +11,7 @@ declare(strict_types=1);
|
||||
namespace App\Service\Admin\User;
|
||||
|
||||
use App\Cache\Redis\Admin\SectionCache;
|
||||
use App\Exception\AdminException;
|
||||
use App\Exception\ErrException;
|
||||
use App\Model\AdminSection;
|
||||
use App\Model\AdminUser;
|
||||
use App\Service\Admin\BaseService;
|
||||
@@ -76,7 +76,7 @@ class SectionService extends BaseService
|
||||
$model->remark = $this->request->input('remark');
|
||||
$model->status = $this->request->input('status',1);
|
||||
|
||||
if (!$model->save()) throw new AdminException('添加失败');
|
||||
if (!$model->save()) throw new ErrException('添加失败');
|
||||
|
||||
$this->sectionCache->delList();
|
||||
|
||||
@@ -94,7 +94,7 @@ class SectionService extends BaseService
|
||||
$id = (int)$this->request->input('id');
|
||||
|
||||
$info = $this->adminSectionModel->getInfoById($id);
|
||||
if (empty($info)) throw new AdminException('数据不存在');
|
||||
if (empty($info)) throw new ErrException('数据不存在');
|
||||
|
||||
$info->name = $this->request->input('name');
|
||||
$info->pid = $this->request->input('pid',0);
|
||||
@@ -102,7 +102,7 @@ class SectionService extends BaseService
|
||||
$info->remark = $this->request->input('remark');
|
||||
$info->status = $this->request->input('status',1);
|
||||
|
||||
if (!$info->save()) throw new AdminException('修改失败');
|
||||
if (!$info->save()) throw new ErrException('修改失败');
|
||||
$this->sectionCache->delList();
|
||||
return $this->return->success();
|
||||
}
|
||||
@@ -118,10 +118,10 @@ class SectionService extends BaseService
|
||||
$id = (int)$this->request->input('id');
|
||||
|
||||
$info = $this->adminSectionModel->getInfoById($id);
|
||||
if (empty($info)) throw new AdminException('数据不存在');
|
||||
if (empty($info)) throw new ErrException('数据不存在');
|
||||
|
||||
$children = $this->adminSectionModel->getInfoByPid($info->id);
|
||||
if (empty($children)) throw new AdminException('请先删除下级数据');
|
||||
if (empty($children)) throw new ErrException('请先删除下级数据');
|
||||
|
||||
$this->adminUserModel->where('section_id',$id)->update(['section_id'=>0]);
|
||||
|
||||
@@ -138,7 +138,7 @@ class SectionService extends BaseService
|
||||
$id = (int)$this->request->input('id');
|
||||
|
||||
$info = $this->adminSectionModel->getInfoById($id);
|
||||
if (empty($info)) throw new AdminException('数据不存在');
|
||||
if (empty($info)) throw new ErrException('数据不存在');
|
||||
|
||||
return $this->return->success('success',$info->toArray());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user