feat : coupon

This commit is contained in:
2025-03-21 16:19:57 +08:00
parent 8a4674b1dc
commit 8699b6c6ad
3 changed files with 8 additions and 3 deletions

View File

@@ -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';

View File

@@ -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',

View File

@@ -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;