Commit 879cf731 by 杨昕

优化客户端用户登录接口

parent 51289383
Pipeline #14722 passed with stages
in 4 minutes 54 seconds
......@@ -212,17 +212,19 @@ class UserModel extends Authenticatable
try{
$password = $request->password;
$username = $request->username;
$password = $request->password;
$len = strlen($username);
if ($len < 5){
throw new \Exception('用户名称长度不能小于5个字符');
}
/**
* 陈腾飞-ctf37800-ctf88614
* 用户名称是有三部分组成,姓名-新账号-旧账号
*/
$user = UserModel::where('name', 'regexp', '/^.*?'.$username.'/')->first();
if (empty($user)|| !isset($user['mis_uid'])){
/**
* 获取mis用户基本信息
......@@ -233,8 +235,7 @@ class UserModel extends Authenticatable
// $data['type'] = 6;
// $data['username'] = $staffNo;
$request->replace(array_merge($request->all(),['mis_uid'=>'000000']));
$request->replace(array_merge($request->all(),['staffNo'=>$username]));
$url = getRbac($request,"api/mis/userinfo",'','mis_user');
$result = http_request_code($url,
......@@ -243,21 +244,18 @@ class UserModel extends Authenticatable
);
$userInfo = json_decode($result,true);
if (empty($userInfo['data'])){
LogModel::addlog(["获取用户信息失败",$request->all()]);
throw new \Exception("获取用户信息失败");
if ($userInfo['data']["userId"] == ""){
LogModel::addlog(["用户不存在",$request->all()]);
throw new \Exception("用户不存在");
}
$userInfo = $userInfo['data'];
$userid = $userInfo['userId'];
//$result = self::getUserPrivilege($request,['mis_uid'=>$userid]);
if (empty($user)){
//杨帆-yf18512-yf60144-8086
$data_arr = [
'name' => $userInfo['nickName'],
......@@ -345,7 +343,7 @@ class UserModel extends Authenticatable
$request->replace(array_merge($request->all(),$params));
$catgList = MediaCategoryModel::get()->toArray();
$catgList = MediaCategoryModel::where("status",0)->get()->toArray();
$tmp = [];
foreach ($catgList as $key => $catg){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment