Browse Source

邀请新用户注册赠送钻石

lizhen_gitee 8 months ago
parent
commit
96bf5d5bc9

+ 24 - 0
application/api/controller/User.php

@@ -775,6 +775,18 @@ class User extends Api
             $this->error('修改资料失败');
         }
 
+        //给上级发放钻石
+        if(isset($data['intro_uid'])){
+            $intro_jewel = config('site.new_user_intro_jewel');
+            if($intro_jewel > 0){
+                $rs_wallet = model('wallet')->lockChangeAccountRemain($data['intro_uid'], 0,'jewel',$intro_jewel,34,'邀请'.$this->auth->username.'注册奖励');
+                if($rs_wallet['status'] === false){
+                    Db::rollback();
+                    $this->error('邀请新人奖励赠送失败');
+                }
+            }
+        }
+
         //tag任务赠送金币
         //上传头像加5金币
         if(isset($data['avatar'])){
@@ -1267,6 +1279,18 @@ class User extends Api
             $this->error('修改失败');
         }
 
+        //给上级发放钻石
+        if(isset($data['intro_uid'])){
+            $intro_jewel = config('site.new_user_intro_jewel');
+            if($intro_jewel > 0){
+                $rs_wallet = model('wallet')->lockChangeAccountRemain($data['intro_uid'], 0,'jewel',$intro_jewel,34,'邀请'.$this->auth->username.'注册奖励');
+                if($rs_wallet['status'] === false){
+                    Db::rollback();
+                    $this->error('邀请新人奖励赠送失败');
+                }
+            }
+        }
+
         //上传头像加5金币
         if(isset($data['avatar'])){
             $task_rs = \app\common\model\TaskLog::tofinish($this->auth->id,19);

+ 2 - 2
application/common/library/Auth.php

@@ -314,7 +314,7 @@ class Auth
     }
     public function openid_register($wechat_openid = '', $extend = [])
     {
-
+        exit;
         if ($wechat_openid && User::getByOpenid($wechat_openid)) {
             $this->setError('openid已存在');
             return false;
@@ -403,7 +403,7 @@ class Auth
 
     public function iosopenid_register($ios_openid = '', $extend = [])
     {
-
+        exit;
 //        if ($ios_openid && User::getByOpenid($ios_openid)) {
 //            $this->setError('openid已存在');
 //            return false;

+ 1 - 0
application/extra/site.php

@@ -98,4 +98,5 @@ return array (
   'boy_vip_free_greet_num' => '5',
   'rmb_to_gold' => '10',
   'withdraw_min_money' => '100',
+  'new_user_intro_jewel' => '100',
 );

+ 1 - 0
application/extra/wallet.php

@@ -24,6 +24,7 @@ return [
 
 
         33 => '聊天赠送礼物',//jewel 减少
+        34 => '邀请新人注册奖励',//jewel增加
         35 => '充值金币赠送',//jewel 增加
         36 => '钻石转赠',//jewel 减少
         37 => '钻石获赠',//jewel 增加