批量发货、课程报表、秒杀排序

This commit is contained in:
wyn
2026-07-02 15:46:41 +08:00
parent dbcf3151bd
commit 76f96ae804
10 changed files with 361 additions and 56 deletions

View File

@@ -96,16 +96,49 @@
DATE_FORMAT(IF(bo.success_time is null,bo.create_time,bo.success_time),'%Y-%m-%d %H:%i:%s') payTime,
bo.order_sn orderSn,pzo.trade_no zfbOrder,
0 beginDay,IFNULL(spc.days,0) days,
ROUND(bor.fee/(select count(1) from buy_order_product bop2
inner join shop_product sp2 on sp2.product_id = bop2.product_id
where bop2.order_id = bo.order_id and sp2.goods_type = '05'),2) fee,
ROUND(
bor.fee / (
case
when bo.order_type='relearn' then
IFNULL((
select count(1)
from shop_product_course spc2
where spc2.product_id = (
case
when bo.remark is null or bo.remark = '' then null
else cast(SUBSTRING_INDEX(bo.remark, ',', 1) as unsigned)
end
)
and spc2.del_flag = 0
),1)
else
IFNULL((
select count(1)
from buy_order_product bop2
inner join shop_product sp2 on sp2.product_id = bop2.product_id
where bop2.order_id = bo.order_id and sp2.goods_type = '05'
),1)
end
),2
) fee,
if(bo.remark like '%退%',bo.remark,if(bor.remark is null,'',bor.remark)) remark,
DATE_FORMAT(bor.create_time,'%Y-%m-%d %H:%i:%s') refundTime,
'已退款' orderStatus
from buy_order_refund bor
inner join buy_order bo on bo.order_id = bor.order_id and bo.del_flag = 0
inner join buy_order_product bop on bop.order_id = bo.order_id
inner join shop_product sp on sp.product_id = bop.product_id and sp.goods_type = '05'
left join buy_order_product bop on bop.order_id = bo.order_id and bo.order_type <> 'relearn'
left join shop_product sp
on sp.product_id = (
case
when bo.order_type='relearn' then
case
when bo.remark is null or bo.remark = '' then null
else cast(SUBSTRING_INDEX(bo.remark, ',', 1) as unsigned)
end
else bop.product_id
end
)
and sp.goods_type = '05'
left join shop_product_course spc on spc.product_id = sp.product_id and spc.del_flag = 0
left join course c on c.id = spc.course_id
left join course_catalogue cc on cc.id = spc.catalogue_id