|
@@ -135,7 +135,7 @@ class Alltools {
|
|
|
}
|
|
|
|
|
|
//充值后奖金
|
|
|
- public function recharge($user_id,$gold,$table,$payorder_id){
|
|
|
+ public function recharge($user_id,$gold,$table,$payorder_id,$remark = '',$times = 0){
|
|
|
|
|
|
//充值者本人
|
|
|
$userinfo = DB::table('mt_user')->select(['id','username','group_id','intro_uid','invite_uid','agent_id','gender'])->where('id',$user_id)->first();
|
|
@@ -143,17 +143,27 @@ class Alltools {
|
|
|
//配置
|
|
|
$config_site = DB::table('mt_config')->whereIn('name',['invite_recharge_rate','recharge_b2a_rate','recharge_c2a_rate','recharge_d2c_rate','recharge_c2a_rate'])->pluck('value','name');
|
|
|
|
|
|
+ //备注
|
|
|
+ $remark = !empty($remark) ? $remark : $userinfo->username.'充值';
|
|
|
+
|
|
|
//个人直推邀请充值
|
|
|
if(!empty($userinfo->invite_uid) && $userinfo->gender == 1 && empty($userinfo->intro_uid)){
|
|
|
$recharge_invite_rate = $config_site['invite_recharge_rate'];
|
|
|
$jewel = bcdiv(bcmul($gold,$recharge_invite_rate,1),100,1);
|
|
|
|
|
|
- $result = $this->lockChangeAccountRemain($userinfo->invite_uid,'jewel',$jewel,41, $userinfo->username.'充值','pay_order',$payorder_id);
|
|
|
+ $result = $this->lockChangeAccountRemain($userinfo->invite_uid,'jewel',$jewel,41, $remark,'pay_order',$payorder_id);
|
|
|
if($result['status']===false)
|
|
|
{
|
|
|
//Db::rollback();
|
|
|
return false;
|
|
|
}
|
|
|
+
|
|
|
+ //D2C,C2A
|
|
|
+ $invite_info = DB::table('mt_user')->select(['id','username','group_id','intro_uid','invite_uid','agent_id','gender'])->where('id',$userinfo->invite_uid)->first();
|
|
|
+ if(!empty($invite_info['intro_uid']) && $times == 0){
|
|
|
+ $times = 1;//可以执行的次数
|
|
|
+ $this->recharge($userinfo->invite_uid,$jewel,'pay_order',$payorder_id,$remark,$times);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//没有推荐人,女性充值不返
|
|
@@ -174,7 +184,7 @@ class Alltools {
|
|
|
$recharge_b2a_rate = $config_site['recharge_b2a_rate'];
|
|
|
$jewelA = bcdiv(bcmul($gold,$recharge_b2a_rate),100);
|
|
|
|
|
|
- $result = $this->lockChangeAccountRemain($intro_userinfo->id,'agentjewel',$jewelA,51, $userinfo->username.'充值','pay_order',$payorder_id);
|
|
|
+ $result = $this->lockChangeAccountRemain($intro_userinfo->id,'agentjewel',$jewelA,51, $remark,'pay_order',$payorder_id);
|
|
|
if($result['status']===false)
|
|
|
{
|
|
|
//Db::rollback();
|
|
@@ -196,7 +206,7 @@ class Alltools {
|
|
|
$recharge_b2a_rate = $config_site['recharge_b2a_rate'];//b2a 与 b02a相等
|
|
|
$jewelA = bcdiv(bcmul($gold,$recharge_b2a_rate),100);
|
|
|
|
|
|
- $result = $this->lockChangeAccountRemain($intro_userinfo->id,'agentjewel',$jewelA,51, $userinfo->username.'充值','pay_order',$payorder_id);
|
|
|
+ $result = $this->lockChangeAccountRemain($intro_userinfo->id,'agentjewel',$jewelA,51, $remark,'pay_order',$payorder_id);
|
|
|
if($result['status']===false)
|
|
|
{
|
|
|
//Db::rollback();
|
|
@@ -224,7 +234,7 @@ class Alltools {
|
|
|
$recharge_c2a_rate = $config_site['recharge_c2a_rate'];
|
|
|
$jewelA = bcdiv(bcmul($gold,$recharge_c2a_rate),100);
|
|
|
|
|
|
- $result = $this->lockChangeAccountRemain($intro_intro_userinfo->id,'agentjewel',$jewelA,51, $userinfo->username.'充值','pay_order',$payorder_id);
|
|
|
+ $result = $this->lockChangeAccountRemain($intro_intro_userinfo->id,'agentjewel',$jewelA,51, $remark,'pay_order',$payorder_id);
|
|
|
if($result['status']===false)
|
|
|
{
|
|
|
//Db::rollback();
|
|
@@ -241,7 +251,7 @@ class Alltools {
|
|
|
$recharge_c2a_rate = $config_site['recharge_c2a_rate'];//b2a 与 b02a相等
|
|
|
$jewelA = bcdiv(bcmul($gold,$recharge_c2a_rate),100);
|
|
|
|
|
|
- $result = $this->lockChangeAccountRemain($intro_userinfo->id,'agentjewel',$jewelA,51, $userinfo->username.'充值','pay_order',$payorder_id);
|
|
|
+ $result = $this->lockChangeAccountRemain($intro_userinfo->id,'agentjewel',$jewelA,51, $remark,'pay_order',$payorder_id);
|
|
|
if($result['status']===false)
|
|
|
{
|
|
|
//Db::rollback();
|