songxingwei 3 роки тому
батько
коміт
0c1471d230

+ 4 - 1
application/api/controller/Login.php

@@ -42,7 +42,10 @@ class Login extends Api
             $this->error('手机号格式错误');
         }
 
-        $us = User::register($phone,$password,$ver_code,$confirm_password);
+        if ($password!=$confirm_password){
+            $this->error('密码与确认密码不一致');
+        }
+        $us = User::register($phone,$password,$ver_code);
         if ($us['code']){
             $this->success($us['msg'],$us['data']);
         }else{

+ 1 - 12
application/common/model/User.php

@@ -37,7 +37,7 @@ class User Extends Model
     /**
      * 注册
      */
-    public static function register($phone,$password,$ver_code,$invite_code){
+    public static function register($phone,$password,$ver_code){
         $phone_use = self::where('phone',$phone)->find();
         if ($phone_use){
             return Common::return_error('手机号已注册!');
@@ -54,22 +54,11 @@ class User Extends Model
         }
 
         $data['phone'] = $phone;
-        $data['fid'] = $invite_code ? $invite_code : 0;
         $data['password'] = md5($password);
         $data['ip'] = request()->ip();
         Db::startTrans();
         try {
             self::create($data);
-            if ($invite_code){
-                CouponUser::create([
-                    'user_id'=>$invite_code,
-                    'coupon_title'=>'满100可用',
-                    'coupon_price'=>50,
-                    'use_min_price'=>100,
-                    'add_time'=>time(),
-                    'end_time'=>time()+(30*24*60*60),
-                ]);
-            }
             Db::commit();
             return Common::return_success('注册成功');
         }catch (Exception $e) {