Files
junhong_cmp_fiber/internal/routes/package.go
huang b9733c4913
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m12s
fix: 修正零售价架构错误 + 清理旧微信配置 + 归档提案 + 前端接口文档
1. 修正 retail_price 架构:
   - 删除 batch-pricing 接口的 pricing_target 字段和 retail_price 分支
     (上级只能改下级成本价,不能改零售价)
   - 新增 PATCH /api/admin/packages/:id/retail-price 接口
     (代理自己改自己的零售价,校验 retail_price >= cost_price)

2. 清理旧微信 YAML 配置(已全部迁移到数据库 tb_wechat_config):
   - 删除 config.yaml 中 wechat.official_account 配置节
   - 删除 NewOfficialAccountApp() 旧工厂函数
   - 清理 personal_customer service 中的死代码(旧登录/绑定微信方法)
   - 清理 docker-compose.prod.yml 中旧微信环境变量和证书挂载注释

3. 归档四个已完成提案到 openspec/changes/archive/

4. 新增前端接口变更说明文档(docs/前端接口变更说明.md)

5. 修正归档提案和 specs 中关于 pricing_target 的错误描述
2026-03-19 17:39:43 +08:00

79 lines
2.3 KiB
Go

package routes
import (
"github.com/gofiber/fiber/v2"
"github.com/break/junhong_cmp_fiber/internal/handler/admin"
"github.com/break/junhong_cmp_fiber/internal/model/dto"
"github.com/break/junhong_cmp_fiber/pkg/openapi"
)
func registerPackageRoutes(router fiber.Router, handler *admin.PackageHandler, doc *openapi.Generator, basePath string) {
packages := router.Group("/packages")
groupPath := basePath + "/packages"
Register(packages, doc, groupPath, "GET", "", handler.List, RouteSpec{
Summary: "套餐列表",
Tags: []string{"套餐管理"},
Input: new(dto.PackageListRequest),
Output: new(dto.PackagePageResult),
Auth: true,
})
Register(packages, doc, groupPath, "POST", "", handler.Create, RouteSpec{
Summary: "创建套餐",
Tags: []string{"套餐管理"},
Input: new(dto.CreatePackageRequest),
Output: new(dto.PackageResponse),
Auth: true,
})
Register(packages, doc, groupPath, "GET", "/:id", handler.Get, RouteSpec{
Summary: "获取套餐详情",
Tags: []string{"套餐管理"},
Input: new(dto.IDReq),
Output: new(dto.PackageResponse),
Auth: true,
})
Register(packages, doc, groupPath, "PUT", "/:id", handler.Update, RouteSpec{
Summary: "更新套餐",
Tags: []string{"套餐管理"},
Input: new(dto.UpdatePackageParams),
Output: new(dto.PackageResponse),
Auth: true,
})
Register(packages, doc, groupPath, "DELETE", "/:id", handler.Delete, RouteSpec{
Summary: "删除套餐",
Tags: []string{"套餐管理"},
Input: new(dto.IDReq),
Output: nil,
Auth: true,
})
Register(packages, doc, groupPath, "PATCH", "/:id/status", handler.UpdateStatus, RouteSpec{
Summary: "更新套餐状态",
Tags: []string{"套餐管理"},
Input: new(dto.UpdatePackageStatusParams),
Output: nil,
Auth: true,
})
Register(packages, doc, groupPath, "PATCH", "/:id/shelf", handler.UpdateShelfStatus, RouteSpec{
Summary: "更新套餐上架状态",
Tags: []string{"套餐管理"},
Input: new(dto.UpdatePackageShelfStatusParams),
Output: nil,
Auth: true,
})
Register(packages, doc, groupPath, "PATCH", "/:id/retail-price", handler.UpdateRetailPrice, RouteSpec{
Summary: "修改零售价(代理)",
Tags: []string{"套餐管理"},
Input: new(dto.UpdateRetailPriceParams),
Output: nil,
Auth: true,
})
}