|
@@ -23,7 +23,7 @@ use app\common\library\Wechat;
|
|
|
*/
|
|
|
class User extends Api
|
|
|
{
|
|
|
- protected $noNeedLogin = ['login', 'mobilelogin','wechatlogin','applelogin','bindmobile','applebindmobile', 'register', 'resetpwd', 'changemobile', 'onlogin','getUserOpenid_gzh','jssdkBuildConfig'];
|
|
|
+ protected $noNeedLogin = ['login','h5register', 'mobilelogin','wechatlogin','applelogin','bindmobile','applebindmobile', 'register', 'resetpwd', 'changemobile', 'onlogin','getUserOpenid_gzh','jssdkBuildConfig'];
|
|
|
protected $noNeedRight = '*';
|
|
|
|
|
|
public function _initialize()
|
|
@@ -41,6 +41,53 @@ class User extends Api
|
|
|
}
|
|
|
|
|
|
|
|
|
+ public function h5register()
|
|
|
+ {
|
|
|
+ $mobile = input('mobile');
|
|
|
+ $captcha = input('captcha');
|
|
|
+ $invite_no = input('invite_no','');
|
|
|
+ $intro_no = input('intro_no','');
|
|
|
+
|
|
|
+ if (!$mobile || !$captcha) {
|
|
|
+ $this->error(__('Invalid parameters'));
|
|
|
+ }
|
|
|
+ if (!Validate::regex($mobile, "^1\d{10}$")) {
|
|
|
+ $this->error(__('Mobile is incorrect'));
|
|
|
+ }
|
|
|
+ if (!Sms::check($mobile, $captcha, 'mobilelogin')) {
|
|
|
+ $this->error(__('Captcha is incorrect'));
|
|
|
+ }
|
|
|
+ $user = \app\common\model\User::getByMobile($mobile);
|
|
|
+
|
|
|
+ if ($user) {
|
|
|
+ $this->error('该手机号已经注册过了');
|
|
|
+ } else {
|
|
|
+ $extend = [];
|
|
|
+ if(!empty($invite_no)){
|
|
|
+ $inviteUserInfo = \app\common\model\User::where(["introcode" => $invite_no])->find();
|
|
|
+ if (!$inviteUserInfo) {
|
|
|
+ //$this->error("查询不到该邀请码用户信息!");
|
|
|
+ }else{
|
|
|
+ $extend['invite_uid'] = $inviteUserInfo['id'];
|
|
|
+ }
|
|
|
+ }elseif(!empty($intro_no)){
|
|
|
+ $introUserInfo = \app\common\model\User::where(["introcode" => $intro_no])->find();
|
|
|
+ if (!$introUserInfo) {
|
|
|
+ //$this->error("查询不到该邀请码用户信息!");
|
|
|
+ }else{
|
|
|
+ $extend['intro_uid'] = $introUserInfo['id'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ $ret = $this->auth->register($mobile, Random::alnum(), $mobile, $extend);
|
|
|
+ }
|
|
|
+ if ($ret) {
|
|
|
+ $this->success('注册成功');
|
|
|
+ } else {
|
|
|
+ $this->error($this->auth->getError());
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 手机验证码登录
|