8
This commit is contained in:
@@ -57,6 +57,7 @@ class CommonController extends BaseController{
|
||||
$config['recharge_status_list'] = \app\enum\RechargeStatus::toArray();
|
||||
$config['withdrawl_status_list'] = \app\enum\WithdrawlStatus::toArray();
|
||||
$config['server_status_list'] = \app\enum\ServerStatus::toArray();
|
||||
//$config['getFriendList'] = $request->IM->friend->getFriendList('100006');
|
||||
return $this->success(__('successful'), $config);
|
||||
}
|
||||
|
||||
@@ -144,20 +145,28 @@ class CommonController extends BaseController{
|
||||
// }else{
|
||||
// $extends['trade_password'] = \plugin\admin\app\common\Util::passwordHash($trade_password);
|
||||
// }
|
||||
|
||||
//邀请码
|
||||
if ($invite_code)
|
||||
{
|
||||
//$invite_code = 'TEAJXLEE';
|
||||
$extends = [
|
||||
'role_id' => 1,
|
||||
'group_id' => 0,
|
||||
'region' => '86',
|
||||
'nickname' => input('nickname'),
|
||||
'avatar' => '/static/img/avatar.png',
|
||||
];
|
||||
if ($invite_code) {
|
||||
if(strlen($invite_code) == 12){
|
||||
//系统生产的一次性推荐吗
|
||||
$inviteModel = \app\model\Invitecode::where('code',$invite_code)->find();
|
||||
if(!$inviteModel){
|
||||
return $this->error(__('错误的邀请码'));
|
||||
}
|
||||
$extends['group'] = 2;
|
||||
$extends['group_id'] = 2;
|
||||
$extends['role_id'] = 1;
|
||||
$extends['parent_id'] = 0;
|
||||
}else{
|
||||
$inviter_user = UserModel::where('invite_code',$invite_code)->field('group,id')->find();
|
||||
$inviter_user = UserModel::where('invite_code',$invite_code)->field('group_id,id')->find();
|
||||
if(!$inviter_user){
|
||||
return $this->error(__('Invalid invite code'));
|
||||
}
|
||||
@@ -166,12 +175,6 @@ class CommonController extends BaseController{
|
||||
}else{
|
||||
//return $this->error(__('Invalid invite code'));
|
||||
}
|
||||
$extends = [
|
||||
'role_id' => 1,
|
||||
'group_id' => 0,
|
||||
'nickname' => input('nickname'),
|
||||
'avatar' => '/static/img/avatar.png',
|
||||
];
|
||||
// validate(\app\validate\User::class)
|
||||
// ->scene('edit')
|
||||
// ->check([
|
||||
@@ -209,26 +212,28 @@ class CommonController extends BaseController{
|
||||
$email = input('email');
|
||||
$password = input('password');
|
||||
$type = input(param: 'type');
|
||||
if (!$password) {
|
||||
return $this->fail(__('Invalid username or password').'0');
|
||||
}
|
||||
if($type == 'mobile'){
|
||||
if (!$mobile ) {
|
||||
return $this->fail(__('Invalid username or password').'1');
|
||||
return $this->fail(__('Invalid username or password'));
|
||||
}
|
||||
$username = $mobile;
|
||||
}else if($type == 'email'){
|
||||
if (!$email ) {
|
||||
return $this->fail(__('Invalid username or password').'2');
|
||||
return $this->fail(__('Invalid username or password'));
|
||||
}
|
||||
$username = $email;
|
||||
}else{
|
||||
if (!$username ) {
|
||||
return $this->fail(__('Invalid username or password').'3');
|
||||
return $this->fail(__('Invalid username or password'));
|
||||
}
|
||||
}
|
||||
try{
|
||||
$user = \support\Jwt::login($username, $password,$type);
|
||||
if ($password) {
|
||||
//return $this->fail(__('Invalid username or password'));
|
||||
$user = \support\Jwt::login($username, $password,$type);
|
||||
}else{
|
||||
$user = \support\Jwt::login($username, $password,$type,'code');
|
||||
}
|
||||
if($user === false){
|
||||
return $this->fail(\support\Jwt::getError());
|
||||
}
|
||||
@@ -421,7 +426,8 @@ class CommonController extends BaseController{
|
||||
$key = 'captcha_'.$event.'_'.$mobile;
|
||||
$list = cache($key);
|
||||
$list = $list ?:[];
|
||||
$expris = 60;
|
||||
$expris = 300;
|
||||
|
||||
if(cache('?exp_'.$key)){
|
||||
if(cache('exp_'.$key)+$expris > time()){
|
||||
return $this->fail(__('Only one verification code can be sent within %second% seconds',['%second%'=>$expris]));
|
||||
|
||||
Reference in New Issue
Block a user