|
@@ -447,7 +447,7 @@ class PartnerTools{
|
|
|
* @param type $type 1表示子级消费,2表示合伙人收益
|
|
|
* @return bool
|
|
|
*/
|
|
|
- public function calcMoney($customerData,$money){
|
|
|
+ public function calcMoney($customerData,$money,$type=0){
|
|
|
if(empty($this->commissionSettingData) || empty($this->commissionSettingData["is_open"]) || $this->commissionSettingData["levMoney"]<=0){
|
|
|
return false;
|
|
|
}
|
|
@@ -455,14 +455,14 @@ class PartnerTools{
|
|
|
$parentData = $this->getParentPartner($customerData);
|
|
|
if(empty($parentData) || $parentData["isPartner"]==0){
|
|
|
//上级合伙人不存在
|
|
|
- if($money>=$this->commissionSettingData["levMoney"] && $customerData["isPartner"]==0){
|
|
|
+ if($type==0 && $money>=$this->commissionSettingData["levMoney"] && $customerData["isPartner"]==0){
|
|
|
$this->setPartner($customerData["id"]);
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
- $per = $this->commissionSettingData["incomePer"];
|
|
|
+ $per = $type==1 ? $this->commissionSettingData["partnerPer"] : $this->commissionSettingData["incomePer"];
|
|
|
$isUpgrade = 0;
|
|
|
- if($money>=$this->commissionSettingData["levMoney"] && $customerData["isPartner"]==0){
|
|
|
+ if($type==0 && $money>=$this->commissionSettingData["levMoney"] && $customerData["isPartner"]==0){
|
|
|
$per = $this->commissionSettingData["levPer"];
|
|
|
$isUpgrade = 1;
|
|
|
}
|
|
@@ -555,7 +555,7 @@ class PartnerTools{
|
|
|
$data=[];
|
|
|
$nowTime = time();
|
|
|
//计算低层收益
|
|
|
- $bottomData = $this->calcMoney($customerData,$orderMoney);
|
|
|
+ $bottomData = $this->calcMoney($customerData,$orderMoney,0);
|
|
|
if(empty($bottomData)){
|
|
|
return ["code"=>-1,"msg"=>"上级合伙人不存在"];
|
|
|
}
|
|
@@ -588,7 +588,7 @@ class PartnerTools{
|
|
|
|
|
|
|
|
|
//计算顶层收益
|
|
|
- $topData = $this->calcMoney($bottomData["parentData"],$bottomData["commission"]);
|
|
|
+ $topData = $this->calcMoney($bottomData["parentData"],$bottomData["commission"],1);
|
|
|
if(!empty($topData)){
|
|
|
$topPartnerData = $this->getPartnerData($topData["parentData"]["id"], $topData["parentData"]["userCenterId"]);
|
|
|
if(empty($topPartnerData)){
|