|
@@ -158,12 +158,68 @@ class Notify extends Api
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
- //上级是普通用户,则上级可能是C1、D1,再向上找到B
|
|
|
+ //上级是普通用户,那自己肯定也是普通,则上级可能是D1、C1,找到上上级,如果也是普通C1,停止。如果上上级是B1,则一直追到A1
|
|
|
+ if($intro_userinfo['group_id'] == 1){
|
|
|
+ //先给上级普通用户返
|
|
|
+ $recharge_d2c_rate = config('site.recharge_d2c_rate');//d2c 或 e2d
|
|
|
+ $jewel = bcdiv(bcmul($gold,$recharge_d2c_rate),100);
|
|
|
+
|
|
|
+ $result = model('Wallet')->lockChangeAccountRemain($intro_userinfo['id'],'jewel',$jewel,41, $userinfo['username'].'充值','pay_order',$payorder_id);
|
|
|
+ if($result['status']===false)
|
|
|
+ {
|
|
|
+ Db::rollback();
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ //充值者上上级
|
|
|
+ $intro_intro_userinfo = Db::name('user')->field('id,username,group_id,intro_uid,gender')->where('id',$intro_userinfo['intro_uid'])->find();
|
|
|
+ if(empty($intro_intro_userinfo)){return true;}
|
|
|
+
|
|
|
+ //上上级也是普通C1,说明自己在E1,上级是D1,停止
|
|
|
+ if($intro_intro_userinfo['group_id'] == 1){
|
|
|
+ return true;
|
|
|
+ }
|
|
|
|
|
|
+ //上上级是B1,上级是C1,自己是D1,
|
|
|
+ if($intro_intro_userinfo['group_id'] == 2){
|
|
|
|
|
|
+ //先给B1
|
|
|
+ $recharge_c2b_rate = config('site.recharge_c2b_rate');
|
|
|
+ $jewel = bcdiv(bcmul($gold,$recharge_c2b_rate),100);
|
|
|
|
|
|
+ $result = model('Wallet')->lockChangeAccountRemain($intro_intro_userinfo['id'],'jewel',$jewel,41, $userinfo['username'].'充值','pay_order',$payorder_id);
|
|
|
+ if($result['status']===false)
|
|
|
+ {
|
|
|
+ Db::rollback();
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ //充值者上上级,也就是A
|
|
|
+ $intro_intro_intro_userinfo = Db::name('user')->field('id,username,group_id,intro_uid,gender')->where('id',$intro_intro_userinfo['intro_uid'])->find();
|
|
|
+ if(empty($intro_intro_intro_userinfo)){return true;}
|
|
|
+
|
|
|
+ if($intro_intro_intro_userinfo['group_id'] == 3){
|
|
|
+
|
|
|
+ $recharge_b2a_rate = config('site.recharge_b2a_rate');
|
|
|
+ $jewel = bcdiv(bcmul($jewel,$recharge_b2a_rate),100);
|
|
|
+
|
|
|
+ $result = model('Wallet')->lockChangeAccountRemain($intro_intro_intro_userinfo['id'],'jewel',$jewel,41, $userinfo['username'].'充值','pay_order',$payorder_id);
|
|
|
+ if($result['status']===false)
|
|
|
+ {
|
|
|
+ Db::rollback();
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
|