All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 8m26s
96 lines
6.8 KiB
Go
96 lines
6.8 KiB
Go
package dto
|
||
|
||
import "time"
|
||
|
||
// NotificationUnreadCountResponse 是后台账号未读数投影。
|
||
type NotificationUnreadCountResponse struct {
|
||
Count int64 `json:"count" description:"未读通知数量"`
|
||
DisplayCount string `json:"display_count" description:"徽标显示文本,超过 99 时为 99+"`
|
||
}
|
||
|
||
// NotificationListRequest 是后台通知基础分页参数。
|
||
type NotificationListRequest struct {
|
||
Category string `json:"category" query:"category" validate:"omitempty,oneof=approval expiry sync system" enums:"approval,expiry,sync,system" description:"通知类别 (approval:审批, expiry:临期, sync:同步, system:系统)"`
|
||
Type string `json:"type" query:"type" validate:"omitempty,max=100" maxlength:"100" description:"稳定通知类型"`
|
||
Severity string `json:"severity" query:"severity" validate:"omitempty,oneof=info warning error critical" enums:"info,warning,error,critical" description:"通知级别 (info:提示, warning:警告, error:错误, critical:严重)"`
|
||
IsRead *bool `json:"is_read" query:"is_read" description:"已读状态;不传时查询全部"`
|
||
Page int `json:"page" query:"page" validate:"omitempty,min=1,max=10000" minimum:"1" maximum:"10000" description:"页码,默认 1,最大 10000"`
|
||
PageSize int `json:"page_size" query:"page_size" validate:"omitempty,min=1,max=50" minimum:"1" maximum:"50" description:"每页数量,默认 20,最大 50"`
|
||
}
|
||
|
||
// NotificationItem 是后台账号可见的站内通知投影。
|
||
type NotificationItem struct {
|
||
ID uint `json:"id" description:"通知ID"`
|
||
Category string `json:"category" description:"通知类别 (approval:审批, expiry:临期, sync:同步, system:系统)"`
|
||
Type string `json:"type" description:"稳定通知类型"`
|
||
Severity string `json:"severity" description:"通知级别 (info:提示, warning:警告, error:错误, critical:严重)"`
|
||
Title string `json:"title" description:"纯文本标题"`
|
||
Body string `json:"body" description:"纯文本正文"`
|
||
RefType string `json:"ref_type" description:"受控资源类型;可能为空。可选值及含义:system_config:系统配置, integration_log:外部集成日志, package:套餐, asset:C端资产, refund:退款, agent_recharge:代理充值, wecom_approval:企微审批, iot_card:物联网卡, device:设备, expiring_asset:临期资产列表, shop_fund:店铺资金概况, card_sync:卡同步记录。后台点击通知应调用目标解析接口,不得直接拼接路由"`
|
||
RefID string `json:"ref_id" description:"受控资源数字ID的十进制字符串;可能为空。refund、agent_recharge、wecom_approval、iot_card、device、expiring_asset、shop_fund、asset 等类型使用;仅用于资源定位,不是前端URL"`
|
||
RefKey string `json:"ref_key" description:"受控资源稳定Key或展示快照;可能为空。system_config 为配置Key,integration_log/card_sync 为集成标识,asset 为资产标识快照;仅用于定位或展示,不是前端URL"`
|
||
IsRead bool `json:"is_read" description:"是否已读"`
|
||
ReadAt *time.Time `json:"read_at,omitempty" description:"首次已读时间(ISO 8601)"`
|
||
CreatedAt time.Time `json:"created_at" description:"创建时间(ISO 8601)"`
|
||
}
|
||
|
||
// NotificationListResponse 是后台通知基础分页结果。
|
||
type NotificationListResponse struct {
|
||
Items []NotificationItem `json:"items" description:"通知列表"`
|
||
Total int64 `json:"total" description:"总数量"`
|
||
Page int `json:"page" description:"页码"`
|
||
Size int `json:"size" description:"每页数量"`
|
||
}
|
||
|
||
// NotificationIDParams 是单条通知路径参数。
|
||
type NotificationIDParams struct {
|
||
ID uint `json:"id" path:"id" required:"true" description:"通知ID"`
|
||
}
|
||
|
||
// NotificationReadResponse 是单条通知幂等已读结果。
|
||
type NotificationReadResponse struct {
|
||
Success bool `json:"success" description:"请求是否成功;通知不存在、属于别人或已经已读也返回 true"`
|
||
}
|
||
|
||
// NotificationTargetResponse 是通知受控目标解析结果,不包含任意 URL。
|
||
type NotificationTargetResponse struct {
|
||
TargetType string `json:"target_type" description:"前端白名单目标类型;空表示不支持跳转。可选值:refund_detail、agent_recharge_detail、wecom_approval_detail、iot_card_detail、device_detail、expiring_asset_list、shop_fund_summary、integration_log、system_config"`
|
||
TargetID *uint `json:"target_id,omitempty" description:"ID型目标的业务主键;前端按 target_type 映射受控页面,不得自行拼接任意URL"`
|
||
TargetKey string `json:"target_key,omitempty" description:"Key型目标的稳定定位值;仅用于 integration_log 或 system_config 等白名单目标"`
|
||
Available bool `json:"available" description:"当前账号是否仍可访问目标;false 时只展示通知正文,不执行跳转"`
|
||
}
|
||
|
||
// NotificationUnreadSummaryResponse 是后台账号未读通知的固定分类汇总。
|
||
type NotificationUnreadSummaryResponse struct {
|
||
Total int64 `json:"total" description:"未读通知总数"`
|
||
Approval int64 `json:"approval" description:"审批类未读数量"`
|
||
Expiry int64 `json:"expiry" description:"临期类未读数量"`
|
||
Sync int64 `json:"sync" description:"同步类未读数量"`
|
||
System int64 `json:"system" description:"系统类未读数量"`
|
||
}
|
||
|
||
// NotificationReadAllRequest 是后台批量已读请求。
|
||
type NotificationReadAllRequest struct {
|
||
Category string `json:"category" validate:"omitempty,oneof=approval expiry sync system" enums:"approval,expiry,sync,system" description:"可选通知类别 (approval:审批, expiry:临期, sync:同步, system:系统)"`
|
||
}
|
||
|
||
// NotificationReadAllResponse 是后台批量已读结果。
|
||
type NotificationReadAllResponse struct {
|
||
UpdatedCount int64 `json:"updated_count" description:"本次实际更新的通知数量"`
|
||
}
|
||
|
||
// PersonalNotificationListRequest 是个人客户通知的简化分页参数。
|
||
type PersonalNotificationListRequest struct {
|
||
IsRead *bool `json:"is_read" query:"is_read" description:"已读状态;false 仅查询未读,true 仅查询已读,不传时查询全部"`
|
||
Page int `json:"page" query:"page" validate:"omitempty,min=1,max=10000" minimum:"1" maximum:"10000" description:"页码,默认 1,最大 10000"`
|
||
PageSize int `json:"page_size" query:"page_size" validate:"omitempty,min=1,max=50" minimum:"1" maximum:"50" description:"每页数量,默认 20,最大 50"`
|
||
}
|
||
|
||
// PersonalNotificationListResponse 是个人客户通知的简化分页结果。
|
||
type PersonalNotificationListResponse struct {
|
||
Items []NotificationItem `json:"items" description:"当前个人客户可见的业务通知列表"`
|
||
Total int64 `json:"total" description:"总数量"`
|
||
Page int `json:"page" description:"页码"`
|
||
Size int `json:"size" description:"每页数量"`
|
||
}
|