Compare commits

...

2 Commits

Author SHA1 Message Date
yaooo 5e8ae28ea2 更新用户注册 2023-11-13 11:21:30 +08:00
yaooo a2eac95e86 更新用户修改密码 2023-11-13 11:09:47 +08:00
4 changed files with 3 additions and 21 deletions

View File

@ -37,7 +37,7 @@ class LoginJwtMiddleware
//不直接判断$isNotNeedLogin结果使不需要登录的接口通过为了兼容某些接口可以登录或不登录访问 //不直接判断$isNotNeedLogin结果使不需要登录的接口通过为了兼容某些接口可以登录或不登录访问
if (empty($token) && !$isNotNeedLogin) { if (empty($token) && !$isNotNeedLogin) {
return JsonService::fail('请求参数缺token', [], 0, 0); return JsonService::fail('请求参数缺token', [], 0, 0);
} }
if (!$isNotNeedLogin) { if (!$isNotNeedLogin) {

View File

@ -29,19 +29,9 @@ class LoginLogic extends BaseLogic
$avatar = env('project.web_domain').'/'.ConfigService::get('default_image', 'user_avatar'); $avatar = env('project.web_domain').'/'.ConfigService::get('default_image', 'user_avatar');
Db::startTrans(); Db::startTrans();
try { try {
//添加到管理员表
$admin = Admin::create([
'root' => 0,
'name' => '用户'.$params['phone'],
'avatar' => empty($params['avatar']) ? $avatar : $params['avatar'],
'account' => $params['phone'],
'password' => $adminPassword,
'multipoint_login' => 1,
'disable' => 0
]);
//添加到用户表 //添加到用户表
$user = User::create([ $user = User::create([
'admin_id' => $admin['id'], 'admin_id' => 0,
'phone' => $params['phone'], 'phone' => $params['phone'],
'nick_name' => '用户'.$params['phone'], 'nick_name' => '用户'.$params['phone'],
'password' => $userPassword, 'password' => $userPassword,

View File

@ -68,10 +68,6 @@ class UserLogic extends BaseLogic
public static function changeMobile(array $params,int $uid): bool public static function changeMobile(array $params,int $uid): bool
{ {
try { try {
$user = User::field('admin_id')->where('id',$uid)->findOrEmpty();
if($user->isEmpty()){
throw new \Exception('数据错误');
}
// 校验短信 // 校验短信
$checkSmsCode = (new SmsDriver())->verify($params['phone'], $params['code'], NoticeEnum::CHANGE_MOBILE_CAPTCHA); $checkSmsCode = (new SmsDriver())->verify($params['phone'], $params['code'], NoticeEnum::CHANGE_MOBILE_CAPTCHA);
if (!$checkSmsCode) { if (!$checkSmsCode) {
@ -81,10 +77,6 @@ class UserLogic extends BaseLogic
'id' => $uid, 'id' => $uid,
'phone' => $params['phone'], 'phone' => $params['phone'],
]); ]);
Admin::update([
'id' => $user['admin_id'],
'account' => $params['phone']
]);
return true; return true;
} catch (\Exception $e) { } catch (\Exception $e) {
self::setError($e->getMessage()); self::setError($e->getMessage());