正在显示
1 个修改的文件
包含
14 行增加
和
3 行删除
| @@ -2,7 +2,9 @@ | @@ -2,7 +2,9 @@ | ||
| 2 | 2 | ||
| 3 | namespace App\Http\Logic\Aside\User; | 3 | namespace App\Http\Logic\Aside\User; |
| 4 | 4 | ||
| 5 | +use App\Helper\Common; | ||
| 5 | use App\Http\Logic\Aside\BaseLogic; | 6 | use App\Http\Logic\Aside\BaseLogic; |
| 7 | +use App\Models\Project\Project; | ||
| 6 | use App\Models\User\User; | 8 | use App\Models\User\User; |
| 7 | 9 | ||
| 8 | class UserLogic extends BaseLogic | 10 | class UserLogic extends BaseLogic |
| @@ -22,10 +24,16 @@ class UserLogic extends BaseLogic | @@ -22,10 +24,16 @@ class UserLogic extends BaseLogic | ||
| 22 | * @method | 24 | * @method |
| 23 | */ | 25 | */ |
| 24 | public function user_info(){ | 26 | public function user_info(){ |
| 25 | - $info = $this->model->read($this->param,['id','project_id','name','status','mobile','operator_id']); | ||
| 26 | - if($info === false){ | ||
| 27 | - $this->fail('当前数据不存在'); | 27 | + $info = Common::get_user_cache($this->model,$this->param['id'],'A'); |
| 28 | + if(empty($info)){ | ||
| 29 | + $info = $this->model->read($this->param,['id','project_id','name','status','mobile','operator_id']); | ||
| 30 | + if($info === false){ | ||
| 31 | + $this->fail('当前数据不存在'); | ||
| 32 | + } | ||
| 33 | + $info['operator_name'] = (new User())->read(['id'=>$info['operator_id']],['name'])['name']; | ||
| 34 | + $info['project_name'] = (new Project())->read(['id'=>$info['project_id']],['title'])['title']; | ||
| 28 | } | 35 | } |
| 36 | + Common::set_user_cache($info,$this->model,$this->param['id'],'A'); | ||
| 29 | return $this->success($info); | 37 | return $this->success($info); |
| 30 | } | 38 | } |
| 31 | /** | 39 | /** |
| @@ -63,6 +71,7 @@ class UserLogic extends BaseLogic | @@ -63,6 +71,7 @@ class UserLogic extends BaseLogic | ||
| 63 | if($rs === false){ | 71 | if($rs === false){ |
| 64 | $this->fail('编辑失败'); | 72 | $this->fail('编辑失败'); |
| 65 | } | 73 | } |
| 74 | + Common::del_user_cache($this->model,$this->param['id'],'A'); | ||
| 66 | return $this->success(); | 75 | return $this->success(); |
| 67 | } | 76 | } |
| 68 | 77 | ||
| @@ -73,11 +82,13 @@ class UserLogic extends BaseLogic | @@ -73,11 +82,13 @@ class UserLogic extends BaseLogic | ||
| 73 | * @method | 82 | * @method |
| 74 | */ | 83 | */ |
| 75 | public function user_del(){ | 84 | public function user_del(){ |
| 85 | + $ids = $this->param['id']; | ||
| 76 | $this->param['id'] = ['in',$this->param['id']]; | 86 | $this->param['id'] = ['in',$this->param['id']]; |
| 77 | $rs = $this->model->del($this->param); | 87 | $rs = $this->model->del($this->param); |
| 78 | if($rs === false){ | 88 | if($rs === false){ |
| 79 | $this->fail('删除失败'); | 89 | $this->fail('删除失败'); |
| 80 | } | 90 | } |
| 91 | + Common::del_user_cache($this->model,$ids,'A'); | ||
| 81 | return $this->success(); | 92 | return $this->success(); |
| 82 | } | 93 | } |
| 83 | 94 |
-
请 注册 或 登录 后发表评论