getTable
This commit is contained in:
parent
078c4eaa7d
commit
30d3515d03
@ -168,12 +168,12 @@ trait OrderCardConcern
|
||||
}
|
||||
|
||||
if (isset($conditions['sell_starttime']) && isset($conditions['sell_endtime'])) {
|
||||
$query->whereRaw(sprintf("exists (SELECT sim FROM virtual_order_cards_partition AS p WHERE virtual_order_cards_partition.sim = p.sim AND type in (0, 1) AND created_at >= '%s' AND created_at <= '%s' AND deleted_at is null AND refunded_at is null)", $conditions['sell_starttime'], $conditions['sell_endtime']));
|
||||
$query->whereRaw(sprintf("exists (SELECT sim FROM virtual_order_cards_partition AS p WHERE %s.sim = p.sim AND type in (0, 1) AND created_at >= '%s' AND created_at <= '%s' AND deleted_at is null AND refunded_at is null)", $this->getTable(), $conditions['sell_starttime'], $conditions['sell_endtime']));
|
||||
}
|
||||
|
||||
if (isset($conditions['has_type']) && !empty($conditions['has_type'])) {
|
||||
$conditions['has_type'] = array_wrap($conditions['has_type']);
|
||||
$query->whereRaw(sprintf("exists (SELECT sim from virtual_order_cards_partition AS p WHERE virtual_order_cards_partition.sim = p.sim AND type in (%s))", implode(',', $conditions['has_type'])));
|
||||
$query->whereRaw(sprintf("exists (SELECT sim from virtual_order_cards_partition AS p WHERE %s.sim = p.sim AND type in (%s))", $this->getTable(), implode(',', $conditions['has_type'])));
|
||||
}
|
||||
});
|
||||
|
||||
@ -199,7 +199,7 @@ trait OrderCardConcern
|
||||
break;
|
||||
|
||||
case 2:
|
||||
$havingRaw = sprintf("exists (SELECT sim FROM virtual_order_cards_partition AS p WHERE virtual_order_cards_partition.sim = p.sim GROUP BY sim HAVING MAX(service_end_at) >= '%s')", $date);
|
||||
$havingRaw = sprintf("exists (SELECT sim FROM virtual_order_cards_partition AS p WHERE %s.sim = p.sim GROUP BY sim HAVING MAX(service_end_at) >= '%s')", $this->getTable(), $date);
|
||||
$hasRaw = sprintf("exists (SELECT sim FROM cards WHERE virtual_order_cards_partition.sim = cards.sim AND (cancelled_at IS NULL or cancelled_at <= '%s'))", $date);
|
||||
$this->model = $this->model->whereNotNull('service_start_at')
|
||||
->whereRaw($havingRaw)
|
||||
@ -207,7 +207,7 @@ trait OrderCardConcern
|
||||
break;
|
||||
|
||||
case 3:
|
||||
$havingRaw = sprintf("exists (SELECT sim FROM virtual_order_cards_partition AS p WHERE virtual_order_cards_partition.sim = p.sim GROUP BY sim HAVING MAX(service_end_at) < '%s')", $date);
|
||||
$havingRaw = sprintf("exists (SELECT sim FROM virtual_order_cards_partition AS p WHERE %s.sim = p.sim GROUP BY sim HAVING MAX(service_end_at) < '%s')", $this->getTable(), $date);
|
||||
$hasRaw = sprintf("exists (SELECT sim FROM cards WHERE virtual_order_cards_partition.sim = cards.sim AND (cancelled_at IS NULL or cancelled_at <= '%s'))", $date);
|
||||
$this->model = $this->model->whereNotNull('service_start_at')
|
||||
->whereRaw($havingRaw)
|
||||
|
Loading…
x
Reference in New Issue
Block a user