request->only(["nickname" => "", "username" => "", "status" => "", "companyNo" => "", "uid" => [], "nuid" => [], "page" => 1, "size" => 10, 'level' => ''], "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']] : ""; if ($post['companyNo'] != "") { $uid = Db::name("account_company")->where(["companyCode" => $post['companyNo'], "is_del" => 0])->column("account_id"); $condition[] = ["a.id", "in", $uid]; } $page = isset($post['page']) && $post['page'] !== "" ? intval($post['page']) : 1; $size = isset($post['size']) && $post['size'] !== "" ? intval($post['size']) : 10; $count = Db::name("account") ->alias("a") ->leftJoin("user b", "a.id=b.account_id and b.status=1") ->where($condition) ->count('a.id'); $total = intval(ceil($count / $size)); $page = $total >= $page ? $page : $total; $list = Db::name("account") ->alias("a") ->leftJoin("user b", "a.id=b.account_id and b.status=1") ->append(['plat', 'company_relaton']) ->withAttr('company_relaton', function ($val, $da) { return Db::name("account_company") ->where(["account_id" => $da['id'], "is_del" => 0]) ->field("companyCode,companyName,company_type,is_main,status") ->select() ->toArray(); }) ->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") ->select() ->toArray(); return json_show(0, "获取成功", ["list" => $list, "count" => $count]); } /** @param int $id 账户id * @return \think\response\Json */ public function info() { $post = $this->request->only(["id" => ""], "post", "intval"); if ($post['id'] == "") { return json_show(1003, "参数 id 不能为空"); } $list = Db::name("account")->alias("a") ->leftJoin("user b", "a.id=b.account_id and b.status=1") ->where(["a.id" => $post['id'], "a.is_del" => 0]) ->field("a.id,a.username,a.mobile,a.source,a.status,b.nickname,b.sex,b.email,a.addtime,a.updatetime,a.level") ->findOrEmpty(); if (empty($list)) { return json_show(1004, "未找到用户信息"); } $list['system_version']=(new AccountPlat())->where(['account_id'=>$list['id']])->column('system_version','plat_code'); $list['company_relaton'] = Db::name("account_company")->where(["account_id" => $list['id'], "is_del" => 0, "status" => 1]) ->column("companyCode,companyName,company_type,is_main,status"); if($list['level']==1){ $list['company_relaton']= \app\user\model\Supplier::where(['is_del'=>0,"is_upgrade"=>1])->field("code companyCode ,name companyName,company_status status")->select(); } return json_show(0, "获取成功", $list); } /** * @return \think\response\Json|void * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function PassSet() { $post = $this->request->only(["id" => "", "password" => ""], "post", "trim"); $validate = Validate::rule([ 'id|账户ID' => 'require|number', 'password|密码' => 'require|min:6|max:200', ]); if ($validate->check($post) == false) return json_show(1004, $validate->getError()); $account = Db::name("account")->where([["id", "=", $post['id']], ["is_del", "=", "0"]])->find(); if (empty($account)) { return json_show(1003, "账户不存在"); } $salt = makeSalt(); $password = sha1($post['password'] . $salt); $account['password'] = $password; $account['salt'] = $salt; $account['is_pass'] = 1; $account['updatetime'] = date("Y-m-d H:i:s"); $up = Db::name("account")->save($account); return $up ? json_show(0, "密码修改成功") : json_show(1005, "密码修改失败"); } /**@param int $id * @param array $company * @return \think\response\Json */ public function setCompany() { $post = $this->request->only(["id" => "", "company" => []], "post"); $validate = Validate::rule([ 'id|账户ID' => 'require|number|gt:0', 'company|业务公司' => 'require|array', ]); if ($validate->check($post) == false) return json_show(1004, $validate->getError()); $company_insert = []; $acount = new AccountCompany(); foreach ($post['company'] as $company) { $ist = $acount->where(["account_id" => $post['id'], "companyCode" => $company['companyCode'], "is_del" => 0])->find(); if ($ist != false) $company['id'] = $ist['id']; $company_insert[] = [ "id" => $company['id'] ?? null, "account_id" => $post['id'], "companyCode" => $company['companyCode'], "companyName" => $company['companyName'], "company_type" => $company['company_type'], "is_main" => $company['is_main'], "status" => 1, "is_del" => $company['is_del'] ?? 0, "addtime" => date("Y-m-d H:i:s"), "updatetime" => date("Y-m-d H:i:s"), ]; } $inser = $acount->saveAll($company_insert); return $inser ? json_show(0, "关联企业设置成功") : json_show(1005, "关联企业设置失败"); } /** * @param int $id * @param int $status * @return \think\response\Json * @throws \think\exception\DbException */ public function setCompanyStatus() { $post = $this->request->only(["account_id" => "", "companyCode" => '', "status" => ""], "post"); $validate = Validate::rule([ 'account_id|账户id' => 'require|number|gt:0', 'status|状态' => 'require|number|in:0,1', 'companyCode|公司编号' => 'require', ]); if ($validate->check($post) == false) return json_show(1004, $validate->getError()); $account = Db::name("account")->where(["id" => $post['account_id'], "is_del" => 0])->findOrEmpty(); if (empty($account)) return json_show(1004, "未找账户到数据"); $acc = new AccountCompany(); $info = $acc->where(["account_id" => $post['account_id'], "companyCode" => $post['companyCode'], "is_del" => 0]) ->findOrEmpty(); if ($info->isEmpty()) { return json_show(1004, "未找账户到数据"); } $upda = ["status" => $post['status'], "updatetime" => date("Y-m-d H:i:s")]; $inser = $acc->update($upda, ["account_id" => $post['account_id'], "companyCode" => $post['companyCode'], "is_del" => 0]); if ($inser == false) return json_show(1005, "关联企业状态设置失败"); $count = $acc->where([["account_id", "=", $post['account_id']], ["status", "<>", $post['status']], ["is_del", "=", 0]])->count(); if ($count == 0 && $account['status'] != $post['status']) Db::name("account")->where(["id" => $post['account_id'], "is_del" => 0])->update($upda); return json_show(0, "关联企业状态设置成功"); } /** * @param int $id * @param string $nickname * @param int $mobile * @param string $email * @param string $portrait * @param int $sex * @return \think\response\Json */ public function UserSave() { $post = $this->request->only([ "id" => "", "nickname" => "", "mobile" => "", "email" => "", "portrait" => "", "sex" => "", ], "post"); $validate = Validate::rule([ 'id|主键ID' => 'require|number|gt:0', 'nickname|名称' => 'require|max:255', 'mobile|手机号' => 'require|number|length:11|mobile', 'email|名称' => 'email', 'sex|性别' => 'number|in:0,1,2', ]); if ($validate->check($post) == false) return json_show(1004, $validate->getError()); $account = Db::name("account")->where([["id", "=", $post['id']], ["is_del", "=", 0]])->findOrEmpty(); if (empty($account)) { return json_show(1003, "账户不存在"); } $accountinfo = Db::name("user")->where([["account_id", "=", $post['id']]])->findOrEmpty(); if (empty($accountinfo)) { return json_show(1003, "账户信息不存在"); } $uiq = Db::table("sys_account")->where([["mobile", "=", $post['mobile']], ["id", "<>", $post['id']], ["is_del", "=", 0]])->find(); if ($uiq) { return json_show(1002, "手机号已存在!"); } Db::startTrans(); try { $userinfo = [ "nickname" => $post['nickname'], "mobile" => $post['mobile'], "email" => $post['email'], "portrait" => $post['portrait'], "sex" => $post['sex'], "updatetime" => date("Y-m-d H:i:s") ]; $dat = Db::name("user")->where($accountinfo)->update($userinfo); if ($dat == false) { Db::rollback(); return json_show(1004, "信息修改失败"); } $acc = [ "id" => $post['id'], "mobile" => $post['mobile'], "username" => $post['mobile'], "updatetime" => date("Y-m-d H:i:s"), ]; $nu = Db::name("account")->save($acc); if ($nu) { Db::commit(); return json_show(0, "信息修改成功"); } else { Db::rollback(); return json_show(1004, "账户信息修改失败"); } } catch (\Exception $e) { Db::rollback(); return json_show(1005, $e->getMessage()); } } /** * @param int $id * @param int $status * @return \think\response\Json * @throws \think\exception\DbException */ public function UserStatus() { $post = $this->request->only(["id" => "", "status" => ""], "post", "trim"); $validate = Validate::rule([ 'id|主键ID' => 'require|number|gt:0', 'status|状态' => 'require|number|in:0,1', ]); if ($validate->check($post) == false) return json_show(1004, $validate->getError()); $account = Account::where("id", $post['id'])->findOrEmpty(); if ($account->isEmpty()) { return json_show(1003, "账户不存在"); } if ($account['status'] == $post['status']) { return json_show(1004, "数据已更新"); } $message = $post['status'] == 1 ? "启用" : "禁用"; Db::startTrans(); try { $result = Db::name("account")->where("id", "=", $post['id'])->save(['status' => $post['status'], "updatetime" => date("Y-m-d H:i:s")]); if ($result) { $ip = AccountCompany::update(['status' => $post['status'], "updatetime" => date("Y-m-d H:i:s")], ["account_id" => $post['id'], "is_del" => 0]); if ($ip) { Db::commit(); return json_show(0, "账户{$message}成功"); } } Db::rollback(); return json_show(1005, "账户{$message}失败"); } catch (\Exception $e) { Db::rollback(); return json_show(1004, $e->getMessage()); } } //根据业务公司获取用户数据 public function UserListByCompany() { $post = $this->request->only(["nickname" => "", "username" => "", "status" => "", "uid" => [], "nuid" => [], "companyNo" => "", "page" => 1, "size" => 10,'level' => ''], "post"); $condition = [["a.is_del", "=", 0]]; // $whereor = []; 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']) && !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['companyNo']) && $post['companyNo'] !== "" ? $condition[] = ["c.companyCode", "=", $post['companyNo']] : '';//$whereor[] = ["c.companyCode", "=", null]; if ($post['level'] !== '') $condition[] = ['a.level', '=', $post['level']]; $page = isset($post['page']) && $post['page'] !== "" ? intval($post['page']) : 1; $size = isset($post['size']) && $post['size'] !== "" ? intval($post['size']) : 10; $count = Db::name("account") ->alias("a") ->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") ->where($condition) ->count(); $total = intval(ceil($count / $size)); $page = $total >= $page ? $page : $total; $list = Db::name("account") ->alias("a") ->field("a.id,a.username,a.mobile,a.source,a.status,b.nickname,b.sex,b.email,a.addtime,a.updatetime,companyCode,companyName,company_type,is_main,c.status as com_status,a.level") ->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") ->where($condition) // ->whereOr($whereor) ->page($page, $size) ->append(['plat', 'company_relaton']) ->withAttr('company_relaton', function ($val, $da) { return Db::name("account_company") ->where(["account_id" => $da['id'], "is_del" => 0]) ->field("companyCode,companyName,company_type,is_main,status") ->select() ->toArray(); }) ->order("a.addtime desc") ->select() ->toArray(); return json_show(0, "获取成功", ["list" => $list, "count" => $count]); } /** * @return \think\response\Json * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function userAdd() { $post = $this->request->only(["nickname" => "", "mobile" => "", "email" => "", "companyArr" => [],'level'], "post", "trim"); $validate = Validate::rule([ 'nickname|真实姓名' => 'require|min:2|max:200', 'mobile|手机号' => 'require|number|length:11|mobile', 'email|邮箱' => 'email', 'level|账号等级' => 'require|number|in:1,2,3', 'companyArr|关联公司' => 'requireIf:level,2|requireIf:level,3|array', ]); if ($validate->check($post) == false) return json_show(1004, $validate->getError()); $uiq = Db::table("sys_account")->field('id')->where(["mobile" => $post['mobile']])->find(); if ($uiq) return json_show(1002, "手机号已注册!"); Db::startTrans(); try { $date = date('Y-m-d H:i:s'); $salt = makeSalt(); $password = sha1("dingding123" . $salt); $da = [ 'username' => $post['mobile'], "password" => $password, "salt" => $salt, "mobile" => $post['mobile'], "source" => "paltadd", "status" => 1, 'level'=>$post['level'], "addtime" => $date, "updatetime" => $date ]; $reuslt = Db::table('sys_account')->insert($da, true); if ($reuslt) { $data = [ "nickname" => $post['nickname'], "mobile" => $post['mobile'], "email" => $post['email'], "portrait" => "", "sex" => 1, "post" => "", "department" => "", "account_id" => $reuslt, "status" => 1, "addtime" => $date, "updatetime" => $date ]; $user = Db::table("sys_user")->insert($data); if ($user != false) { $acount = new AccountCompany(); if (!empty($post['companyArr'])) { // //判断关联条件是否都是供应商 // $all_companyNo = array_column($post['companyArr'], 'companyCode'); // // $tmp = Db::name('headquarters') // ->where(['is_del' => 0, 'status' => 1]) // ->whereFindInSet('type', '1') // ->column('code'); // $temp = array_diff($all_companyNo, $tmp); // if (!empty($temp)) throw new Exception(implode(',', $temp) . '不是业务公司'); $company_insert = []; foreach ($post['companyArr'] as $company) { $company_insert[] = [ "account_id" => $reuslt, "companyCode" => $company['companyCode'], "companyName" => $company['companyName'], "company_type" => $company['company_type'], "is_main" => $company['is_main'], "status" => 1, "is_del" => 0, "addtime" => $date, "updatetime" => $date, ]; } $u = $acount->saveAll($company_insert); } else { $company_insert = [ "account_id" => $reuslt, "companyCode" => '', "companyName" => '', "company_type" => '0', "is_main" => 1, "status" => 1, "is_del" => 0, "addtime" => date("Y-m-d H:i:s"), "updatetime" => date("Y-m-d H:i:s"), ]; $u = $acount->save($company_insert); } if ($u == false) throw new Exception("账户新建失败"); Db::commit(); return json_show(0, "账户注册成功", ["userid" => $reuslt, "nickname" => $post['nickname']]); } } Db::rollback(); return json_show(1002, "账户注册失败"); } catch (\Exception $e) { Db::rollback(); return json_show(1002, "账户注册失败," . $e->getMessage()); } } //添加超管账号 // public function addAdminAccount() // { // // $post = $this->request->filter('trim')->post(); // // $tmp = Db::table("sys_account") // ->field('id') // ->where(["mobile" => $post['mobile'], 'is_del' => 0]) // ->findOrEmpty(); // if ($tmp) return json_show(1002, "手机号已注册"); // // Db::startTrans(); // try { // $date = date("Y-m-d H:i:s"); // $salt = makeSalt(); // $password = sha1("dingding123" . $salt); // $da = [ // 'username' => $post['mobile'], // "password" => $password, // "salt" => $salt, // "mobile" => $post['mobile'], // "source" => "paltadd", // "status" => 1, // "level" => 1, // "addtime" => date("Y-m-d H:i:s"), // "updatetime" => date("Y-m-d H:i:s") // ]; // $reuslt = Db::table('sys_account')->insert($da, true); // if ($reuslt) { // $data = [ // "nickname" => $post['nickname'], // "mobile" => $post['mobile'], // "email" => $post['email'], // "portrait" => "", // "sex" => 1, // "post" => "", // "department" => "", // "account_id" => $reuslt, // "status" => 1, // "addtime" => $date, // "updatetime" => $date // ]; // $user = Db::table("sys_user")->insert($data); // if ($user != false) { // $acount = new AccountCompany(); // if (!empty($post['companyArr'])) { // $company_insert = []; // foreach ($post['companyArr'] as $company) { // $company_insert[] = [ // "account_id" => $reuslt, // "companyCode" => $company['companyCode'], // "companyName" => $company['companyName'], // "company_type" => $company['company_type'], // "is_main" => $company['is_main'], // "status" => 1, // "is_del" => 0, // "addtime" => $date, // "updatetime" => $date, // ]; // } // $u = $acount->saveAll($company_insert); // } else { // $company_insert = [ // "account_id" => $reuslt, // "companyCode" => '', // "companyName" => '', // "company_type" => '0', // "is_main" => 1, // "status" => 1, // "is_del" => 0, // "addtime" => $date, // "updatetime" => $date, // ]; // $u = $acount->save($company_insert); // } // // if ($u == false) throw new Exception("账户新建失败"); // Db::commit(); // return json_show(0, "账户注册成功", ["userid" => $reuslt, "nickname" => $post['nickname']]); // } // } // Db::rollback(); // return json_show(1002, "账户注册失败"); // // } catch (\Exception $e) { // Db::rollback(); // return json_show(1002, "账户注册失败" . $e->getMessage()); // } // // } //添加供应商账号 // public function addSupplierAccount() // { // // $post = $this->request->filter('trim')->post(); // // $tmp = Db::table("sys_account") // ->field('id') // ->where(["mobile" => $post['mobile'], 'is_del' => 0]) // ->findOrEmpty(); // if ($tmp) return json_show(1002, "手机号已注册"); // // Db::startTrans(); // // try { // $date = date("Y-m-d H:i:s"); // $salt = makeSalt(); // $password = sha1("dingding123" . $salt); // $da = [ // 'username' => $post['mobile'], // "password" => $password, // "salt" => $salt, // "mobile" => $post['mobile'], // "source" => "paltadd", // "status" => 1, // "level" => 3,//供应商端账号 // "addtime" => date("Y-m-d H:i:s"), // "updatetime" => date("Y-m-d H:i:s") // ]; // $reuslt = Db::table('sys_account')->insert($da, true); // if ($reuslt) { // $data = [ // "nickname" => $post['nickname'], // "mobile" => $post['mobile'], // "email" => $post['email'], // "portrait" => "", // "sex" => 1, // "post" => "", // "department" => "", // "account_id" => $reuslt, // "status" => 1, // "addtime" => $date, // "updatetime" => $date // ]; // $user = Db::table("sys_user")->insert($data); // if ($user != false) { // // //判断关联条件是否都是供应商 // $all_companyNo = array_column($post['companyArr'], 'companyCode'); // // $tmp = Db::name('headquarters') // ->where(['is_del' => 0, 'status' => 1]) // ->whereFindInSet('type', '3') // ->column('code'); // $temp = array_diff($all_companyNo, $tmp); // if (!empty($temp)) throw new Exception(implode(',', $temp) . '不是供应商'); // // $company_insert = []; // foreach ($post['companyArr'] as $company) { // $company_insert[] = [ // "account_id" => $reuslt, // "companyCode" => $company['companyCode'], // "companyName" => $company['companyName'], // "company_type" => 1, // "is_main" => $company['is_main'], // "status" => 1, // "is_del" => 0, // "addtime" => $date, // "updatetime" => $date, // ]; // } // // if ($company_insert) Db::name('account_company')->insertAll($company_insert); // // Db::commit(); // return json_show(0, "添加供应商账号成功", ["userid" => $reuslt, "nickname" => $post['nickname']]); // } // } // Db::rollback(); // return json_show(1002, "添加供应商账号失败"); // // } catch (Exception $e) { // Db::rollback(); // return json_show(1002, "添加供应商账号失败," . $e->getMessage()); // } // // } //修改密码通过旧密码 public function passSetByPassword() { $param = $this->request->only(['uid', 'old_pass', 'new_pass'], 'post', 'trim'); $val = Validate::rule([ 'uid|用户ID' => 'require|number|gt:0', 'old_pass|旧密码' => 'require|max:255', 'new_pass|新密码' => 'require|min:6|max:255', ]); if ($val->check($param) == false) return json_show(1004, $val->getError()); $acc = Db::name("account") ->field('id,password,salt,status') ->where(['id' => $param['uid'], "is_del" => Account::$account_del]) ->findOrEmpty(); if (empty($acc)) return json_show(1003, '账户不存在'); if ($acc['status'] == Account::$account_end) return json_show(1003, '账户已禁用'); $sha1 = sha1($param['old_pass'] . $acc['salt']); if ($sha1 != $acc['password']) return json_show(1003, '密码错误'); $salt = makeSalt(); $password = sha1($param['new_pass'] . $salt); $rs = Db::name('account') ->where(['id' => $param['uid'], "is_del" => Account::$account_del]) ->update([ 'password' => $password, 'salt' => $salt, 'updatetime' => date('Y-m-d H:i:s') ]); return $rs ? json_show(0, '修改密码成功') : json_show(1004, '修改密码失败'); } //获取用户所绑定的公司列表 public function getCompanyList(){ $post = $this->request->only(["uid" => 0, "companyCode" => "","companyName" => "", "page" => 1, "size" => 20], "post", "trim"); $where=[['a.is_del','=',0],['a.account_id','=',$post['uid']]]; if($post['companyCode']!='') $where[]=['a.companyCode','like','%'.$post['companyCode'].'%']; if($post['companyName']!='') $where[]=['a.companyName','like','%'.$post['companyName'].'%']; $count = Db::name('account_company') ->alias('a') ->where($where) ->count('a.id'); $list = Db::name('account_company') ->alias('a') ->field('a.*,b.level') ->where($where) ->leftJoin('account b','b.id=a.account_id') ->order(['a.id' => 'asc']) ->page(intval($post['page']), intval($post['size'])) ->select() ->toArray(); 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); } //检查供应商是否有开通账号 public function checkHasAccountBySupplierNos() { $supplierNos = $this->request->post('supplierNo', '', 'trim'); $where = [ ['a.is_del', '=', 0], ['a.status', '=', 1], ['b.level', '=', 3], ['b.status', '=', 1], ['a.companyCode', 'like', 'QS%'] ]; if ($supplierNos !== '') $where[] = ['a.companyCode', 'in', $supplierNos]; $list = Db::name('account_company') ->alias('a') ->leftJoin('account b', 'b.id=a.account_id') ->where($where) ->column('a.account_id', 'a.companyCode'); return json_show(0, '获取供应商账号开通情况成功', $list); } }