作者 赵彬吉

Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6 into develop

@@ -21,6 +21,9 @@ class ProjectDeptController extends BaseController @@ -21,6 +21,9 @@ class ProjectDeptController extends BaseController
21 * @time :2023/6/17 16:13 21 * @time :2023/6/17 16:13
22 */ 22 */
23 public function lists(DeptLogic $deptLogic){ 23 public function lists(DeptLogic $deptLogic){
  24 + if(isset($this->param['pid'])){
  25 + $this->map['pid'] = $this->param['pid'];
  26 + }
24 if(isset($this->map['title']) && !empty($this->map['title'])){ 27 if(isset($this->map['title']) && !empty($this->map['title'])){
25 $this->map['title'] = ['like','%'.$this->map['title'].'%']; 28 $this->map['title'] = ['like','%'.$this->map['title'].'%'];
26 } 29 }
@@ -28,6 +28,13 @@ class ProjectMenuController extends BaseController @@ -28,6 +28,13 @@ class ProjectMenuController extends BaseController
28 */ 28 */
29 public function lists(){ 29 public function lists(){
30 $menuModel = new ProjectMenuModel(); 30 $menuModel = new ProjectMenuModel();
  31 + if(isset($this->param['pid'])){
  32 + $this->map['pid'] = $this->param['pid'];
  33 + }
  34 + //是否为权限菜单
  35 + if(isset($this->param['is_role'])){
  36 + $this->map['is_role'] = $this->param['is_role'];
  37 + }
31 $lists = $menuModel->lists($this->map,$this->page,$this->row,$this->order,['*']); 38 $lists = $menuModel->lists($this->map,$this->page,$this->row,$this->order,['*']);
32 $this->response('success',Code::SUCCESS,$lists); 39 $this->response('success',Code::SUCCESS,$lists);
33 } 40 }
@@ -170,7 +170,7 @@ class BaseController extends Controller @@ -170,7 +170,7 @@ class BaseController extends Controller
170 case 'operator_id': 170 case 'operator_id':
171 if(!empty($v)){ 171 if(!empty($v)){
172 $name = (new UserModel())->read(['id'=>$v],['id','name']); 172 $name = (new UserModel())->read(['id'=>$v],['id','name']);
173 - $data['operator_name'] = (isset($name['name']) && !empty($name['name'])) ? $name['name'] : '无名称'; 173 + $data['operator_name'] = (isset($name['name']) && !empty($name['name'])) ? $name['name'] : '管理员';
174 } 174 }
175 break; 175 break;
176 } 176 }
@@ -92,15 +92,7 @@ class ProjectMenuLogic extends BaseLogic @@ -92,15 +92,7 @@ class ProjectMenuLogic extends BaseLogic
92 * @time :2023/6/21 17:26 92 * @time :2023/6/21 17:26
93 */ 93 */
94 public function MenuList(){ 94 public function MenuList(){
95 - $lists = $this->model->list(['status'=>$this->model::ZERO,'is_role'=>$this->model::ZERO]);  
96 - $menu = array();  
97 - foreach ($lists as $v){  
98 - $v = (array)$v;  
99 - if ($v['pid'] == 0) {  
100 - $v['sub'] = _get_child($v['id'], $lists);  
101 - $menu[] = $v;  
102 - }  
103 - }  
104 - return $this->success($menu); 95 + $lists = $this->model->list(['status'=>$this->model::ZERO,'is_role'=>$this->model::ZERO,'pid'=>$this->model::ZERO]);
  96 + return $this->success($lists);
105 } 97 }
106 } 98 }
@@ -35,11 +35,8 @@ class UserLogic extends BaseLogic @@ -35,11 +35,8 @@ class UserLogic extends BaseLogic
35 * @method 35 * @method
36 */ 36 */
37 public function user_add(){ 37 public function user_add(){
38 - $info = $this->model->read(['mobile'=>$this->param['mobile']]);  
39 - if($info !== false){  
40 - $this->fail('当前手机号码已存在');  
41 - }  
42 - //TODO::上传头像 38 + $this->verifyMobile();//验证手机号
  39 + $this->param['password'] = base64_encode(md5($this->param['password']));
43 $rs = $this->model->add($this->param); 40 $rs = $this->model->add($this->param);
44 if($rs === false){ 41 if($rs === false){
45 $this->fail('添加失败'); 42 $this->fail('添加失败');
@@ -54,12 +51,15 @@ class UserLogic extends BaseLogic @@ -54,12 +51,15 @@ class UserLogic extends BaseLogic
54 * @method 51 * @method
55 */ 52 */
56 public function user_edit(){ 53 public function user_edit(){
57 - $info = $this->model->read(['mobile'=>$this->param['mobile'],'id'=>['!=',$this->param['id']]]);  
58 - if($info !== false){  
59 - $this->fail('当前手机号码已存在'); 54 + $this->verifyMobile();//验证手机号
  55 + //验证密码是否更改
  56 + if(isset($this->param['password']) && !empty($this->param['password'])){
  57 + $info = $this->model->read(['id'=>$this->param['id']]);
  58 + if($info['password'] != $this->param['password']){
  59 + $this->param['password'] = base64_encode(md5($this->param['password']));
  60 + }
60 } 61 }
61 - //TODO::上传头像  
62 - $rs = $this->model->edits($this->param); 62 + $rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
63 if($rs === false){ 63 if($rs === false){
64 $this->fail('编辑失败'); 64 $this->fail('编辑失败');
65 } 65 }
@@ -80,4 +80,26 @@ class UserLogic extends BaseLogic @@ -80,4 +80,26 @@ class UserLogic extends BaseLogic
80 } 80 }
81 return $this->success(); 81 return $this->success();
82 } 82 }
  83 +
  84 + /**
  85 + * @remark :验证手机号
  86 + * @name :verifyMobile
  87 + * @author :lyh
  88 + * @method :post
  89 + * @time :2023/6/25 9:47
  90 + */
  91 + public function verifyMobile(){
  92 + if(isset($this->param['id']) && !empty($this->param['id'])){
  93 + $info = $this->model->read(['mobile'=>$this->param['mobile'],'id'=>['!=',$this->param['id']]]);
  94 + if($info !== false){
  95 + $this->fail('当前手机号码已存在');
  96 + }
  97 + }else{
  98 + $info = $this->model->read(['mobile'=>$this->param['mobile']]);
  99 + if($info !== false){
  100 + $this->fail('当前手机号码已存在');
  101 + }
  102 + }
  103 + return true;
  104 + }
83 } 105 }
@@ -24,8 +24,9 @@ class UserRequest extends FormRequest @@ -24,8 +24,9 @@ class UserRequest extends FormRequest
24 public function rules() 24 public function rules()
25 { 25 {
26 return [ 26 return [
27 - 'mobile'=>'required|string|max:11||unique:gl_project_user', 27 + 'mobile'=>'required|string|max:11',
28 'password'=>'required|string|min:5', 28 'password'=>'required|string|min:5',
  29 + 'project_id'=>'required',
29 'name'=>'required|max:20', 30 'name'=>'required|max:20',
30 'role_id'=>'required' 31 'role_id'=>'required'
31 ]; 32 ];
@@ -35,6 +36,7 @@ class UserRequest extends FormRequest @@ -35,6 +36,7 @@ class UserRequest extends FormRequest
35 { 36 {
36 return [ 37 return [
37 'mobile.required'=>'号码必须填写', 38 'mobile.required'=>'号码必须填写',
  39 + 'project_id.required'=>'所属项目必须填写',
38 'mobile.string'=>'号码中含有非法文字', 40 'mobile.string'=>'号码中含有非法文字',
39 'mobile.max' => '号码不大于11字符.', 41 'mobile.max' => '号码不大于11字符.',
40 'password.required'=>'密码必须填写', 42 'password.required'=>'密码必须填写',