Commit 53a50fbf by 杨树贤

注册登录完善

parent 17b8616e
...@@ -18,6 +18,7 @@ class AuthController extends Controller ...@@ -18,6 +18,7 @@ class AuthController extends Controller
'email', 'email',
'password', 'password',
'salt', 'salt',
'init_org_id',
]); ]);
$user = UserService::register($data); $user = UserService::register($data);
......
...@@ -30,7 +30,15 @@ class UserRegister extends FormRequest ...@@ -30,7 +30,15 @@ class UserRegister extends FormRequest
'password' => 'required', 'password' => 'required',
'salt' => 'required', 'salt' => 'required',
'mobile' => 'required_without:email', 'mobile' => 'required_without:email',
'email' => 'required_without:mobile' 'email' => 'required_without:mobile',
'init_org_id' => 'required'
];
}
public function attributes()
{
return [
'init_org_id' => '组织id'
]; ];
} }
......
...@@ -18,7 +18,7 @@ class UserService ...@@ -18,7 +18,7 @@ class UserService
$ucId = UserModel::where('email', $data['email'])->value('uc_id'); $ucId = UserModel::where('email', $data['email'])->value('uc_id');
} }
if (!$ucId) { if (!$ucId) {
//去新增注册 //去新增注册
$data['create_time'] = time(); $data['create_time'] = time();
$ucId = UserModel::insertGetId($data); $ucId = UserModel::insertGetId($data);
...@@ -31,7 +31,7 @@ class UserService ...@@ -31,7 +31,7 @@ class UserService
'create_time', 'create_time',
])->where('uc_id', $ucId)->first(); ])->where('uc_id', $ucId)->first();
UserModel::where('uc_id', $user['uc_id'])->update(['last_login_time'], time()); UserModel::where('uc_id', $user['uc_id'])->update(['last_login_time' => time()]);
return $user; return $user;
} }
...@@ -58,7 +58,7 @@ class UserService ...@@ -58,7 +58,7 @@ class UserService
'create_time', 'create_time',
])->where('password', $passwordHash)->first(); ])->where('password', $passwordHash)->first();
UserModel::where('uc_id', $user['uc_id'])->update(['last_login_time'], time()); UserModel::where('uc_id', $user['uc_id'])->update(['last_login_time' => time()]);
return $user ?: []; return $user ?: [];
......
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 sign in to comment