商品管理开发文档
1. 概述
商品域由 GoodsBundle 承载,支持普通商品、服务类商品(ServiceLabels)、多规格、分类树、上下架审核。
核心表:items、items_category、items_attributes。
2. 相关 Bundle
| Bundle | 职责 |
|---|---|
| GoodsBundle | 商品主域 |
| CommentsBundle | 商品评价 |
| PointsmallBundle | 积分商城商品 |
| TbItemsBundle | 外部平台商品同步 |
3. 核心文件结构
src/GoodsBundle/
├── Http/Api/V1/Action/Items.php
├── Http/Api/V1/Action/ItemsCategory.php
├── Http/Api/V1/Action/ServiceLabels.php
├── Services/ItemsService.php
├── Entities/Items.php
├── Entities/ItemsCategory.php
├── Events/ItemCreateEvent.php
├── Events/ItemEditEvent.php
└── Jobs/ItemBatchEditStatusEventJob.php4. 路由与代表性 API
商户端(routes/api/goods.php)
| 方法 | 路径 | Action |
|---|---|---|
| POST | /api/goods/items | Items@createItems |
| GET | /api/goods/items | Items@getItemsList |
| GET | /api/goods/items/{item_id} | Items@getItemsDetail |
| PUT | /api/goods/items/{item_id} | Items@updateItems |
| DELETE | /api/goods/items/{item_id} | Items@deleteItems |
| GET | /api/goods/category | ItemsCategory@getCategory |
| POST | /api/goods/servicelabels | ServiceLabels@createServiceLabels |
C 端(routes/frontapi/goods.php)
C 端商品列表、详情、分类等,namespace 为 GoodsBundle\Http\FrontApi\V1\Action。
5. 事件
| 事件 | 说明 |
|---|---|
ItemCreateEvent | 新建商品 → 促销联动 |
ItemEditEvent | 编辑商品 → 库存同步分销店 |
ItemStoreUpdateEvent | 库存变更 → 模板消息等 |
