feat: sku

This commit is contained in:
2025-01-08 15:45:28 +08:00
parent 4c10e8ed71
commit b23865f4f1
5 changed files with 22 additions and 10 deletions

View File

@@ -144,12 +144,10 @@ class GoodController
/** /**
* cycle 列表 * cycle 列表
* @param GoodRequest $request
* @return array * @return array
*/ */
#[RequestMapping(path: "list_cycle", methods: "POST")] #[RequestMapping(path: "list_cycle", methods: "GET")]
#[Scene(scene: "list_cycle")] public function cycleList(): array
public function cycleList(GoodRequest $request): array
{ {
return (new CycleService)->handle(); return (new CycleService)->handle();
} }

View File

@@ -46,10 +46,11 @@ class GoodRequest extends FormRequest
} }
protected array $scenes = [ 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'], 'edit_spu' => ['id','kitchen_id', 'chef_id', 'title', 'sub_title', 'category_id', 'saleable'],
'del_spu' => ['id'], 'del_spu' => ['id'],
'spu' => ['id'], 'spu' => ['id'],
'list_spu' => ['cycle_id'] 'list_spu' => ['cycle_id'],
]; ];
} }

View File

@@ -30,7 +30,7 @@ class CycleService extends BaseService
$arr = $this->cycleModel->whereBetween('dates',[ $arr = $this->cycleModel->whereBetween('dates',[
date('Y-m-d',strtotime('-10 day',time())), date('Y-m-d',strtotime('-10 day',time())),
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' => []]); if (empty($arr)) return $this->return->success('success',['list' => []]);
$arr = $arr->toArray(); $arr = $arr->toArray();

View File

@@ -78,10 +78,9 @@ class SpuService extends BaseService
*/ */
public function add(): array public function add(): array
{ {
$date = $this->request->input('date',date('Y-m-d')); $cycleId = (int)$this->request->input('cycle_id');
$cycleInfo = $this->cycleModel->getInfoByDate($date);
$cycleInfo = $this->cycleModel->getInfoById($cycleId);
if (empty($cycleInfo)) throw new ErrException('没有该周期,请刷新后重新上传'); if (empty($cycleInfo)) throw new ErrException('没有该周期,请刷新后重新上传');
$title = $this->request->input('title'); $title = $this->request->input('title');

14
sync/http/admin/good.http Normal file
View File

@@ -0,0 +1,14 @@
### 登录
POST {{host}}/admin/login/user
Content-Type: application/x-www-form-urlencoded
account=13632877014&password=123456
> {%
client.global.set("admin_token", response.body.data.token);
%}
### 周期列表
GET {{host}}/admin/good/list_cycle
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer {{admin_token}}