|
@@ -101,6 +101,11 @@ class User extends BaseController
|
|
|
return error_show(1002,"原密码不能为空");
|
|
|
}
|
|
|
$data = resetpasswd($token,['newpwd'=>$newPwd,'oldpwd'=>$oldpwd]);
|
|
|
+ if(empty($userinfo)||$userinfo['code']!=0){
|
|
|
+ return error_show($userinfo['code'],$userinfo['message']);
|
|
|
+ }else{
|
|
|
+ return app_show(0,"密码修改成功");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public function userAll(){
|
|
@@ -157,6 +162,12 @@ class User extends BaseController
|
|
|
->field("roleid,role_name")->find();
|
|
|
$value['roleid'] = isset($role['roleid']) ? $role['roleid'] :"";
|
|
|
$value['role_name'] = isset($role['role_name']) ? $role['role_name'] :"";
|
|
|
+ $depart = Db::name("depart_user")->where([["uid","=",$data['uid']],["is_del","=",0]])->column("itemid");
|
|
|
+ $value['depart']="";
|
|
|
+ if(!empty($depart)){
|
|
|
+ $deparname = Db::name("company_item")->where(["id"=>$depart,"is_del"=>0])->column("name");
|
|
|
+ $value['depart'] = implode(",",$deparname);
|
|
|
+ }
|
|
|
$list[]=$value;
|
|
|
}
|
|
|
return app_show(0,"获取成功",["list"=>$list,"count"=>$userinfo['data']["count"]]);
|
|
@@ -196,4 +207,47 @@ class User extends BaseController
|
|
|
|
|
|
return $insert? app_show(0,'数据新建成功'):error_show(1004,'数据新建失败');
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 保存新建的资源
|
|
|
+ *
|
|
|
+ * @param \think\Request $request
|
|
|
+ * @return \think\Response
|
|
|
+ */
|
|
|
+ public function UserSave()
|
|
|
+ {
|
|
|
+ $post=$this->request->post();
|
|
|
+ $toke= isset($post['token'])? trim($post['token']):"";
|
|
|
+ if ($toke==""){
|
|
|
+ return app_show(100,"token不能为空");
|
|
|
+ }
|
|
|
+ $verify = VerifyToken($toke);
|
|
|
+ if ($verify['code']!=0){
|
|
|
+ return app_show($verify['code'],$verify['message']);
|
|
|
+ }
|
|
|
+ $userid = isset($post['id'])&&$post['id']!==""?intval($post['id']):"";
|
|
|
+ if($userid==""){
|
|
|
+ return error_show(1004,"参数id 不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ $nickname= isset($post['nickname'])? trim($post['nickname']):"";
|
|
|
+ if ($nickname==""){
|
|
|
+ return app_show(1001,"昵称不能为空");
|
|
|
+ }
|
|
|
+ $mobile= isset($post['mobile'])? trim($post['mobile']):"";
|
|
|
+ if ($mobile==""){
|
|
|
+ return app_show(1002,"手机号不能为空");
|
|
|
+ }
|
|
|
+ if (checkMobile($mobile)==false){
|
|
|
+ return app_show(1002,"手机号格式不正确");
|
|
|
+ }
|
|
|
+ $email= isset($post['email'])? trim($post['email']):"";
|
|
|
+ $role =isset($post['role'])? intval($post['role']):0;
|
|
|
+ $data=[
|
|
|
+ "id"=>$userid,
|
|
|
+ "nickname"=>$nickname,
|
|
|
+ "mobile"=>$mobile,
|
|
|
+ "email"=>$email
|
|
|
+ ];
|
|
|
+ }
|
|
|
}
|