重构: 手续费改为百分比/固定二选一,清理旧 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:
@@ -58,14 +58,17 @@ func (s *UserService) List(q UserListQuery) ([]model.User, int64, error) {
|
||||
return list, total, err
|
||||
}
|
||||
|
||||
func (s *UserService) Create(username, password, nickname, role string, parentID *uint, merchantID uint) (*model.User, error) {
|
||||
func (s *UserService) Create(username, password, nickname, role string, merchantID uint) (*model.User, error) {
|
||||
var count int64
|
||||
s.db.Model(&model.User{}).Where("username = ?", username).Count(&count)
|
||||
if count > 0 {
|
||||
return nil, errors.New("用户名已存在")
|
||||
}
|
||||
if role == "" {
|
||||
role = model.RoleDistributor
|
||||
role = model.RoleMerchant
|
||||
}
|
||||
if role != model.RoleAdmin && role != model.RoleMerchant {
|
||||
return nil, errors.New("无效的账号角色")
|
||||
}
|
||||
hash, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
|
||||
if err != nil {
|
||||
@@ -77,8 +80,6 @@ func (s *UserService) Create(username, password, nickname, role string, parentID
|
||||
Nickname: nickname,
|
||||
Role: role,
|
||||
Status: 1,
|
||||
InviteCode: generateInviteCode(),
|
||||
ParentID: parentID,
|
||||
}
|
||||
if user.Nickname == "" {
|
||||
user.Nickname = username
|
||||
|
||||
Reference in New Issue
Block a user