Browse Source

userall接口,getCodeAndName增加参数

wufeng 2 years ago
parent
commit
d974b9ef75
3 changed files with 41 additions and 8 deletions
  1. 2 1
      app/controller/Headquarters.php
  2. 38 7
      app/controller/UserInfo.php
  3. 1 0
      route/app.php

+ 2 - 1
app/controller/Headquarters.php

@@ -522,11 +522,12 @@ class Headquarters extends BaseController
     public function sGetList()
     public function sGetList()
     {
     {
 
 
-        $param = $this->request->only(['page' => 1, 'size' => 10, 'name' => '', 'code' => '', 'creater' => '', 'person' => '', 'status' => '', 'ocr_status' => '', 'start' => '', 'end' => '', 'company_name' => '', 'is_platform' => ''], 'post', 'trim');
+        $param = $this->request->only(['page' => 1, 'size' => 10, 'name' => '', 'code' => '', 'creater' => '', 'person' => '', 'status' => '', 'ocr_status' => '', 'start' => '', 'end' => '', 'company_name' => '', 'is_platform' => '','more_code'=>''], 'post', 'trim');
 
 
         $where = [['s.is_del', "=", 0]];
         $where = [['s.is_del', "=", 0]];
         if ($param['name'] !== "") $where[] = ["s.name", "like", '%' . $param['name'] . '%'];
         if ($param['name'] !== "") $where[] = ["s.name", "like", '%' . $param['name'] . '%'];
         if ($param['code'] !== "") $where[] = ["s.code", "like", '%' . $param['code'] . '%'];
         if ($param['code'] !== "") $where[] = ["s.code", "like", '%' . $param['code'] . '%'];
+        if ($param['more_code'] !== "") $where[] = ["s.code", "in", $param['more_code']];
         if ($param['creater'] !== "") $where[] = ["s.creater", "like", '%' . $param['creater'] . '%'];
         if ($param['creater'] !== "") $where[] = ["s.creater", "like", '%' . $param['creater'] . '%'];
         if ($param['person'] !== "") $where[] = ["s.person", "like", '%' . $param['person'] . '%'];
         if ($param['person'] !== "") $where[] = ["s.person", "like", '%' . $param['person'] . '%'];
         if ($param['status'] !== "") $where[] = ["s.status", '=', $param['status']];
         if ($param['status'] !== "") $where[] = ["s.status", '=', $param['status']];

+ 38 - 7
app/controller/UserInfo.php

@@ -74,9 +74,12 @@ class UserInfo extends BaseController
                     ->select()
                     ->select()
                     ->toArray();
                     ->toArray();
             })
             })
-            ->where($condition)->page($page, $size)->order("a.id desc")
+            ->where($condition)
+            ->page($page, $size)
+            ->order("a.id desc")
             ->field("a.id,a.username,a.mobile,a.source,a.status,b.nickname,b.sex,b.email,a.addtime,a.updatetime,a.level")
             ->field("a.id,a.username,a.mobile,a.source,a.status,b.nickname,b.sex,b.email,a.addtime,a.updatetime,a.level")
-            ->select()->toArray();
+            ->select()
+            ->toArray();
 
 
         return json_show(0, "获取成功", ["list" => $list, "count" => $count]);
         return json_show(0, "获取成功", ["list" => $list, "count" => $count]);
     }
     }
@@ -319,15 +322,15 @@ class UserInfo extends BaseController
     //根据业务公司获取用户数据
     //根据业务公司获取用户数据
     public function UserListByCompany()
     public function UserListByCompany()
     {
     {
-        $post = $this->request->only(["nickname" => "", "username" => "", "status" => "", "uid" => [], "nuid" => [], "companyNo" => "", "page" => 1, "size" => 10, 'level' => ''], "post");
+        $post = $this->request->only(["nickname" => "", "username" => "", "status" => "", "uid" => [], "nuid" => [], "companyNo" => "", "page" => 1, "size" => 10,'level' => ''], "post");
         $condition = [["a.is_del", "=", 0]];
         $condition = [["a.is_del", "=", 0]];
-        $whereor = [];
+//        $whereor = [];
         isset($post['nickname']) && $post['nickname'] != "" ? $condition[] = ["nickname", "like", "%{$post['nickname']}%"] : "";
         isset($post['nickname']) && $post['nickname'] != "" ? $condition[] = ["nickname", "like", "%{$post['nickname']}%"] : "";
         isset($post['username']) && $post['username'] != "" ? $condition[] = ["username", "like", "%{$post['username']}%"] : "";
         isset($post['username']) && $post['username'] != "" ? $condition[] = ["username", "like", "%{$post['username']}%"] : "";
         isset($post['status']) && $post['status'] !== "" ? $condition[] = ["a.status", "=", $post['status']] : "";
         isset($post['status']) && $post['status'] !== "" ? $condition[] = ["a.status", "=", $post['status']] : "";
         isset($post['uid']) && !empty($post['uid']) && !empty($post['uid']) ? $condition[] = ["a.id", "in", $post['uid']] : "";
         isset($post['uid']) && !empty($post['uid']) && !empty($post['uid']) ? $condition[] = ["a.id", "in", $post['uid']] : "";
         isset($post['nuid']) && !empty($post['nuid']) && !empty($post['nuid']) ? $condition[] = ["a.id", "not in", $post['nuid']] : "";
         isset($post['nuid']) && !empty($post['nuid']) && !empty($post['nuid']) ? $condition[] = ["a.id", "not in", $post['nuid']] : "";
-        isset($post['companyNo']) && $post['companyNo'] !== "" ? $condition[] = ["c.companyCode", "=", $post['companyNo']] : $whereor[] = ["c.companyCode", "=", null];
+        isset($post['companyNo']) && $post['companyNo'] !== "" ? $condition[] = ["c.companyCode", "=", $post['companyNo']] : '';//$whereor[] = ["c.companyCode", "=", null];
         if ($post['level'] !== '') $condition[] = ['a.level', '=', $post['level']];
         if ($post['level'] !== '') $condition[] = ['a.level', '=', $post['level']];
 
 
         $page = isset($post['page']) && $post['page'] !== "" ? intval($post['page']) : 1;
         $page = isset($post['page']) && $post['page'] !== "" ? intval($post['page']) : 1;
@@ -337,8 +340,9 @@ class UserInfo extends BaseController
             ->leftJoin("user b", "a.id=b.account_id and b.status=1")
             ->leftJoin("user b", "a.id=b.account_id and b.status=1")
             ->leftJoin("account_company c", "a.id=c.account_id and c.status=1 and c.is_del=0")
             ->leftJoin("account_company c", "a.id=c.account_id and c.status=1 and c.is_del=0")
             ->where($condition)
             ->where($condition)
-            ->whereOr($whereor)
+//            ->whereOr($whereor)
             ->count();
             ->count();
+
         $total = intval(ceil($count / $size));
         $total = intval(ceil($count / $size));
         $page = $total >= $page ? $page : $total;
         $page = $total >= $page ? $page : $total;
         $list = Db::name("account")
         $list = Db::name("account")
@@ -347,7 +351,7 @@ class UserInfo extends BaseController
             ->leftJoin("user b", "a.id=b.account_id and b.status=1")
             ->leftJoin("user b", "a.id=b.account_id and b.status=1")
             ->leftJoin("account_company c", "a.id=c.account_id  and c.is_del=0")
             ->leftJoin("account_company c", "a.id=c.account_id  and c.is_del=0")
             ->where($condition)
             ->where($condition)
-            ->whereOr($whereor)
+//            ->whereOr($whereor)
             ->page($page, $size)
             ->page($page, $size)
             ->append(['plat', 'company_relaton'])
             ->append(['plat', 'company_relaton'])
 //            ->withAttr('plat', function ($val, $da) {
 //            ->withAttr('plat', function ($val, $da) {
@@ -736,4 +740,31 @@ class UserInfo extends BaseController
         return json_show(0, '获取用户所绑定的公司列表成功', ['count' => $count, 'list' => $list]);
         return json_show(0, '获取用户所绑定的公司列表成功', ['count' => $count, 'list' => $list]);
     }
     }
 
 
+
+    //所有账号
+    public function userAll()
+    {
+        $post = $this->request->filter('trim')->post();
+        $condition = [["a.is_del", "=", 0]];
+        isset($post['nickname']) && $post['nickname'] != "" ? $condition[] = ["nickname", "like", "%{$post['nickname']}%"] : "";
+        isset($post['username']) && $post['username'] != "" ? $condition[] = ["username", "like", "%{$post['username']}%"] : "";
+//        isset($post['status']) && $post['status'] !== "" ? $condition[] = ["a.status", "=", $post['status']] : "";
+//        isset($post['uid']) && !empty($post['uid']) ? $condition[] = ["a.id", "in", $post['uid']] : "";
+//        isset($post['nuid']) && !empty($post['nuid']) ? $condition[] = ["a.id", "not in", $post['nuid']] : "";
+        isset($post['level']) && !empty($post['level']) ? $condition[] = ["a.level", '=', $post['level']] : "";
+
+        $list = Db::name("account")
+            ->field("a.id,a.username,a.mobile,a.status,b.nickname,a.level")
+            ->alias("a")
+            ->leftJoin("user b", "a.id=b.account_id and b.status=1")
+            ->where($condition)
+            ->order(['a.id' => 'desc'])
+            ->select()
+            ->toArray();
+
+        return json_show(0, "获取成功", $list);
+    }
+
+
+
 }
 }

+ 1 - 0
route/app.php

@@ -23,6 +23,7 @@ Route::rule('setpasswd', 'UserInfo/PassSet');
 Route::rule('setcompany', 'UserInfo/setCompany');
 Route::rule('setcompany', 'UserInfo/setCompany');
 Route::rule('companystatus', 'UserInfo/setCompanyStatus');
 Route::rule('companystatus', 'UserInfo/setCompanyStatus');
 Route::rule('useradd', 'UserInfo/userAdd');
 Route::rule('useradd', 'UserInfo/userAdd');
+Route::rule('userall', 'UserInfo/userAll');
 //Route::rule('add_admin_account', 'UserInfo/addAdminAccount');
 //Route::rule('add_admin_account', 'UserInfo/addAdminAccount');
 //Route::rule('add_supplier_account', 'UserInfo/addSupplierAccount');
 //Route::rule('add_supplier_account', 'UserInfo/addSupplierAccount');
 Route::rule('userDelete', 'UserInfo/userDelete');
 Route::rule('userDelete', 'UserInfo/userDelete');