处理取消订单的错误

This commit is contained in:
luofei 2023-07-11 09:33:26 +08:00
parent 386826a046
commit 85b0596c63
2 changed files with 6 additions and 2 deletions

View File

@ -59,7 +59,11 @@ class StoreGroupOrderDao extends BaseDao
*/ */
public function search(array $where) public function search(array $where)
{ {
$storeOrderWhere = StoreOrder::where('activity_type', $where['product_type']); if (is_array($where['product_type'])) {
$storeOrderWhere = StoreOrder::whereIn('activity_type', $where['product_type']);
} else {
$storeOrderWhere = StoreOrder::where('activity_type', $where['product_type']);
}
return StoreGroupOrder::hasWhere('orderList', $storeOrderWhere) return StoreGroupOrder::hasWhere('orderList', $storeOrderWhere)
->when(isset($where['paid']) && $where['paid'] !== '', function ($query) use ($where) { ->when(isset($where['paid']) && $where['paid'] !== '', function ($query) use ($where) {
if ($where['paid'] == 0) { if ($where['paid'] == 0) {

View File

@ -146,7 +146,7 @@ class StoreGroupOrderRepository extends BaseRepository
*/ */
public function cancel($id, $uid = null) public function cancel($id, $uid = null)
{ {
$groupOrder = $this->search(['paid' => 0, 'uid' => $uid ?? ''])->where('group_order_id', $id)->with(['orderList'])->find(); $groupOrder = $this->search(['paid' => 0, 'uid' => $uid ?? '', 'product_type' => [0, 98]])->where('StoreGroupOrder.group_order_id', $id)->with(['orderList'])->find();
if (!$groupOrder) if (!$groupOrder)
throw new ValidateException('订单不存在'); throw new ValidateException('订单不存在');
if ($groupOrder['paid'] != 0) if ($groupOrder['paid'] != 0)