feat: sku
This commit is contained in:
@@ -144,12 +144,10 @@ class GoodController
|
||||
|
||||
/**
|
||||
* cycle 列表
|
||||
* @param GoodRequest $request
|
||||
* @return array
|
||||
*/
|
||||
#[RequestMapping(path: "list_cycle", methods: "POST")]
|
||||
#[Scene(scene: "list_cycle")]
|
||||
public function cycleList(GoodRequest $request): array
|
||||
#[RequestMapping(path: "list_cycle", methods: "GET")]
|
||||
public function cycleList(): array
|
||||
{
|
||||
return (new CycleService)->handle();
|
||||
}
|
||||
|
||||
@@ -46,10 +46,11 @@ class GoodRequest extends FormRequest
|
||||
}
|
||||
|
||||
protected array $scenes = [
|
||||
'add_spu' => ['date', 'kitchen_id', 'chef_id', 'title', 'sub_title', 'category_id', 'saleable'],
|
||||
'list_cycle' => [],
|
||||
'add_spu' => ['cycle_id', 'kitchen_id', 'chef_id', 'title', 'sub_title', 'category_id', 'saleable'],
|
||||
'edit_spu' => ['id','kitchen_id', 'chef_id', 'title', 'sub_title', 'category_id', 'saleable'],
|
||||
'del_spu' => ['id'],
|
||||
'spu' => ['id'],
|
||||
'list_spu' => ['cycle_id']
|
||||
'list_spu' => ['cycle_id'],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ class CycleService extends BaseService
|
||||
$arr = $this->cycleModel->whereBetween('dates',[
|
||||
date('Y-m-d',strtotime('-10 day',time())),
|
||||
date('Y-m-d',strtotime('+10 day',time())),
|
||||
])->orderBy('dates')->get();
|
||||
])->orderBy('dates')->select(['id','dates'])->get();
|
||||
if (empty($arr)) return $this->return->success('success',['list' => []]);
|
||||
|
||||
$arr = $arr->toArray();
|
||||
|
||||
@@ -78,10 +78,9 @@ class SpuService extends BaseService
|
||||
*/
|
||||
public function add(): array
|
||||
{
|
||||
$date = $this->request->input('date',date('Y-m-d'));
|
||||
|
||||
$cycleInfo = $this->cycleModel->getInfoByDate($date);
|
||||
$cycleId = (int)$this->request->input('cycle_id');
|
||||
|
||||
$cycleInfo = $this->cycleModel->getInfoById($cycleId);
|
||||
if (empty($cycleInfo)) throw new ErrException('没有该周期,请刷新后重新上传');
|
||||
|
||||
$title = $this->request->input('title');
|
||||
|
||||
Reference in New Issue
Block a user