|
@@ -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;
|
|
|
+ }
|
|
|
}
|