|
@@ -530,4 +530,72 @@ class User extends BaseController
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public function getinfo(){
|
|
|
+ $post =$this->request->post();
|
|
|
+ $token = isset($post['token']) ? trim($post['token']) : "";
|
|
|
+ if($token==""){
|
|
|
+ return app_show(101,'token不能为空');
|
|
|
+ }
|
|
|
+ $effetc = VerifyTokens($token);
|
|
|
+ if(!empty($effetc) && $effetc['code']!=0){
|
|
|
+ return app_show($effetc['code'],$effetc['message']);
|
|
|
+ }
|
|
|
+ $userinfo=GetUserInfo($token);
|
|
|
+ if(empty($userinfo)||$userinfo['code']!=0){
|
|
|
+ return app_show(102,"员工信息不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ $data = $userinfo['data'];
|
|
|
+ $role = Db::name("user_role")->alias('a')->leftJoin('role b',"a.roleid = b.id")->where("a.uid","=",$data['id'])
|
|
|
+ ->field("roleid,role_name,business_all,uid")->find();
|
|
|
+ $data['role_name']=isset($role['role_name']) ? $role['role_name'] :"";
|
|
|
+ $data['roleid']=isset($role['roleid']) ? $role['roleid'] :"";
|
|
|
+ $st = Db::name('user_business')->where(['userid'=>$role['uid'],"is_del"=>0])->field('businessid,is_main')->select()->toArray();
|
|
|
+ $val=[];
|
|
|
+ if (!empty($st)){
|
|
|
+ foreach ($st as $itom){
|
|
|
+ $tep=[];
|
|
|
+ $business= Db::name('business')->where(['id'=>$itom['businessid'],"is_del"=>0])->field("company,companyNo")->find();
|
|
|
+ $tep['company']=isset($business['company'])?$business['company']:"";
|
|
|
+ $tep['companyNo']=isset($business['companyNo'])?$business['companyNo']:"";
|
|
|
+ $tep['businessid']=$itom['businessid'];
|
|
|
+ $tep['is_main']=$itom['is_main'];
|
|
|
+ $val[]=$tep;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $data['private_field'] = [];
|
|
|
+ if($data['roleid']!=""){
|
|
|
+ $action =Db::name("role_action")->where(["role_id"=>$data['roleid'],"status"=>1])->find();
|
|
|
+ if($action!=false){
|
|
|
+ $data['private_field']=isset($action['private_field'])&&$action['private_field']!=""?explode(",",
|
|
|
+ $action['private_field']):[];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $data['business'] =$val;
|
|
|
+ $info=[];
|
|
|
+ $stn = Db::name('user_platform')->where(['uid'=>$role['uid']])->find();
|
|
|
+ if($stn!=false){
|
|
|
+ $plat =isset($stn['platform'])?explode(",",$stn['platform']):"";
|
|
|
+ if($plat!=""){
|
|
|
+ $platform = Db::name('platform')->where(['id'=>$plat,'is_del'=>0])->column("id,platform_name,platform_code");
|
|
|
+ $info=$platform;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ $depart = Db::name("depart_user")->where([["uid","=",$data['id']],["is_del","=",0]])->column("itemid");
|
|
|
+ $data['depart']="";
|
|
|
+ if(!empty($depart)){
|
|
|
+ $deparname = Db::name("company_item")->where(["id"=>$depart,"is_del"=>0])->field("id,name,depart_link")->select()->toArray();
|
|
|
+ if(!empty($deparname)){
|
|
|
+ foreach ($deparname as $ky=> $item) {
|
|
|
+ $deparname[$ky]['depart_code']= array_filter(explode("-",$item['depart_link'])) ;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $data['depart'] = $deparname;
|
|
|
+ }
|
|
|
+ $data['platform']=$info;
|
|
|
+
|
|
|
+ return app_show(0,"获取成功",$data);
|
|
|
+ }
|
|
|
+
|
|
|
}
|