feat : sts

This commit is contained in:
2025-04-15 10:54:31 +08:00
parent f3589ed994
commit 39be37f9a5
10 changed files with 249 additions and 16 deletions

View File

@@ -71,7 +71,16 @@ class SpuService extends BaseService
->where('city_id',$cityId)
->where('kitchen_id',$kitchenId)
->where('is_del',GoodCode::SPU_IS_NO_DEL)
->where('type',$this->request->input('type'))
->when($this->request->input('type'), function ($query) {
$type = (int)$this->request->input('type');
// $query->where('type',$type);
if ($type == GoodCode::SPU_TYPE_FAVORABLE) {
$query->where('favorable',GoodCode::IS_FAVORABLE)->where('type',GoodCode::SPU_TYPE_OPTIONAL);
} else {
$query->where('favorable',GoodCode::NOT_FAVORABLE)->where('type',$type);
}
})
// ->where('type',$this->request->input('type'))
->paginate($limit)
->toArray();
@@ -156,6 +165,7 @@ class SpuService extends BaseService
$insertModel->saleable = $this->request->input('saleable');
$insertModel->type = $this->request->input('type');
$insertModel->sort = $this->request->input('sort');
$insertModel->favorable = GoodCode::NOT_FAVORABLE;
if (!$insertModel->save()) throw new ErrException('添加菜品失败');