作者 lyh

gx

... ... @@ -39,7 +39,7 @@ class BaseController extends Controller
$info = Cache::get(Common::MANAGE_TOKEN . $this->token);
if(!empty($this->token) && !empty($info)){
$this->manage = $info;
Cache::put($this->token, $info, 3600 * 6);//更新缓存时间
Cache::put($this->token, $info, 3600 * 12);//更新缓存时间
$this->uid = $info['id'];
}
}
... ...
... ... @@ -82,18 +82,18 @@ class LoginController extends BaseController
$mobile = $this->param['mobile'];
$manager = Manage::where(['mobile' => $mobile])->first();
if (empty($manager)) {
$this->response('请输入正确的手机号码!', Code::USER_LOGIN_ERROE);
$this->response('请输入正确的手机号码!', Code::SYSTEM_ERROR);
}
$last_sms = SmsLog::getLastLog($mobile, SmsLog::TYPE_MANAGER_LOGIN);
if ($last_sms && $last_sms->use = SmsLog::USE_USABLE && time() - strtotime($last_sms->created_at) < 60) {
$this->response('请不要重复发送短信!', Code::USER_LOGIN_ERROE);
$this->response('请不要重复发送短信!', Code::SYSTEM_ERROR);
}
$template = config('aliyunsms.login_sms_temp');
$code['code'] = rand(100000,999999);
$ali_sms = new AliSms();
$send = $ali_sms->sendSms(strval($mobile), $template, $code);
if (empty($send->Code) && $send->Code != 'OK') {
$this->response('发送失败, 请稍后重试!', Code::USER_LOGIN_ERROE);
$this->response('发送失败, 请稍后重试!', Code::SYSTEM_ERROR);
}
SmsLog::createLog($mobile, $code['code'],SmsLog::TYPE_MANAGER_LOGIN);
$this->response('success');
... ...
... ... @@ -112,18 +112,18 @@ class LoginController extends BaseController
$mobile = $this->param['mobile'];
$user = User::where(['mobile' => $mobile])->first();
if (empty($user)) {
$this->response('请输入正确的手机号码!', Code::USER_LOGIN_ERROE);
$this->response('请输入正确的手机号码!', Code::SYSTEM_ERROR);
}
$last_sms = SmsLog::getLastLog($mobile, SmsLog::TYPE_LOGIN);
if ($last_sms && $last_sms->use = SmsLog::USE_USABLE && time() - strtotime($last_sms->created_at) < 60) {
$this->response('请不要重复发送短信!', Code::USER_LOGIN_ERROE);
$this->response('请不要重复发送短信!', Code::SYSTEM_ERROR);
}
$template = config('aliyunsms.login_sms_temp');
$code['code'] = rand(100000,999999);
$ali_sms = new AliSms();
$send = $ali_sms->sendSms(strval($mobile), $template, $code);
if (empty($send->Code) && $send->Code != 'OK') {
$this->response('发送失败, 请稍后重试!', Code::USER_LOGIN_ERROE);
$this->response('发送失败, 请稍后重试!', Code::SYSTEM_ERROR);
}
SmsLog::createLog($mobile, $code['code']);
$this->response('success');
... ...
... ... @@ -73,7 +73,7 @@ class LoginAuthMiddleware
$menu_id = $projectMenuModel->read(['action'=>$action],['id']);
if($menu_id !== false){
if(strpos($role_info['role_menu'], $menu_id['id']) === false){
return response(['code'=>Code::USER_PERMISSION_ERROE,'message'=>'当前用户没有权限']);
return response(['code'=>Code::USER_LOGIN_ERROE,'message'=>'当前用户没有权限']);
}
}
}
... ...