|
@@ -115,6 +115,36 @@ trait OrderScope
|
|
}
|
|
}
|
|
|
|
|
|
//notexists 没成团的订单
|
|
//notexists 没成团的订单
|
|
|
|
+/*
|
|
|
|
+SELECT
|
|
|
|
+ *
|
|
|
|
+FROM
|
|
|
|
+ `shopro_order`
|
|
|
|
+WHERE
|
|
|
|
+ (
|
|
|
|
+ `user_id` = 11
|
|
|
|
+ AND ( `status` IN ( 'paid', 'completed' ) OR ( `pay_mode` = 'offline' AND `status` = 'pending' ) )
|
|
|
|
+ AND `apply_refund_status` IN ( 0,- 1 )
|
|
|
|
+ AND EXISTS ( SELECT * FROM `shopro_order_item` WHERE ( order_id = shopro_order.id ) AND `dispatch_status` = 0 AND `refund_status` = 0 )
|
|
|
|
+ AND NOT EXISTS ( SELECT * FROM `shopro_order_item` WHERE ( order_id = shopro_order.id ) AND `aftersale_status` = 1 AND `dispatch_status` = 0 AND `refund_status` = 0 )
|
|
|
|
+ AND NOT EXISTS (
|
|
|
|
+ SELECT
|
|
|
|
+ *
|
|
|
|
+ FROM
|
|
|
|
+ `shopro_order` `so`
|
|
|
|
+ WHERE
|
|
|
|
+ ( so.id = shopro_order.id )
|
|
|
|
+ AND `so`.`activity_type` = 'groupon'
|
|
|
|
+ AND `so`.`activity_id` <> 0
|
|
|
|
+ AND EXISTS ( SELECT * FROM `shopro_activity_groupon` WHERE ( id = so.groupon_id ) AND `status` NOT IN ( 'finish', 'finish_fictitious' ) )
|
|
|
|
+ )
|
|
|
|
+ )
|
|
|
|
+ AND `shopro_order`.`deletetime` IS NULL
|
|
|
|
+ORDER BY
|
|
|
|
+ `id` DESC
|
|
|
|
+ LIMIT 0,
|
|
|
|
+ 10
|
|
|
|
+ */
|
|
public function scopegroupon_finish($query){
|
|
public function scopegroupon_finish($query){
|
|
$self_name = (new Order())->getQuery()->getTable();
|
|
$self_name = (new Order())->getQuery()->getTable();
|
|
$groupon_name = (new Groupon())->getQuery()->getTable();
|
|
$groupon_name = (new Groupon())->getQuery()->getTable();
|