This commit is contained in:
LAPTOP-7SGDREK0\shiweijun
2025-02-18 17:15:00 +08:00
parent a314c6153e
commit 39924b5780
8 changed files with 20 additions and 22 deletions

View File

@@ -16,7 +16,7 @@ use Hyperf\DbConnection\Model\Model;
* @property string $price
* @property string $side_dish
* @property string $flavor
* @property int $cycle_id
* @property string $date
* @property int $city_id
* @property int $kitchen_id
* @property int $chef_id
@@ -39,7 +39,7 @@ class Dish extends Model
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['id' => 'integer', 'pre_quantity' => 'integer', 'cycle_id' => 'integer', 'city_id' => 'integer','kitchen_id' => 'integer', 'chef_id' => 'integer', 'is_del' => 'integer'];
protected array $casts = ['id' => 'integer', 'pre_quantity' => 'integer', 'city_id' => 'integer','kitchen_id' => 'integer', 'chef_id' => 'integer', 'is_del' => 'integer'];
const string CREATED_AT = 'create_time';

View File

@@ -26,7 +26,7 @@ class DishRequest extends FormRequest
'query_id' => 'sometimes|integer',
'query_dish_name' => 'sometimes|string',
'query_city_id' => 'sometimes|integer|exists:system_city,id',
'query_date_id' => 'sometimes|integer|exists:cycle,id',
'query_date' => 'sometimes',
'query_status' => 'sometimes|integer',
'query_chef_id' => 'sometimes|integer',
@@ -34,6 +34,6 @@ class DishRequest extends FormRequest
}
protected array $scenes = [
'list' => ['limit','query_id','query_dish_name','query_city_id','query_date_id','query_status','query_chef_id'],
'list' => ['limit','query_id','query_dish_name','query_city_id','query_date','query_status','query_chef_id'],
];
}

View File

@@ -41,6 +41,6 @@ class MaterialRequest extends FormRequest
'material_edit' => ['id','category_id', 'name', 'standard', 'unit', 'bar_code','status'],
'material_delete' => ['id'],
'materialStock_list' => ['limit','query_name','query_materialId','query_depotId','query_supplierId','query_kitchenId'],
'chef_cost_list' => ['limit','chef_name','cycle_id','query_kitchen_id'],
'chef_cost_list' => ['limit','chef_name','date','query_kitchen_id'],
];
}

View File

@@ -24,7 +24,7 @@ class DishRequest extends FormRequest
return [
'limit' => 'required|integer',
'dish_name' => 'sometimes|string',
'cycle_id' => 'sometimes|integer|exists:cycle,id',
'date' => 'sometimes',
'city_id' => 'sometimes|integer|exists:system_city,id',
'kitchen_id' => 'sometimes|integer|exists:kitchen,id',
@@ -32,7 +32,7 @@ class DishRequest extends FormRequest
}
protected array $scenes = [
'add' => ['dish_name','profile','pre_quantity','price','side_dish','flavor','cycle_id','city_id','kitchen_id'],
'add' => ['dish_name','profile','pre_quantity','price','side_dish','flavor','date','city_id','kitchen_id'],
'edit' => ['id','dish_name','profile','pre_quantity','price','side_dish','flavor'],
'list' =>['limit'],
'delete' =>['id'],

View File

@@ -32,12 +32,11 @@ class DishService extends BaseService
$id = (int)$this->request->input('query_id');
$cityId = (int)$this->request->input('query_city_id',0);
$dishName = $this->request->input('query_dish_name');
$dateId = (int)$this->request->input('query_date_id');
$date = $this->request->input('query_date');
$status = (int)$this->request->input('query_status');
$chefId = (int)$this->request->input('query_chef_id',0);
$list = $this->DishModel
->leftJoin('cycle','dish.cycle_id','=','cycle.id')
->where('is_del',DishCode::IS_NO_DEL)
->when($id > 0, function ($query) use ($id) {
$query->where('id', $id);
@@ -48,8 +47,8 @@ class DishService extends BaseService
->when($dishName, function ($query) use ($dishName) {
$query->where('dish', 'like', "$dishName%");
})
->when($dateId, function ($query) use ($dateId) {
$query->where('cycle_id', $dateId);
->when($date, function ($query) use ($date) {
$query->where('date', $date);
})
->when($status, function ($query) use ($status) {
$query->where('status', $status);
@@ -57,8 +56,8 @@ class DishService extends BaseService
->when($chefId, function ($query) use ($chefId) {
$query->where('chef_id', $chefId);
})
->orderBy('cycle.dates','desc')
->paginate($limit,['dish.*','cycle.dates'])->toArray();
->orderBy('date','desc')
->paginate($limit)->toArray();
return $this->return->success('success',$list);
}

View File

@@ -151,7 +151,7 @@ class MaterialService extends BaseService{
{
$limit = (int)$this->request->input('limit', 10);
$chefName = $this->request->input('chef_name');
$cycleId = (int)$this->request->input('cycle_id');
$date = $this->request->input('date');
$kitchenId = (int)$this->request->input('query_kitchen_id');
$list = $this->MaterialApplicationModel
@@ -164,8 +164,8 @@ class MaterialService extends BaseService{
->when(!empty($chefName), function ($query) use ($chefName) {
$query->where('admin_user.chinese_name', $chefName);
})
->when(!empty($cycleId), function ($query) use ($cycleId) {
$query->where('dish.cycle_id', $cycleId);
->when(!empty($date), function ($query) use ($date) {
$query->where('dish.date', $date);
})
->when(!empty($kitchenId), function ($query) use ($kitchenId) {
$query->where('material_application.kitchen_id', $kitchenId);

View File

@@ -39,7 +39,7 @@ class DishService extends BaseService
$price = (double)$this->request->input('price');
$side_dish = $this->request->input('side_dish');
$flavor = $this->request->input('flavor');
$cycle_id = (int)$this->request->input('cycle_id');
$date = $this->request->input('date');
$city_id = (int)$this->request->input('city_id');
$kitchen_id = (int)$this->request->input('kitchen_id');
$chef_id = $this->userId;
@@ -51,7 +51,7 @@ class DishService extends BaseService
$dish ->price = $price;
$dish ->side_dish = $side_dish;
$dish ->flavor = $flavor;
$dish ->cycle_id = $cycle_id;
$dish ->date = $date;
$dish ->city_id = $city_id;
$dish ->kitchen_id = $kitchen_id;
$dish ->chef_id = $chef_id;
@@ -119,10 +119,9 @@ class DishService extends BaseService
$limit = (int)$this->request->input('limit');
$chef_id = $this->userId;
$list = $this->DishModel
->leftJoin('cycle','dish.cycle_id','=','cycle.id')
->where('chef_id', $chef_id)
->orderBy('cycle.dates','desc')
->paginate($limit,['dish.*','cycle.dates'])->toArray();
->orderBy('date','desc')
->paginate($limit)->toArray();
return $this->return->success('success',$list);
}

View File

@@ -409,7 +409,7 @@ POST {{host}}/api/dish/add
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer {{admin_token}}
dish_name=排骨饭&profile=加水&pre_quantity=500&price=15&side_dish=33333&flavor=清淡&cycle_id=1&city_id=1&kitchen_id=1
dish_name=排骨饭&profile=加水&pre_quantity=500&price=15&side_dish=33333&flavor=清淡&date=2025-01-02&city_id=1&kitchen_id=1
### 厨师修改菜品
POST {{host}}/api/dish/edit