|
@@ -31,8 +31,8 @@ class User extends Api
|
|
|
*/
|
|
|
public function mobilelogin()
|
|
|
{
|
|
|
- $mobile = $this->request->post('mobile');
|
|
|
- $captcha = $this->request->post('captcha');
|
|
|
+ $mobile = $this->request->post('mobile','','trim,intval');
|
|
|
+ $captcha = $this->request->post('captcha','','trim,intval');
|
|
|
if (!$mobile || !$captcha) {
|
|
|
$this->error(__('Invalid parameters'));
|
|
|
}
|
|
@@ -40,12 +40,15 @@ class User extends Api
|
|
|
$this->error(__('Mobile is incorrect'));
|
|
|
}
|
|
|
|
|
|
+ if(!$this->apiLimit(60,1,'60_'.$mobile)){
|
|
|
+ $this->error('您的手机号登录频繁,请一分钟后再试');
|
|
|
+ };
|
|
|
+ if(!$this->apiLimit(3600,10,'3600_'.$mobile)){
|
|
|
+ $this->error('您的手机号登录频繁,请一小时后再试!');
|
|
|
+ };
|
|
|
if(!$this->apiLimit(60,10,request()->ip())){
|
|
|
$this->error('当前登录人数过多,请稍后再试');
|
|
|
};
|
|
|
- if(!$this->apiLimit(3600,10,$mobile)){
|
|
|
- $this->error('您的手机号登录频繁,请稍后再试');
|
|
|
- };
|
|
|
|
|
|
|
|
|
if (!Sms::check($mobile, $captcha, 'mobilelogin')) {
|
|
@@ -54,11 +57,12 @@ class User extends Api
|
|
|
$user = \app\common\model\User::getByMobile($mobile);
|
|
|
if ($user) {
|
|
|
if ($user->status != 1) {
|
|
|
- $this->error(__('Account is locked'));
|
|
|
+ $this->error('网络开小差了请稍后重试');
|
|
|
}
|
|
|
//如果已经有账号则直接登录
|
|
|
$ret = $this->auth->direct($user->id);
|
|
|
} else {
|
|
|
+ $this->error('注册已截止');
|
|
|
$ret = $this->auth->register('', '', '', $mobile, []);
|
|
|
}
|
|
|
if ($ret) {
|
|
@@ -100,7 +104,7 @@ class User extends Api
|
|
|
public function profile()
|
|
|
{
|
|
|
$avatar = input('avatar', '', 'trim,strip_tags,htmlspecialchars');
|
|
|
- $nickname = input('nickname', '');
|
|
|
+ $nickname = input('nickname', '', 'trim,htmlspecialchars');
|
|
|
|
|
|
//修改用户
|
|
|
$data = [];
|