|
@@ -290,13 +290,11 @@ class Auth extends \ba\Auth
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- public function WxRegister(string $nickname, string $mobile, string $openid, string $unionid,string $avatar,$group=1,array $extend=[]){
|
|
|
+ public function WxRegister(string $openid, string $unionid,string $nickname='', string $mobile='',string $avatar='',
|
|
|
+ $group=1,array $extend=[]){
|
|
|
$validate = Validate::rule([
|
|
|
- 'mobile' => 'mobile|unique:user',
|
|
|
- 'openid' => 'require|unique:user',
|
|
|
+ 'openid' => 'require|unique:user,openid^unionid',
|
|
|
'unionid' => 'max:255',
|
|
|
- 'nickname' => 'max:255',
|
|
|
- 'avatar' => 'url',
|
|
|
]);
|
|
|
$params = [
|
|
|
'nickname' => $nickname,
|
|
@@ -314,9 +312,8 @@ class Auth extends \ba\Auth
|
|
|
$time = time();
|
|
|
$salt = Random::build('alnum', 16);
|
|
|
$data = [
|
|
|
- 'password' => encrypt_password(substr($mobile,3,6), $salt),
|
|
|
+ 'password' => '',
|
|
|
'group_id' => $group,
|
|
|
- 'nickname' => $nickname=='' ? substr_replace($mobile, '****', 3, 4) : $nickname,
|
|
|
'joinip' => $ip,
|
|
|
'jointime' => $time,
|
|
|
'lastloginip' => $ip,
|