仪表盘待办与穿搭概况改为公开/私密/已封禁口径,移除恒为零的待审核统计;补齐额度凭证来源 source=4 与流水 change_type=7 枚举及订单商品类型、额度有效期快照字段;管理员发放与回收额度凭证在同一事务内写入人工调整流水,回收流水使用独立 order_no 避免撞唯一索引,并增加凭证归属校验;对齐 Quota 配置免费额度值,同步更新 README 与配置说明。
162 lines
5.3 KiB
Go
162 lines
5.3 KiB
Go
package service
|
||
|
||
// 本文件集中定义管理后台各业务域的状态/类型枚举常量,消除魔法数字。
|
||
// 取值与业务服务(zt-closet-backend)internal/service/constants.go 及各表字段注释保持一致。
|
||
|
||
// ===== 管理员 AdminUser =====
|
||
const (
|
||
AdminRoleSuper int8 = 1 // 超级管理员
|
||
AdminRoleNormal int8 = 2 // 普通管理员
|
||
|
||
AdminStatusEnabled int8 = 1 // 启用
|
||
AdminStatusDisabled int8 = 2 // 禁用
|
||
)
|
||
|
||
// ===== 用户 User =====
|
||
const (
|
||
UserStatusNormal int8 = 1 // 正常
|
||
UserStatusTempBan int8 = 2 // 临时禁用
|
||
UserStatusPermBan int8 = 3 // 永久禁用
|
||
UserStatusDeactivated int8 = 4 // 已注销
|
||
|
||
VIPTypeNone int8 = 1 // 非会员
|
||
VIPTypeMonthly int8 = 2 // 月度会员
|
||
VIPTypeYearly int8 = 3 // 年度会员
|
||
VIPTypeTrial int8 = 4 // 体验会员
|
||
)
|
||
|
||
// ===== 配额 Quota =====
|
||
const (
|
||
QuotaTypeCos int8 = 1 // COS 上传
|
||
QuotaTypeAI int8 = 2 // AI 推荐
|
||
QuotaTypeOutfitShare int8 = 3 // 社区分享
|
||
QuotaTypeClosetShare int8 = 4 // 衣柜分享
|
||
|
||
// 额度凭证来源(quota_grants.source)
|
||
QuotaGrantSourceMember int8 = 1 // 会员包(跟随 VIP 有效期,续期自动延长)
|
||
QuotaGrantSourceAddon int8 = 2 // 加量包(独立有效期)
|
||
QuotaGrantSourceAdReward int8 = 3 // 广告激励(当天有效)
|
||
QuotaGrantSourceTrial int8 = 4 // 体验会员赠送(新用户注册;固定有效期=体验期结束,不随续费延长)
|
||
|
||
QuotaChangeTargetAdjust int8 = 1 // 配额调整
|
||
QuotaChangeTargetUse int8 = 2 // 使用
|
||
|
||
// 额度流水变更类型(quota_flow_logs.change_type)。
|
||
// 购买获赠(1)/活动赠送(2)/上传消耗(3)/删除回退(4)/退款回收(6)/到期失效(7) 由业务服务写入,
|
||
// 管理后台仅写入人工调整(5)。
|
||
QuotaChangeTypeManual int8 = 5 // 人工调整(管理后台发放/回收额度时写入)
|
||
QuotaChangeTypeExpire int8 = 7 // 到期失效(固定有效期凭证过期,由业务服务定时任务补记)
|
||
)
|
||
|
||
// 免费额度内置兜底值(与业务服务 DefaultQuota* 对齐;仅当 Quota 配置段未配置时使用)。
|
||
const (
|
||
DefaultQuotaCos int64 = 20 // 免费上传额度(永久)
|
||
DefaultQuotaAI int64 = 3 // 免费 AI 推荐额度(每日)
|
||
DefaultQuotaOutfitShare int64 = 10 // 免费社区分享额度(每日)
|
||
DefaultQuotaClosetShare int64 = 5 // 免费衣柜分享额度(每日)
|
||
)
|
||
|
||
// ===== VIP 流水 =====
|
||
const (
|
||
VIPChangeTypeManual int8 = 5 // 人工调整
|
||
|
||
VIPSourceManual int8 = 4 // 人工调整
|
||
)
|
||
|
||
// ===== 商品 Goods =====
|
||
const (
|
||
GoodsTypeMember int8 = 1 // 会员包
|
||
GoodsTypeUpload int8 = 2 // 上传包
|
||
GoodsTypeAIRecommend int8 = 3 // AI 推荐包
|
||
GoodsTypeClosetShare int8 = 4 // 衣柜分享包
|
||
GoodsTypeOutfitShare int8 = 5 // 搭配分享包
|
||
|
||
GoodsStatusOnShelf int8 = 1 // 上架
|
||
GoodsStatusOffShelf int8 = 2 // 下架
|
||
|
||
// 虚拟支付道具发布状态
|
||
GoodsProductUnpublished int8 = 0 // 未发布
|
||
GoodsProductPublishing int8 = 1 // 发布中(上传/发布任务处理中)
|
||
GoodsProductPublished int8 = 2 // 已发布
|
||
GoodsProductPublishFail int8 = 3 // 发布失败
|
||
)
|
||
|
||
// ===== 订单 Order =====
|
||
const (
|
||
OrderStatusPending int8 = 1 // 待支付
|
||
OrderStatusPaid int8 = 2 // 已支付
|
||
OrderStatusCancelled int8 = 3 // 已取消
|
||
OrderStatusExpired int8 = 4 // 已过期
|
||
OrderStatusRefunded int8 = 5 // 已退款
|
||
|
||
PayChannelWechat int8 = 1 // 微信支付(普通 JSAPI)
|
||
PayChannelVirtual int8 = 2 // 微信虚拟支付(XPay)
|
||
|
||
// 虚拟支付平台(由前端按 systemInfo.platform 上报)
|
||
XPayPlatformAndroid = "android"
|
||
XPayPlatformIOS = "ios"
|
||
XPayPlatformHarmony = "harmony"
|
||
XPayPlatformWindows = "windows"
|
||
)
|
||
|
||
// ===== 退款 Refund =====
|
||
const (
|
||
RefundStatusPending int8 = 0 // 待处理
|
||
RefundStatusProcessing int8 = 1 // 退款中
|
||
RefundStatusSuccess int8 = 2 // 退款成功
|
||
RefundStatusFailed int8 = 3 // 退款失败
|
||
)
|
||
|
||
// ===== 穿搭 Outfit =====
|
||
const (
|
||
OutfitSourceUser int8 = 1 // 用户创建
|
||
OutfitSourceAI int8 = 2 // AI 推荐
|
||
|
||
OutfitPrivate int8 = 1 // 不公开
|
||
OutfitPublic int8 = 2 // 公开
|
||
|
||
OutfitAuditPending int8 = 1 // 待审核
|
||
OutfitAuditPass int8 = 2 // 审核通过
|
||
OutfitAuditReject int8 = 3 // 审核不通过
|
||
|
||
OutfitStatusNormal int8 = 1 // 正常
|
||
OutfitStatusBanned int8 = 2 // 封禁
|
||
OutfitStatusUnsaved int8 = 3 // 待用户保存
|
||
)
|
||
|
||
// ===== 衣柜分享 ClosetShare =====
|
||
const (
|
||
ShareTypePartial int8 = 1 // 部分衣物分享
|
||
ShareTypeSnapshot int8 = 2 // 全量快照分享
|
||
|
||
ShareStatusNormal int8 = 1 // 正常
|
||
ShareStatusCancelled int8 = 2 // 用户取消
|
||
ShareStatusExpired int8 = 3 // 已过期
|
||
ShareStatusBanned int8 = 4 // 管理员封禁
|
||
)
|
||
|
||
// ===== 衣物 Clothes 图片处理状态 =====
|
||
const (
|
||
ImageProcessMatting int8 = 1 // 抠图中
|
||
ImageProcessClassifying int8 = 2 // 分类中
|
||
ImageProcessQueuing int8 = 3 // 排队中
|
||
ImageProcessSuccess int8 = 4 // 成功
|
||
ImageProcessFailed int8 = 5 // 失败
|
||
)
|
||
|
||
// ===== 通知 Notification =====
|
||
const (
|
||
NotificationTypeSystem int8 = 3 // 系统通知
|
||
|
||
NotificationUnread int8 = 1 // 未读
|
||
NotificationRead int8 = 2 // 已读
|
||
|
||
NotificationSenderSystem int64 = 0 // 系统发送者 ID
|
||
)
|
||
|
||
// ===== 审核日志 AuditLog =====
|
||
const (
|
||
AuditResultPass int8 = 1 // 通过
|
||
AuditResultReject int8 = 2 // 驳回
|
||
)
|