diff --git a/plugins/cultural-space/src/admin/IndexController.php b/plugins/cultural-space/src/admin/IndexController.php index 4d84e3fb..476aeaba 100644 --- a/plugins/cultural-space/src/admin/IndexController.php +++ b/plugins/cultural-space/src/admin/IndexController.php @@ -43,6 +43,8 @@ class IndexController extends BaseController{ // (new ContributionBonusLog())->bonusInit(); // (new ContributionBonusLog())->contributionBonusSettlement(); + + debug(["结束" => time()]); } diff --git a/plugins/cultural-space/src/models/ContributionBonusLog.php b/plugins/cultural-space/src/models/ContributionBonusLog.php index 1c96f28e..7d914378 100644 --- a/plugins/cultural-space/src/models/ContributionBonusLog.php +++ b/plugins/cultural-space/src/models/ContributionBonusLog.php @@ -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);