|
|
@@ -239,6 +239,17 @@ class PartnerTools{
|
|
|
if(empty($bottomData)){
|
|
|
return false;
|
|
|
}
|
|
|
+ //合伙人账户
|
|
|
+ $bottomPartnerData = $this->getPartnerData($bottomData["parentData"]["id"], $bottomData["parentData"]["userCenterId"]);
|
|
|
+ if(empty($bottomPartnerData)){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
//计算顶层收益
|
|
|
$topData = $this->calcMoney($bottomData["parentData"],$bottomData["commission"]);
|
|
|
if(!empty($topData)){
|
|
|
@@ -274,6 +285,7 @@ class PartnerTools{
|
|
|
"isUpgrade"=>$bottomData["isUpgrade"],
|
|
|
"mono"=>"",
|
|
|
"time"=>$nowTime,
|
|
|
+ "partnerId"=>$bottomPartnerData["id"],
|
|
|
];
|
|
|
//添加佣金余额和明细
|
|
|
//可以新建一个佣金余额表newCommissionPartner
|
|
|
@@ -282,17 +294,46 @@ class PartnerTools{
|
|
|
|
|
|
|
|
|
|
|
|
- //佣金更新完后验证设置合伙人
|
|
|
- if($bottomData["isUpgrade"]==1){
|
|
|
- $this->setPartner($bottomData["childId"]);
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
+ //佣金更新完后验证设置合伙人
|
|
|
+ if($bottomData["isUpgrade"]==1){
|
|
|
+ $this->setPartner($bottomData["childId"]);
|
|
|
+ }
|
|
|
return $data;
|
|
|
}
|
|
|
|
|
|
+ public function getPartnerData($customerId,$userCenterId){
|
|
|
+ if(empty($customerId)){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ $partnerData = $this->dbNewCommissionPartner->get(["customerId"=>$customerId]);
|
|
|
+ if(empty($partnerData)){
|
|
|
+ $nowTime = time();
|
|
|
+ $partnerData=[
|
|
|
+ "userCenterId"=>$userCenterId,
|
|
|
+ "customerId"=>$customerId,
|
|
|
+ "balance"=>0,
|
|
|
+ "waitMoney"=>0,
|
|
|
+ "withdraw"=>0,
|
|
|
+ "totalMoney"=>0,
|
|
|
+ "deleteStatus"=>5,
|
|
|
+ "createTime"=>$nowTime,
|
|
|
+ "updateTime"=>$nowTime,
|
|
|
+ "expand"=>"",
|
|
|
+ ];
|
|
|
+ $partnerId = $this->dbNewCommissionPartner->insert($partnerData);
|
|
|
+ if(empty($partnerId)){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ $partnerData["id"] = $partnerId;
|
|
|
+ }
|
|
|
+ return $partnerData;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 删除用户缓存
|