wugg 8 months ago
parent
commit
ef6117d9e8
2 changed files with 22 additions and 2 deletions
  1. 2 2
      app/bug/controller/Base.php
  2. 20 0
      app/user/controller/User.php

+ 2 - 2
app/bug/controller/Base.php

@@ -9,8 +9,8 @@ class Base extends \app\BaseController{
     protected $noLogin=[];
    protected $uid=0;
    protected $uname='system';
-   protected $roleid=1;
-   protected $level='0';
+   protected $roleid=0;
+   protected $level=0;
    protected $token='';
    protected $model=null;
    public function __construct(App $app) {

+ 20 - 0
app/user/controller/User.php

@@ -173,6 +173,26 @@ class User extends Base
         $info->hidden(['userInfo','password','salt','accountItem']);
         return success('获取成功',$info);
     }
+
+     public function GetUserQueryByCondition(){
+        $post  =$this->request->param(['nickname'=>'','username'=>'','level'=>'','itemid'=>'','size'=>100,
+        'status'=>''],'post','trim');
+         $where=[['is_del','=',0]];
+        if($post['nickname']!='') $where[]=['userInfo.nickname','like',"%{$post['nickname']}%"];
+        if($post['username']!='') $where[]=['username','like',"%{$post['username']}%"];
+        if($post['status']!=='')$where[]=['status','=',$post['status']];
+        if($post['level']!=0) $where[]=['level','=',$post['level']];
+        if($post['itemid']!=0) $where[]=['accountItem.itemid','=',$post['itemid']];
+        $info=$this->model
+        ->withJoin(['userInfo','account_item'],'left')
+        ->where($where)
+        ->field("length(nickname) nameL")
+        ->limit(intval($post['size']))
+        ->order('nameL asc')
+        ->select();
+        $info->hidden(['userInfo','password','salt','accountItem','account_item']);
+        return success('获取成功',$info);
+    }
     //修改账户字段
     public function userChange(){
         $param  =$this->request->param([