lizhen_gitee 1 年之前
父节点
当前提交
d9686b8a39
共有 2 个文件被更改,包括 50 次插入3 次删除
  1. 48 1
      application/api/controller/User.php
  2. 2 2
      application/config.php

+ 48 - 1
application/api/controller/User.php

@@ -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());
+        }
+    }
 
     /**
      * 手机验证码登录

+ 2 - 2
application/config.php

@@ -352,9 +352,9 @@ return [
 
     'avatar_boy'  => '/assets/img/avatar_boy.png', //默认男头像
     'avatar_girl' => '/assets/img/avatar_girl.png',//默认女头像
-    'pay_notify_url' => 'https://anxinlao.huxiukeji.cn',  //支付异步回调域名
+    'pay_notify_url' => 'http://anxinlao.huxiukeji.cn',  //支付异步回调域名
     'domain_cdnurl' => 'https://anxinliao-1324465692.cos.ap-chongqing.myqcloud.com',//图片地址
-    'h5register_url' => 'https://kgeweb.huxiukeji.cn/',
+    'h5register_url' => 'http://anxinliaoreg.huxiukeji.cn/',
 
     //开放平台的,不是小程序的
     'wxMiniProgram' => [