重构: 手续费改为百分比/固定二选一,清理旧 Skin/Order/ShipLog 演示链路
手续费: - 新增 fee_type 字段(rate/fixed),百分比与固定金额二选一,不再叠加 - calculateServiceFee 按 fee_type 分支计算 - 商户创建/更新校验 fee_type,订单落库快照 fee_type - 前端表单改为下拉选择手续费类型,动态显示对应输入框 - 测试拆为 TestFeeRate + TestFeeFixed 清理旧链路: - 删除旧 Skin/Order/ShipLog 模型及 OrderService/SkinService - Dashboard 迁移到 FulfillmentService - 上游 /api/open/v1 改为基于 FulfillmentOrder 实现,接口契约不变 - 推送留痕改用 AuditLog,不再建 ShipLog 表 - 删除前端 Skins/Orders/ShipLogs/Distributors 页面及路由、菜单、API、类型 - 新增迁移 003: 添加 fee_type 列并 DROP 旧表
This commit is contained in:
@@ -330,25 +330,39 @@ func (h *MerchantHandler) ListPlatformMerchants(c *gin.Context) {
|
||||
}
|
||||
|
||||
type createMerchantReq struct {
|
||||
Code string `json:"code" binding:"required"`
|
||||
Name string `json:"name" binding:"required"`
|
||||
ContactName string `json:"contact_name"`
|
||||
ContactInfo string `json:"contact_info"`
|
||||
OwnerUserID uint `json:"owner_user_id" binding:"required"`
|
||||
Code string `json:"code" binding:"required"`
|
||||
Name string `json:"name" binding:"required"`
|
||||
ContactName string `json:"contact_name"`
|
||||
ContactInfo string `json:"contact_info"`
|
||||
OwnerUserID uint `json:"owner_user_id"`
|
||||
OwnerUsername string `json:"owner_username"`
|
||||
OwnerPassword string `json:"owner_password"`
|
||||
OwnerNickname string `json:"owner_nickname"`
|
||||
Features string `json:"features"`
|
||||
FeeType string `json:"fee_type"`
|
||||
FeeRateBP int64 `json:"fee_rate_bp"`
|
||||
FeeFixedAmount int64 `json:"fee_fixed_amount"`
|
||||
}
|
||||
|
||||
func (h *MerchantHandler) CreateMerchant(c *gin.Context) {
|
||||
var req createMerchantReq
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
response.BadRequest(c, "参数错误:code、name、owner_user_id 必填")
|
||||
response.BadRequest(c, "参数错误:code、name 必填")
|
||||
return
|
||||
}
|
||||
merchant, err := h.merchantSvc.CreateMerchant(service.CreateMerchantInput{
|
||||
Code: req.Code,
|
||||
Name: req.Name,
|
||||
ContactName: req.ContactName,
|
||||
ContactInfo: req.ContactInfo,
|
||||
OwnerUserID: req.OwnerUserID,
|
||||
Code: req.Code,
|
||||
Name: req.Name,
|
||||
ContactName: req.ContactName,
|
||||
ContactInfo: req.ContactInfo,
|
||||
OwnerUserID: req.OwnerUserID,
|
||||
OwnerUsername: req.OwnerUsername,
|
||||
OwnerPassword: req.OwnerPassword,
|
||||
OwnerNickname: req.OwnerNickname,
|
||||
Features: req.Features,
|
||||
FeeType: req.FeeType,
|
||||
FeeRateBP: req.FeeRateBP,
|
||||
FeeFixedAmount: req.FeeFixedAmount,
|
||||
}, middleware.GetUserID(c))
|
||||
if err != nil {
|
||||
response.BadRequest(c, err.Error())
|
||||
@@ -357,6 +371,40 @@ func (h *MerchantHandler) CreateMerchant(c *gin.Context) {
|
||||
response.OK(c, merchant)
|
||||
}
|
||||
|
||||
type updateMerchantSettingsReq struct {
|
||||
Name *string `json:"name"`
|
||||
Status *string `json:"status"`
|
||||
ContactName *string `json:"contact_name"`
|
||||
ContactInfo *string `json:"contact_info"`
|
||||
Features *string `json:"features"`
|
||||
FeeType *string `json:"fee_type"`
|
||||
FeeRateBP *int64 `json:"fee_rate_bp"`
|
||||
FeeFixedAmount *int64 `json:"fee_fixed_amount"`
|
||||
}
|
||||
|
||||
func (h *MerchantHandler) UpdateMerchantSettings(c *gin.Context) {
|
||||
id, _ := strconv.ParseUint(c.Param("id"), 10, 64)
|
||||
var req updateMerchantSettingsReq
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
response.BadRequest(c, "参数错误")
|
||||
return
|
||||
}
|
||||
if err := h.merchantSvc.UpdateMerchantSettings(uint(id), service.UpdateMerchantSettingsInput{
|
||||
Name: req.Name,
|
||||
Status: req.Status,
|
||||
ContactName: req.ContactName,
|
||||
ContactInfo: req.ContactInfo,
|
||||
Features: req.Features,
|
||||
FeeType: req.FeeType,
|
||||
FeeRateBP: req.FeeRateBP,
|
||||
FeeFixedAmount: req.FeeFixedAmount,
|
||||
}, middleware.GetUserID(c)); err != nil {
|
||||
response.BadRequest(c, err.Error())
|
||||
return
|
||||
}
|
||||
response.OK(c, nil)
|
||||
}
|
||||
|
||||
func (h *MerchantHandler) AddPlatformMerchantMember(c *gin.Context) {
|
||||
var req addMemberReq
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user