feat: 完善商品计奖隔离、积分商城兑换券抵扣与下线售后退款入口
这个提交包含在:
@@ -88,4 +88,40 @@ class RateService
|
||||
}
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* 汇总指定时间区间内所有合格订单中“计奖商品”的实付总额(排除非计奖商品及活动不参与项)
|
||||
*/
|
||||
public function qualifiedGmv($start = null, $end = null)
|
||||
{
|
||||
$goodsTable = (new CommissionGoods())->getQuery()->getTable();
|
||||
$orderTable = (new OrderModel())->getQuery()->getTable();
|
||||
$itemTable = \think\Db::name('shopro_order_item')->getTable();
|
||||
|
||||
$query = \think\Db::table($itemTable)->alias('oi')
|
||||
->join($orderTable . ' o', 'o.id = oi.order_id')
|
||||
->join($goodsTable . ' cg', 'cg.goods_id = oi.goods_id')
|
||||
->where('o.type', '<>', 'score')
|
||||
->where('o.pay_fee', '>', 0)
|
||||
->whereIn('o.status', [OrderModel::STATUS_PAID, OrderModel::STATUS_COMPLETED])
|
||||
->where('cg.status', CommissionGoods::GOODS_COMMISSION_STATUS_ON)
|
||||
->where(function ($q) {
|
||||
$q->whereNull('oi.ext')
|
||||
->whereOr('oi.ext', '')
|
||||
->whereOr(function ($sq) {
|
||||
$sq->where('oi.ext', 'not like', '%"is_commission":false%')
|
||||
->where('oi.ext', 'not like', '%"is_commission":0%');
|
||||
});
|
||||
});
|
||||
|
||||
if ($start !== null) {
|
||||
$query->where('o.paid_time', '>=', $start);
|
||||
}
|
||||
if ($end !== null) {
|
||||
$query->where('o.paid_time', '<=', $end);
|
||||
}
|
||||
|
||||
$gmv = $query->sum('oi.pay_fee');
|
||||
return round((float) $gmv, 2);
|
||||
}
|
||||
}
|
||||
|
||||
在新工单中引用
屏蔽一个用户