作者 lyh

gx

@@ -82,8 +82,8 @@ class ManageController extends BaseController @@ -82,8 +82,8 @@ class ManageController extends BaseController
82 ],[ 82 ],[
83 'ids.required' => 'ID不能为空' 83 'ids.required' => 'ID不能为空'
84 ]); 84 ]);
85 - $logic->delete($this->param['ids']);  
86 - $this->response('success'); 85 + $logic->managerDelete();
  86 + $this->response('删除成功');
87 } 87 }
88 88
89 /** 89 /**
@@ -287,7 +287,7 @@ class FileController @@ -287,7 +287,7 @@ class FileController
287 $fileModel = new File(); 287 $fileModel = new File();
288 $lists = $fileModel->list($this->map,'id',['id','hash','type','path','created_at']); 288 $lists = $fileModel->list($this->map,'id',['id','hash','type','path','created_at']);
289 foreach ($lists as $k => $v){ 289 foreach ($lists as $k => $v){
290 - $v['file_link'] = getFileUrl($v['hash']); 290 + $v['file_link'] = getFileUrl($v['path']);
291 $lists[$k] = $v; 291 $lists[$k] = $v;
292 } 292 }
293 $this->response('success',Code::SUCCESS,$lists); 293 $this->response('success',Code::SUCCESS,$lists);
@@ -354,7 +354,7 @@ class ImageController extends Controller @@ -354,7 +354,7 @@ class ImageController extends Controller
354 $lists = $imageModel->lists($this->map,$this->page,$this->row); 354 $lists = $imageModel->lists($this->map,$this->page,$this->row);
355 if(!empty($lists) && !empty($lists['list'])){ 355 if(!empty($lists) && !empty($lists['list'])){
356 foreach ($lists['list'] as $k => $v){ 356 foreach ($lists['list'] as $k => $v){
357 - $v['image_link'] = getImageUrl($v['hash']); 357 + $v['image_link'] = getImageUrl($v['path']);
358 $lists['list'][$k] = $v; 358 $lists['list'][$k] = $v;
359 } 359 }
360 } 360 }
@@ -3,9 +3,11 @@ @@ -3,9 +3,11 @@
3 namespace App\Http\Logic\Aside\Manage; 3 namespace App\Http\Logic\Aside\Manage;
4 4
5 5
  6 +use App\Helper\Common;
6 use App\Http\Logic\Aside\BaseLogic; 7 use App\Http\Logic\Aside\BaseLogic;
7 use App\Models\Manage\Manage; 8 use App\Models\Manage\Manage;
8 use App\Models\Manage\Menu; 9 use App\Models\Manage\Menu;
  10 +use Illuminate\Support\Facades\Cache;
9 use Illuminate\Support\Facades\Hash; 11 use Illuminate\Support\Facades\Hash;
10 12
11 /** 13 /**
@@ -31,18 +33,21 @@ class ManageLogic extends BaseLogic @@ -31,18 +33,21 @@ class ManageLogic extends BaseLogic
31 * @time :2023/9/11 9:34 33 * @time :2023/9/11 9:34
32 */ 34 */
33 public function managerSave(){ 35 public function managerSave(){
34 - if(isset($this->param['id']) && !empty($this->param['id'])){  
35 - if(isset($this->param['password']) && !empty($this->param['password'])){ 36 + try {
  37 + if(isset($this->param['id']) && !empty($this->param['id'])){
  38 + if(isset($this->param['password']) && !empty($this->param['password'])){
  39 + $this->param['password'] = Hash::make($this->param['password']);
  40 + }
  41 + $this->model->edit($this->param,['id'=>$this->param['id']]);
  42 + Common::del_user_cache('manager',$this->param['id'],'A');
  43 + }else{
36 $this->param['password'] = Hash::make($this->param['password']); 44 $this->param['password'] = Hash::make($this->param['password']);
  45 + $this->model->add($this->param);
37 } 46 }
38 - $rs = $this->model->edit($this->param,['id'=>$this->param['id']]);  
39 - }else{  
40 - $this->param['password'] = Hash::make($this->param['password']);  
41 - $rs = $this->model->add($this->param);  
42 - }  
43 - if($rs === false){  
44 - $this->fail('error'); 47 + }catch (\Exception $e){
  48 + $this->fail('系统错误,请联系管理员');
45 } 49 }
  50 +
46 return $this->success(); 51 return $this->success();
47 } 52 }
48 53
@@ -70,13 +75,31 @@ class ManageLogic extends BaseLogic @@ -70,13 +75,31 @@ class ManageLogic extends BaseLogic
70 * @time :2023/8/28 16:10 75 * @time :2023/8/28 16:10
71 */ 76 */
72 public function getManagerInfo(){ 77 public function getManagerInfo(){
73 - $info = $this->model->read(['id'=>$this->param['id']],  
74 - ['id','name','email','mobile','status','gid','sort','dept_id','is_dept_manager','created_at','role','updated_at']);  
75 - if($info === false){  
76 - $this->fail('error'); 78 + $info = Common::get_user_cache('manager',$this->param['id'],'A');
  79 + if(empty($info)){
  80 + $info = $this->model->read(['id'=>$this->param['id']],
  81 + ['id','name','email','mobile','status','gid','sort','dept_id','is_dept_manager','created_at','role','updated_at']);
  82 + if($info === false){
  83 + $this->fail('error');
  84 + }
  85 + Common::set_user_cache('manager',$this->param['id'],'A');
77 } 86 }
78 return $this->success($info); 87 return $this->success($info);
79 } 88 }
80 89
81 - 90 + /**
  91 + * @remark :删除
  92 + * @name :managerDelete
  93 + * @author :lyh
  94 + * @method :post
  95 + * @time :2023/9/15 10:45
  96 + */
  97 + public function managerDelete(){
  98 + $rs = $this->model->del(['id'=>['in',$this->param['ids']]]);
  99 + if($rs === false){
  100 + $this->fail('系统错误,请联系管理员');
  101 + }
  102 + Common::del_user_cache('manager',$this->param['ids'],'A');
  103 + return $this->success();
  104 + }
82 } 105 }
@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 namespace App\Models\Manage; 3 namespace App\Models\Manage;
4 4
5 use App\Models\Base; 5 use App\Models\Base;
  6 +use Illuminate\Support\Facades\Cache;
6 7
7 class Manage extends Base 8 class Manage extends Base
8 { 9 {
@@ -36,7 +37,7 @@ class Manage extends Base @@ -36,7 +37,7 @@ class Manage extends Base
36 */ 37 */
37 public function getName($id){ 38 public function getName($id){
38 $name = ''; 39 $name = '';
39 - $info = $this->read(['id'=>$id]); 40 + $info = $this->read(['id'=>$id],['id','name']);
40 if($info !== false){ 41 if($info !== false){
41 $name = $info['name']; 42 $name = $info['name'];
42 } 43 }