feat : sts
This commit is contained in:
@@ -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('添加菜品失败');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user