diff --git a/app/Model/Order.php b/app/Model/Order.php index 8beb0d4..2ad87cb 100644 --- a/app/Model/Order.php +++ b/app/Model/Order.php @@ -16,7 +16,8 @@ use Hyperf\DbConnection\Model\Model; * @property int $user_id * @property int $cycle_id * @property int $site_id - * @property int $city_id + * @property int $city_id + * @property int $kitchen_id * @property int $coupon_id * @property int $copies * @property int $type @@ -52,7 +53,7 @@ class Order extends Model /** * The attributes that should be cast to native types. */ - protected array $casts = ['id' => 'integer', 'user_id' => 'integer', 'cycle_id' => 'integer', 'site_id' => 'integer', 'city_id' => 'integer', 'coupon_id' => 'integer', 'meal_copies' => 'integer', 'optional_copies' => 'integer', 'status' => 'integer', 'is_refund_all' => 'integer']; + protected array $casts = ['id' => 'integer', 'user_id' => 'integer', 'cycle_id' => 'integer', 'site_id' => 'integer', 'city_id' => 'integer', 'coupon_id' => 'integer', 'meal_copies' => 'integer', 'optional_copies' => 'integer', 'status' => 'integer', 'is_refund_all' => 'integer','kitchen_id' => 'integer']; const string CREATED_AT = 'create_time'; diff --git a/app/Service/Admin/Order/OrderListService.php b/app/Service/Admin/Order/OrderListService.php index a8f1021..4b00252 100644 --- a/app/Service/Admin/Order/OrderListService.php +++ b/app/Service/Admin/Order/OrderListService.php @@ -54,7 +54,7 @@ class OrderListService extends BaseService { $limit = (int)$this->request->input('limit', 20); - //todo where + //todo where kitchenID $orderList = $this->orderModel ->when($this->request->input('search_user_id'), function ($query) { $query->where('user_id', $this->request->input('search_user_id')); @@ -62,6 +62,9 @@ class OrderListService extends BaseService ->when($this->request->input('search_status'), function ($query) { $query->where('status', $this->request->input('search_status')); }) + ->when($this->request->input('city_id'), function ($query) { + $query->where('city_id', $this->request->input('city_id')); + }) ->select([ 'id', 'cycle_id', diff --git a/app/Service/Api/Order/PlaceOrderService.php b/app/Service/Api/Order/PlaceOrderService.php index 79ea55c..70ebb0e 100644 --- a/app/Service/Api/Order/PlaceOrderService.php +++ b/app/Service/Api/Order/PlaceOrderService.php @@ -194,6 +194,7 @@ class PlaceOrderService extends BaseOrderService $orderInsertModel->cycle_id = $this->cycleId; $orderInsertModel->site_id = $this->siteId; $orderInsertModel->city_id = $this->orderRes['site_info']['city_id']; + $orderInsertModel->kitchen_id = $this->orderRes['site_info']['kitchen_id']; $orderInsertModel->coupon_id = $this->couponId; $orderInsertModel->copies = $this->orderRes['copies']; $orderInsertModel->type = $this->orderType;