Browse Source

提现,奖金

lizhen_gitee 1 year ago
parent
commit
96d40326d5
2 changed files with 31 additions and 2 deletions
  1. 29 0
      application/admin/controller/Takecash.php
  2. 2 2
      application/api/controller/Notify.php

+ 29 - 0
application/admin/controller/Takecash.php

@@ -100,6 +100,12 @@ class Takecash extends Backend
             if($status == 1){
                 //系统消息
                 $msg_id = \app\common\model\Message::addMessage($info['user_id'],'提现审核','提现审核已经通过');
+
+                $shouyi_result = $this->takecash($info['user_id'],$info['jewel'],'take_cash',$id);
+                if($shouyi_result !== true){
+                    Db::rollback();
+                    $this->error($shouyi_result);
+                }
             }elseif($status == 2){
                 //还钱
                 $wallet_rs = model('wallet')->lockChangeAccountRemain($info['user_id'],'jewel',$info['jewel'],31,'提现被拒返回:'.$info['jewel'],'take_cash',$info['id']);
@@ -124,4 +130,27 @@ class Takecash extends Backend
         $this->assign('row',$info);
         return $this->view->fetch();
     }
+
+    //普通邀请关系,提现
+    public function takecash($user_id,$gold,$table,$table_id){
+        //精确小数点
+        bcscale(1);
+
+        //收益者本人
+        $userinfo = Db::name('user')->field('id,username,group_id,intro_uid,invite_uid,gender')->where('id',$user_id)->find();
+
+        //提现往上(直推)返一级
+        if(!empty($userinfo['invite_uid'])){
+            $takecash_invite_rate = config('site.invite_takecash_rate');
+            $jewel = bcdiv(bcmul($gold,$takecash_invite_rate),100);
+
+            $result = model('Wallet')->lockChangeAccountRemain($userinfo['invite_uid'],'jewel',$jewel,42, $userinfo['username'].'提现',$table,$table_id);
+            if($result['status']===false)
+            {
+                return $result['msg'];
+            }
+        }
+
+        return true;
+    }
 }

+ 2 - 2
application/api/controller/Notify.php

@@ -112,7 +112,7 @@ class Notify extends Api
     }
 
     //普通邀请关系,提现
-    public function takecash($user_id,$gold,$table,$table_id){
+    /*public function takecash($user_id,$gold,$table,$table_id){
         //精确小数点
         bcscale(1);
 
@@ -133,7 +133,7 @@ class Notify extends Api
         }
 
         return true;
-    }
+    }*/
 
     //四大收益,视频,音频,私聊,礼物
     public function shouyi($user_id,$gold,$table,$table_id){