You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

37 lines
2.6 KiB

package comm
// AppGoods 应用内购商品配置:一行 = 某应用的一个内购商品(如 vip_month_1 / ai_点数包)。
// 存 console 主库(与 app_registry / app_product 同库),**按应用名 app_name 隔离**——
// 同一应用在上海/日本/新加坡等多个部署环境共用同一份商品配置,不随部署走。
//
// 放在 comm 的原因:这张表由 console 后台维护、业务侧(pay 发货)读取,两边共用同一结构,
// 与 AgentConfig / ThirdSvcConfig 等跨模块公共库表同一套路。业务侧取自己那份用 AppName()。
//
// 字段与 pb.DBGoods 一一对应(多出 AppName/Sort/Remark/时间戳),多语言沿用 DBGoods.localname 的 JSON 形态:
//
// {"zh-CN":{"name":"月度会员","currency":"¥","price":30},"en-US":{...}}
type AppGoods struct {
Id uint32 `gorm:"primaryKey;autoIncrement;column:id" json:"id"`
AppName string `gorm:"column:app_name;size:64;index" json:"app_name"` // 所属应用名(app_product.name,如 Voitrans)
GoodsId string `gorm:"column:goods_id;size:128;index" json:"goods_id"` // 商品标识(= DBGoods.id / DBPayOrder.product_id,苹果/谷歌后台的内购商品 ID),应用内唯一
Enable bool `gorm:"column:enable" json:"enable"` // 是否上架
Name string `gorm:"column:name;size:128" json:"name"` // 默认名称(无对应语言时的兜底)
// ── 售价与发放内容(语义同 pb.DBGoods)──
Price int32 `gorm:"column:price" json:"price"` // 默认价格(未配该语言时的兜底价)
Usagetype int32 `gorm:"column:usagetype" json:"usagetype"` // 商品类型 pb.UsageType:1翻译 2会议 3智能体 4VIP时长
Ainum int64 `gorm:"column:ainum" json:"ainum"` // 发放的 AI 资源点
Meetnum int64 `gorm:"column:meetnum" json:"meetnum"` // 发放的会议资源点
Tradenum int64 `gorm:"column:tradenum" json:"tradenum"` // 发放的翻译资源点
Viptime int32 `gorm:"column:viptime" json:"viptime"` // 发放的会员时长
// 多语言名称/货币/价格,JSON 同 pb.DBGoods.localname;后台读写经 console 的 api_goods.go 结构化收发。
Localname string `gorm:"column:localname;type:text" json:"localname"`
Sort int32 `gorm:"column:sort" json:"sort"` // 排序权重(小的在前,同值按 id)
Remark string `gorm:"column:remark;size:255" json:"remark"`
Createtime int64 `gorm:"column:createtime" json:"createtime"`
Updatetime int64 `gorm:"column:updatetime" json:"updatetime"`
}
func (AppGoods) TableName() string { return TableAppGoods }