Browse Source

邀请用户注册,赠送奖励

lizhen_gitee 1 year ago
parent
commit
d96347390b

+ 1 - 10
application/admin/controller/Useridconfirm.php

@@ -72,7 +72,7 @@ class Useridconfirm extends Backend
     }
 
     /**
-     * 审核
+     * 审核,废弃
      */
     public function audit(){
         $id = input('id');
@@ -115,15 +115,6 @@ class Useridconfirm extends Backend
                     $this->error('完成任务赠送奖励失败');
                 }
 
-                //邀请人拿奖励,男性3元
-                $intro_money = $userinfo['gender'] == 1 ? config('site.intro_man_money') : config('site.intro_woman_money');
-                if($userinfo['real_status'] == 1 && !empty($userinfo['intro_uid']) && $intro_money > 0){
-                    $task_rs = model('wallet')->lockChangeAccountRemain($userinfo['intro_uid'],'money',$intro_money,63,$remark='');
-                    if($task_rs['status'] === false){
-                        Db::rollback();
-                        $this->error($task_rs['msg']);
-                    }
-                }
 
                 //系统消息
                 $msg_id = \app\common\model\Message::addMessage($info['user_id'],'实名认证','实名认证已经审核通过');

+ 26 - 0
application/common/library/Auth.php

@@ -262,6 +262,19 @@ class Auth
             //注册用户权限
             Db::name('user_power')->insertGetId(['user_id'=>$user->id]);
 
+            //邀请用户注册,给邀请人奖励
+            if(isset($extend['intro_uid']) && !empty($extend['intro_uid'])){
+                $intro_gold = config('site.intro_newuser_gift_goldnum') ?: 0;
+                if($intro_gold > 0){
+                    $wallet_rs = model('wallet')->lockChangeAccountRemain($extend['intro_uid'],'gold',$intro_gold,63,'邀请'.$this->_user->username);
+                    if($wallet_rs['status'] === false){
+                        $this->setError($wallet_rs['msg']);
+                        Db::rollback();
+                        return false;
+                    }
+                }
+            }
+
             //注册成功的事件
             Hook::listen("user_register_successed", $this->_user, $data);
             Db::commit();
@@ -325,6 +338,19 @@ class Auth
             //注册用户权限
             Db::name('user_power')->insertGetId(['user_id'=>$user->id]);
 
+            //邀请用户注册,给邀请人奖励
+            if(isset($extend['intro_uid']) && !empty($extend['intro_uid'])){
+                $intro_gold = config('site.intro_newuser_gift_goldnum') ?: 0;
+                if($intro_gold > 0){
+                    $wallet_rs = model('wallet')->lockChangeAccountRemain($extend['intro_uid'],'gold',$intro_gold,63,'邀请'.$this->_user->username);
+                    if($wallet_rs['status'] === false){
+                        $this->setError($wallet_rs['msg']);
+                        Db::rollback();
+                        return false;
+                    }
+                }
+            }
+
             //注册成功的事件
             Hook::listen("user_register_successed", $this->_user, $data);
             Db::commit();

+ 1 - 3
application/extra/site.php

@@ -47,9 +47,6 @@ return array (
   'money_to_gold' => '10',
   'user_sign_gift_vipdays' => '1',
   'gift_plat_scale' => '60',
-  'unlock_like_me' => '30',
-  'intro_man_money' => '1',
-  'intro_woman_money' => '2',
   'apkurl' => 'https://www.pgyer.com/5Y0t',
   'comment_for_gold_switch' => '1',
   'comment_for_gold_price' => '10',
@@ -73,4 +70,5 @@ return array (
 2、每个提现额度,每日可提现3次
 3、提现扣除手续费1%
 4、相关额度会在1个工作日内审核发放,请注意查收',
+  'intro_newuser_gift_goldnum' => '100',
 );

+ 2 - 2
application/extra/wallet.php

@@ -4,7 +4,7 @@
  */
 return [
     'logtype' => [
-        1 => '系统调节',
+        1 => '系统调节',//gold + -
 
 
         10 => '金币充值',//gold +
@@ -25,7 +25,7 @@ return [
 
 
         61 => '完成个人任务',
-        63 => '邀请注册奖励',//money
+        63 => '邀请注册奖励',//gold +
 
     ],
     'moneyname' => [