修复:贡献值分红 商品总价计算错误的问题

This commit is contained in:
wuhui_zzw 2023-12-07 19:46:03 +08:00
parent 83a79b49af
commit 80d65469d1
2 changed files with 18 additions and 7 deletions

View File

@ -43,6 +43,8 @@ class IndexController extends BaseController{
// (new ContributionBonusLog())->bonusInit();
// (new ContributionBonusLog())->contributionBonusSettlement();
debug(["结束" => time()]);
}

View File

@ -125,13 +125,22 @@ class ContributionBonusLog extends BaseModel{
\Log::debug("未开启贡献值或者分红总额比例为0或未设置",\YunShop::app()->uniacid);
return false;
}
// 判断:是否存在分红总金额
$this->orderTotalMoney = (float)Order::uniacid()
->where('pay_time','>=',$startTime)
->where('pay_time','<',$endTime)
->where('price','>',0)
->whereIn('status',[Order::WAIT_SEND,Order::WAIT_RECEIVE,Order::COMPLETE])
->sum('price');
// 判断:是否存在分红总金额 分红总金额,仅计算参与文创空间的商品的销售额
$this->orderTotalMoney = (float)OrderGoods::uniacid()
->leftjoin('yz_order','yz_order.id','=','yz_order_goods.order_id')
->leftjoin('yz_goods_cultural_space','yz_goods_cultural_space.goods_id','=','yz_order_goods.goods_id')
->where('yz_goods_cultural_space.is_open',1)
->where('yz_order.pay_time','>=',$startTime)
->where('yz_order.pay_time','<',$endTime)
->where('yz_order.price','>',0)
->whereIn('yz_order.status',[Order::WAIT_SEND,Order::WAIT_RECEIVE,Order::COMPLETE])
->sum('yz_order_goods.price');
// $this->orderTotalMoney = (float)Order::uniacid()
// ->where('pay_time','>=',$startTime)
// ->where('pay_time','<',$endTime)
// ->where('price','>',0)
// ->whereIn('status',[Order::WAIT_SEND,Order::WAIT_RECEIVE,Order::COMPLETE])
// ->sum('price');
$this->bonusTotalMoney = (float)sprintf("%.2f",$this->orderTotalMoney * (float)$set['contribution_bonus_ratio'] / 100);
if($this->bonusTotalMoney <= 0) {
\Log::debug("分红总金额为0",\YunShop::app()->uniacid);