Files
junhong_cmp_fiber/internal/routes/exchange.go
邹进 9ced14fa1b fix: 第1批 F1、M12 一资产一号与换货按手机号关联校验
- F1 一个资产同时只能有一个有效手机号关联,他号绑定返回 1192(不含号码),同号幂等
- 登录 need_bind_phone 改看资产是否已有有效关联,新增 asset_phone_bound、asset_phone_is_own;H5 绑定按客户/资产两侧状态分别写入
- 客户换号不再迁移资产关联
- M12 换货新资产有有效手机号关联即拒绝,号码只在 data.phone;换货完成清空旧资产客户绑定并失效旧资产关联(exchange_completed),均不迁移
- OpenSpec Change enforce-single-phone-per-asset:11/16,H5 短信与换货端到端验证待测试部署后完成
2026-10-12 00:10:41 +09:00

73 lines
2.9 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package routes
import (
"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"
"github.com/gofiber/fiber/v2"
)
func registerAdminExchangeRoutes(router fiber.Router, handler *admin.ExchangeHandler, doc *openapi.Generator, basePath string) {
Register(router, doc, basePath, "POST", "/exchanges", handler.Create, RouteSpec{
Summary: "创建换货单",
Description: "新资产存在有效手机号关联时拒绝(错误码 1202),提示先在后台解除该资产的手机号绑定;完整号码只在错误响应 data.phone 中返回,不进日志。" +
"不再以“有人扫过码”拒绝。直接换货完成时清空旧资产的个人客户绑定并失效旧资产手机号关联(exchange_completed),均不迁移到新资产。",
Tags: []string{"换货管理"},
Input: new(dto.CreateExchangeRequest),
Output: new(dto.ExchangeOrderResponse),
Auth: true,
})
Register(router, doc, basePath, "GET", "/exchanges", handler.List, RouteSpec{
Summary: "获取换货单列表",
Tags: []string{"换货管理"},
Input: new(dto.ExchangeListRequest),
Output: new(dto.ExchangeListResponse),
Auth: true,
})
Register(router, doc, basePath, "GET", "/exchanges/:id", handler.Get, RouteSpec{
Summary: "获取换货单详情",
Tags: []string{"换货管理"},
Input: new(dto.ExchangeIDRequest),
Output: new(dto.ExchangeOrderResponse),
Auth: true,
})
Register(router, doc, basePath, "POST", "/exchanges/:id/ship", handler.Ship, RouteSpec{
Summary: "换货发货",
Tags: []string{"换货管理"},
Input: new(dto.ExchangeShipParams),
Output: new(dto.ExchangeOrderResponse),
Auth: true,
})
Register(router, doc, basePath, "POST", "/exchanges/:id/complete", handler.Complete, RouteSpec{
Summary: "确认换货完成",
Description: "确认换货完成;仅超级管理员或平台用户可对迁移状态为 failed 的物流换货单重试," +
"其他账号对 failed 单返回 403/1005;非 failed 单沿用既有完成权限。" +
"新资产存在有效手机号关联时拒绝并停在已发货待确认,完整号码在错误响应 data.phone;后台解除后可重新确认。" +
"完成时清空旧资产个人客户绑定并失效旧资产手机号关联,均不迁移到新资产。",
Tags: []string{"换货管理"},
Input: new(dto.ExchangeIDRequest),
Output: nil,
Auth: true,
})
Register(router, doc, basePath, "POST", "/exchanges/:id/cancel", handler.Cancel, RouteSpec{
Summary: "取消换货",
Tags: []string{"换货管理"},
Input: new(dto.ExchangeCancelParams),
Output: nil,
Auth: true,
})
Register(router, doc, basePath, "POST", "/exchanges/:id/renew", handler.Renew, RouteSpec{
Summary: "旧资产转新",
Tags: []string{"换货管理"},
Input: new(dto.ExchangeIDRequest),
Output: nil,
Auth: true,
})
}