2026-07-09 13:02:49 +08:00

73 lines
3.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 countryregion
// createCountryRequest 是后台创建国家的 HTTP 入参。
// countryCode 创建后不可变,因此创建接口要求显式提交,更新接口不会接收这个字段。
type createCountryRequest struct {
// CountryName 是稳定英文或拼音名称。
CountryName string `json:"countryName" binding:"required"`
// CountryCode 是 App canonical 国家码admin-server 会统一 trim、转大写并校验 2-3 位字母。
CountryCode string `json:"countryCode" binding:"required"`
// CountryDisplayName 是后台和 App 注册页展示名。
CountryDisplayName string `json:"countryDisplayName" binding:"required"`
// SortOrder 控制国家选择器排序。
SortOrder int32 `json:"sortOrder"`
// ISOAlpha3 是 ISO alpha-3 或 user-assigned 辅助码。
ISOAlpha3 string `json:"isoAlpha3"`
// ISONumeric 必须保持字符串,避免前导零丢失。
ISONumeric string `json:"isoNumeric"`
// PhoneCountryCode 是 E.164 国家呼叫码,例如 +86。
PhoneCountryCode string `json:"phoneCountryCode"`
// Enabled 使用指针保留“前端未传”和“前端显式传 false”的区别。
Enabled *bool `json:"enabled"`
// Flag 是展示字段,不参与国家归属和权限判断。
Flag string `json:"flag"`
}
// updateCountryRequest 只修改国家展示和辅助字段,不允许修改 countryCode。
type updateCountryRequest struct {
CountryName string `json:"countryName" binding:"required"`
CountryDisplayName string `json:"countryDisplayName" binding:"required"`
SortOrder int32 `json:"sortOrder"`
ISOAlpha3 string `json:"isoAlpha3"`
ISONumeric string `json:"isoNumeric"`
PhoneCountryCode string `json:"phoneCountryCode"`
Flag string `json:"flag"`
}
// renameCountryCodeRequest 是国家码重命名任务的创建入参;除新国家码外,携带当前编辑表单字段,保证 job 执行时一起提交展示字段。
type renameCountryCodeRequest struct {
CountryName string `json:"countryName" binding:"required"`
CountryCode string `json:"countryCode" binding:"required"`
CountryDisplayName string `json:"countryDisplayName" binding:"required"`
SortOrder int32 `json:"sortOrder"`
ISOAlpha3 string `json:"isoAlpha3"`
ISONumeric string `json:"isoNumeric"`
PhoneCountryCode string `json:"phoneCountryCode"`
Flag string `json:"flag"`
}
// createRegionRequest 创建业务区域,并提交首版 active 国家码列表。
type createRegionRequest struct {
// RegionCode 是稳定业务编码user-service 负责唯一性和格式校验。
RegionCode string `json:"regionCode" binding:"required"`
// Name 是后台展示名。
Name string `json:"name" binding:"required"`
// Countries 是该区域 active 国家码列表;不能为空,且不能包含重复国家。
Countries []string `json:"countries" binding:"required"`
// SortOrder 控制区域选择器排序。
SortOrder int32 `json:"sortOrder"`
}
// updateRegionRequest 只修改区域展示字段,不替换国家归属。
type updateRegionRequest struct {
RegionCode string `json:"regionCode" binding:"required"`
Name string `json:"name" binding:"required"`
SortOrder int32 `json:"sortOrder"`
}
// replaceRegionCountriesRequest 原子替换区域国家归属。
// user-service 会在同一业务流程内释放旧映射、写新映射,并创建用户区域重算任务。
type replaceRegionCountriesRequest struct {
Countries []string `json:"countries" binding:"required"`
}