Skip to content

商品管理开发文档

1. 概述

商品域由 GoodsBundle 承载,支持普通商品、服务类商品(ServiceLabels)、多规格、分类树、上下架审核。

核心表:itemsitems_categoryitems_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.php

4. 路由与代表性 API

商户端(routes/api/goods.php

方法路径Action
POST/api/goods/itemsItems@createItems
GET/api/goods/itemsItems@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/categoryItemsCategory@getCategory
POST/api/goods/servicelabelsServiceLabels@createServiceLabels

C 端(routes/frontapi/goods.php

C 端商品列表、详情、分类等,namespace 为 GoodsBundle\Http\FrontApi\V1\Action


5. 事件

事件说明
ItemCreateEvent新建商品 → 促销联动
ItemEditEvent编辑商品 → 库存同步分销店
ItemStoreUpdateEvent库存变更 → 模板消息等