Files
junhong_cmp_fiber/internal/model/shop_account_dto.go
huang 4abbf558e4
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 4m28s
完善 DTO 规范:统一 description 标签并添加 AI 助手自动检查指引
- 修复所有 DTO 文件的 description 标签(10 个文件)
  - 枚举字段统一使用中文说明(用户类型、角色类型、权限类型等)
  - 状态字段明确说明 0/1 含义
  - validate 标签与 OpenAPI 标签保持一致

- 在 AGENTS.md 和 CLAUDE.md 添加 DTO 规范章节
  - AI 助手必须执行的 7 项检查清单
  - 常见枚举字段标准值参考
  - 确保未来 AI 助手自动遵循规范

- 创建规范文档
  - docs/code-review-checklist.md(Code Review 检查清单)
  - docs/dto-improvement-summary.md(DTO 改进总结)
  - docs/ai-dto-guidelines-update.md(AI 指引更新说明)

- 重新生成 OpenAPI 文档(375 个 description 标签)

影响:所有 API 字段现在都有清晰的中文说明,前端开发更友好
2026-01-20 15:10:11 +08:00

49 lines
2.5 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 model
// ShopAccountListRequest 代理商账号列表查询请求
type ShopAccountListRequest struct {
Page int `json:"page" query:"page" validate:"omitempty,min=1"` // 页码
PageSize int `json:"page_size" query:"page_size" validate:"omitempty,min=1,max=100"` // 每页数量
ShopID *uint `json:"shop_id" query:"shop_id" validate:"omitempty,min=1"` // 店铺ID过滤
Username string `json:"username" query:"username" validate:"omitempty,max=50"` // 用户名(模糊查询)
Phone string `json:"phone" query:"phone" validate:"omitempty,len=11"` // 手机号(精确查询)
Status *int `json:"status" query:"status" validate:"omitempty,oneof=0 1"` // 状态
}
// CreateShopAccountRequest 创建代理商账号请求
type CreateShopAccountRequest struct {
ShopID uint `json:"shop_id" validate:"required,min=1"` // 店铺ID
Username string `json:"username" validate:"required,min=3,max=50"` // 用户名
Phone string `json:"phone" validate:"required,len=11"` // 手机号
Password string `json:"password" validate:"required,min=8,max=32"` // 密码
}
// UpdateShopAccountRequest 更新代理商账号请求
type UpdateShopAccountRequest struct {
Username string `json:"username" validate:"required,min=3,max=50"` // 用户名
// 注意:不包含 phone 和 password按照业务规则不允许修改
}
// UpdateShopAccountPasswordRequest 修改代理商账号密码请求(管理员重置)
type UpdateShopAccountPasswordRequest struct {
NewPassword string `json:"new_password" validate:"required,min=8,max=32"` // 新密码
}
// UpdateShopAccountStatusRequest 修改代理商账号状态请求
type UpdateShopAccountStatusRequest struct {
Status int `json:"status" validate:"required,oneof=0 1"` // 状态0=禁用 1=启用)
}
// ShopAccountResponse 代理商账号响应
type ShopAccountResponse struct {
ID uint `json:"id" description:"账号ID"`
ShopID uint `json:"shop_id" description:"店铺ID"`
ShopName string `json:"shop_name,omitempty" description:"店铺名称"`
Username string `json:"username" description:"用户名"`
Phone string `json:"phone" description:"手机号"`
UserType int `json:"user_type" description:"用户类型 (1:超级管理员, 2:平台用户, 3:代理账号, 4:企业账号)"`
Status int `json:"status" description:"状态 (0:禁用, 1:启用)"`
CreatedAt string `json:"created_at" description:"创建时间"`
UpdatedAt string `json:"updated_at" description:"更新时间"`
}