|
@@ -153,12 +153,65 @@ class Notify extends Api
|
|
|
//收益者本人
|
|
|
$userinfo = Db::name('user')->field('id,username,group_id,intro_uid,invite_uid,gender')->where('id',$user_id)->find();
|
|
|
|
|
|
- //没有推荐人,自己等级最高,女性充值不返
|
|
|
- if(empty($userinfo['intro_uid']) || $userinfo['group_id'] == 3 || $userinfo['gender'] == 0){
|
|
|
+ //没有推荐人,自己等级最高
|
|
|
+ if(empty($userinfo['intro_uid']) || $userinfo['group_id'] == 3){
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ //充值者上级
|
|
|
+ $intro_userinfo = Db::name('user')->field('id,username,group_id,intro_uid,gender')->where('id',$userinfo['intro_uid'])->find();
|
|
|
+ if(empty($intro_userinfo)){return true;}
|
|
|
+
|
|
|
+ //上级是一级邀请A,本人为B普、B1(二级邀请人),贡献给A
|
|
|
+ if($intro_userinfo['group_id'] == 3){
|
|
|
+
|
|
|
+ $shouyi_b2a_rate = config('site.shouyi_b2a_rate');//b2a 与 b02a相等
|
|
|
+ $jewelA = bcdiv(bcmul($gold,$shouyi_b2a_rate),100);
|
|
|
|
|
|
+ $result = model('Wallet')->lockChangeAccountRemain($intro_userinfo['id'],'agentjewel',$jewelA,52, $userinfo['username'].$remark,$table,$table_id);
|
|
|
+ if($result['status']===false)
|
|
|
+ {
|
|
|
+ Db::rollback();
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;//结束了
|
|
|
+ }
|
|
|
+
|
|
|
+ //上级是二级邀请B1,本人C1,贡献给B和A(表面上说B的钱在A那里,但是有记录,有总额,不能提现即可)
|
|
|
+ if($intro_userinfo['group_id'] == 2 && $intro_userinfo['group_id'] > $userinfo['group_id']){
|
|
|
+ $shouyi_c2b_rate = config('site.shouyi_c2b_rate');
|
|
|
+ $jewelB = bcdiv(bcmul($gold,$shouyi_c2b_rate),100);
|
|
|
+
|
|
|
+ $result = model('Wallet')->lockChangeAccountRemain($intro_userinfo['id'],'agentjewel',$jewelB,52, $userinfo['username'].$remark,$table,$table_id);
|
|
|
+ if($result['status']===false)
|
|
|
+ {
|
|
|
+ Db::rollback();
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ //充值者上上级,也就是A
|
|
|
+ $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;}
|
|
|
+
|
|
|
+ if($intro_intro_userinfo['group_id'] == 3){
|
|
|
+
|
|
|
+ $shouyi_b2a_rate = config('site.shouyi_b2a_rate');
|
|
|
+ $jewelA = bcdiv(bcmul($jewelB,$shouyi_b2a_rate),100);
|
|
|
+// $jewelA = bcadd($jewelA,$jewelB);
|
|
|
+
|
|
|
+ $result = model('Wallet')->lockChangeAccountRemain($intro_intro_userinfo['id'],'agentjewel',$jewelA,52, $userinfo['username'].$remark,$table,$table_id);
|
|
|
+ if($result['status']===false)
|
|
|
+ {
|
|
|
+ Db::rollback();
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
//充值后奖金
|
|
@@ -195,10 +248,10 @@ class Notify extends Api
|
|
|
//上级是一级邀请A,本人为B普、B1(二级邀请人),贡献给A
|
|
|
if($intro_userinfo['group_id'] == 3){
|
|
|
|
|
|
- $recharge_b2a_rate = config('site.recharge_b2a_rate');//b2a 与 c2a相等
|
|
|
+ $recharge_b2a_rate = config('site.recharge_b2a_rate');//b2a 与 b02a相等
|
|
|
$jewelA = bcdiv(bcmul($gold,$recharge_b2a_rate),100);
|
|
|
|
|
|
- $result = model('Wallet')->lockChangeAccountRemain($intro_userinfo['id'],'jewel',$jewelA,51, $userinfo['username'].'充值','pay_order',$payorder_id);
|
|
|
+ $result = model('Wallet')->lockChangeAccountRemain($intro_userinfo['id'],'agentjewel',$jewelA,51, $userinfo['username'].'充值','pay_order',$payorder_id);
|
|
|
if($result['status']===false)
|
|
|
{
|
|
|
Db::rollback();
|
|
@@ -209,11 +262,11 @@ class Notify extends Api
|
|
|
}
|
|
|
|
|
|
//上级是二级邀请B1,本人C1,贡献给B和A(表面上说B的钱在A那里,但是有记录,有总额,不能提现即可)
|
|
|
- if($intro_userinfo['group_id'] == 2){
|
|
|
+ if($intro_userinfo['group_id'] == 2 && $intro_userinfo['group_id'] > $userinfo['group_id']){
|
|
|
$recharge_c2b_rate = config('site.recharge_c2b_rate');
|
|
|
$jewelB = bcdiv(bcmul($gold,$recharge_c2b_rate),100);
|
|
|
|
|
|
- $result = model('Wallet')->lockChangeAccountRemain($intro_userinfo['id'],'jewel',$jewelB,51, $userinfo['username'].'充值','pay_order',$payorder_id);
|
|
|
+ $result = model('Wallet')->lockChangeAccountRemain($intro_userinfo['id'],'agentjewel',$jewelB,51, $userinfo['username'].'充值','pay_order',$payorder_id);
|
|
|
if($result['status']===false)
|
|
|
{
|
|
|
Db::rollback();
|
|
@@ -230,7 +283,7 @@ class Notify extends Api
|
|
|
$jewelA = bcdiv(bcmul($jewelB,$recharge_b2a_rate),100);
|
|
|
// $jewelA = bcadd($jewelA,$jewelB);
|
|
|
|
|
|
- $result = model('Wallet')->lockChangeAccountRemain($intro_intro_userinfo['id'],'jewel',$jewelA,51, $userinfo['username'].'充值','pay_order',$payorder_id);
|
|
|
+ $result = model('Wallet')->lockChangeAccountRemain($intro_intro_userinfo['id'],'agentjewel',$jewelA,51, $userinfo['username'].'充值','pay_order',$payorder_id);
|
|
|
if($result['status']===false)
|
|
|
{
|
|
|
Db::rollback();
|
|
@@ -243,12 +296,12 @@ class Notify extends Api
|
|
|
|
|
|
//上级是普通用户,那自己肯定也是普通,则上级可能是D1、C1,找到上上级,如果也是普通C1,停止。如果上上级是B1,则一直追到A1
|
|
|
//上级是普通,自己可能是B1,这种不考虑,因为上级只能用普通网,自己相当于独立于超推网里的新分支,是后台新升级来的
|
|
|
- if($intro_userinfo['group_id'] == 1){
|
|
|
+ if($intro_userinfo['group_id'] == 1 && $userinfo['group_id'] == 1){
|
|
|
//先给上级普通用户返
|
|
|
$recharge_d2c_rate = config('site.recharge_d2c_rate');//d2c 或 e2d
|
|
|
$jewelC = bcdiv(bcmul($gold,$recharge_d2c_rate),100);
|
|
|
|
|
|
- $result = model('Wallet')->lockChangeAccountRemain($intro_userinfo['id'],'jewel',$jewelC,51, $userinfo['username'].'充值','pay_order',$payorder_id);
|
|
|
+ $result = model('Wallet')->lockChangeAccountRemain($intro_userinfo['id'],'agentjewel',$jewelC,51, $userinfo['username'].'充值','pay_order',$payorder_id);
|
|
|
if($result['status']===false)
|
|
|
{
|
|
|
Db::rollback();
|
|
@@ -271,7 +324,7 @@ class Notify extends Api
|
|
|
$recharge_c2b_rate = config('site.recharge_c2b_rate');
|
|
|
$jewelB = bcdiv(bcmul($jewelC,$recharge_c2b_rate),100);
|
|
|
|
|
|
- $result = model('Wallet')->lockChangeAccountRemain($intro_intro_userinfo['id'],'jewel',$jewelB,51, $userinfo['username'].'充值','pay_order',$payorder_id);
|
|
|
+ $result = model('Wallet')->lockChangeAccountRemain($intro_intro_userinfo['id'],'agentjewel',$jewelB,51, $userinfo['username'].'充值','pay_order',$payorder_id);
|
|
|
if($result['status']===false)
|
|
|
{
|
|
|
Db::rollback();
|
|
@@ -288,7 +341,7 @@ class Notify extends Api
|
|
|
$jewelA = bcdiv(bcmul($jewelB,$recharge_b2a_rate),100);
|
|
|
// $jewelA = bcadd($jewelA,$jewelB);
|
|
|
|
|
|
- $result = model('Wallet')->lockChangeAccountRemain($intro_intro_intro_userinfo['id'],'jewel',$jewelA,51, $userinfo['username'].'充值','pay_order',$payorder_id);
|
|
|
+ $result = model('Wallet')->lockChangeAccountRemain($intro_intro_intro_userinfo['id'],'agentjewel',$jewelA,51, $userinfo['username'].'充值','pay_order',$payorder_id);
|
|
|
if($result['status']===false)
|
|
|
{
|
|
|
Db::rollback();
|