|
@@ -152,5 +152,47 @@ class UserCompany extends Base
|
|
|
return json_show($rs['code'], $rs['message'], $rs['data']);
|
|
|
}
|
|
|
|
|
|
+ //当前账号绑定了哪些公司
|
|
|
+ public function myCompanyList()
|
|
|
+ {
|
|
|
+ $param = $this->request->only(['status' => '', 'page' => 1, 'size' => 10], 'post', 'trim');
|
|
|
+
|
|
|
+ $param['account_id'] = $this->uid;
|
|
|
+
|
|
|
+ $userCommon = new UserCommon();
|
|
|
+
|
|
|
+ $rs = $userCommon->handle('userCompanyList', $param);
|
|
|
+
|
|
|
+ if (isset($rs['code']) && $rs['code'] == 0) {
|
|
|
+ //补充角色信息
|
|
|
+ foreach ($rs['data']['list'] as &$item) {
|
|
|
+ $tmp = Db::name('user_role')
|
|
|
+ ->alias('a')
|
|
|
+ ->field('b.role_name')
|
|
|
+ ->leftJoin('role b', 'b.id=a.roleid')
|
|
|
+ ->where(['a.uid' => $item['account_id'], 'a.is_del' => 0, 'a.companyNo' => $item['companyCode']])
|
|
|
+ ->findOrEmpty();
|
|
|
+
|
|
|
+ $item['role_name'] = $tmp['role_name'] ?? '';
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return json_show($rs['code'], $rs['message'], $rs['data']);
|
|
|
+ }
|
|
|
+
|
|
|
+ //切换默认公司
|
|
|
+ public function changeMain()
|
|
|
+ {
|
|
|
+
|
|
|
+ $param = $this->request->filter('trim')->post();
|
|
|
+
|
|
|
+ $userCommon = new UserCommon();
|
|
|
+
|
|
|
+ $rs = $userCommon->handle('changeMain', $param);
|
|
|
+
|
|
|
+ return json_show($rs['code'], $rs['message'], $rs['data']);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|