service/dbstruct/product.go

133 lines
6.0 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 dbstruct
import "service/bizcommon/util"
// 商品id
const (
ProductIdOpCoin = "op_coin" // op充值的金币
ProductIdH5CustomCoin = "h5_custom_coin" // H5 自定义金币
ProductIdH5Coin500 = "h5_coin_500" // H5 500币
ProductIdH5Coin1000 = "h5_coin_1000" // H5 1000币
ProductIdH5Coin3000 = "h5_coin_3000" // H5 3000币
ProductIdH5Coin5000 = "h5_coin_5000" // H5 5000币
ProductIdH5Coin8000 = "h5_coin_8000" // H5 8000币
ProductIdH5Coin10000 = "h5_coin_10000" // H5 10000币
ProductIdH5Coin15000 = "h5_coin_15000" // H5 15000币
ProductIdH5Coin18000 = "h5_coin_18000" // H5 18000币
ProductIdH5Coin20000 = "h5_coin_20000" // H5 20000币
ProductIdIosCoin70 = "70_gold"
ProductIdIosCoin350 = "350_gold"
ProductIdIosCoin686 = "686_gold"
ProductIdIosCoin2086 = "2086_gold"
ProductIdIosCoin4886 = "4886_gold"
ProductIdIosCoin6986 = "6986_gold"
ProductIdIosCoin9086 = "9086_gold"
ProductIdIosCoin13986 = "13986_gold"
ProductIdIosCoin20986 = "20986_gold"
ProductIdContactWechat = "contact_wechat" // 微信联系方式
ProductIdH5ContactWechat = "h5_contact_wechat" // h5的联系方式rmb直接解锁
ProductIdSuperfanGiftContactWechat = "superfan_gift_contact_wechat" // 超粉赠送的联系方式
ProductIdMembership = "membership" // 会员
ProductIdH5Membership = "h5_membership" // 会员
ProductIdH5ZoneMoment = "h5_zone_moment" // 空间动态
ProductIdH5ZoneAdmission = "h5_zone_admission" // 空间普通会员
ProductIdH5ZoneIronfanship = "h5_zone_ironfanship" // 空间铁粉
ProductIdH5ZoneSuperfanship = "h5_zone_superfanship" // 空间超粉
ProductIdOuterRaven = "outer_raven" // 瑞文测试
)
var ProductIdDescMap = map[string]string{
ProductIdOpCoin: "op充值金币",
ProductIdH5CustomCoin: "自定义金币",
ProductIdH5Coin500: "500金币",
ProductIdH5Coin1000: "1000金币",
ProductIdH5Coin3000: "3000金币",
ProductIdH5Coin5000: "5000金币",
ProductIdH5Coin8000: "8000金币",
ProductIdH5Coin10000: "10000金币",
ProductIdH5Coin15000: "15000金币",
ProductIdH5Coin18000: "18000金币",
ProductIdH5Coin20000: "20000金币",
ProductIdH5ContactWechat: "h5解锁微信",
ProductIdSuperfanGiftContactWechat: "超粉赠送解锁微信",
ProductIdContactWechat: "解锁微信",
ProductIdMembership: "永久会员",
ProductIdH5Membership: "h5永久会员",
ProductIdH5ZoneMoment: "空间动态",
ProductIdH5ZoneAdmission: "解锁空间",
ProductIdH5ZoneSuperfanship: "解锁超粉",
ProductIdIosCoin70: "ios_70金币",
ProductIdIosCoin350: "ios_350金币",
ProductIdIosCoin686: "ios_686金币",
ProductIdIosCoin2086: "ios_2086金币",
ProductIdIosCoin4886: "ios_4886金币",
ProductIdIosCoin6986: "ios_6986金币",
ProductIdIosCoin9086: "ios_9086金币",
ProductIdIosCoin13986: "ios_13986金币",
ProductIdIosCoin20986: "ios_20986金币",
}
var CoinPayValidProductIdMap = map[string]bool{
ProductIdMembership: true,
ProductIdH5ZoneMoment: true,
ProductIdH5ZoneAdmission: true,
ProductIdH5ZoneSuperfanship: true,
}
// 商品类型
const (
ProductTypeCoins = "coins" // 商品类型:金币
ProductTypeMoneyContact = "money_contact" // 商品类型:联系方式
ProductTypeMoneyMembership = "money_membership" // 商品类型:会员资格
ProductTypeZone = "zone" // 商品类型:空间
)
// 商品支付手段
const (
ProductPayMeansMoney = 1 // 现金支付
ProductPayMeansCoin = 2 // 心愿币支付
)
// 商品定价类型
const (
ProductPriceFixTypeOfficial = 1 // 官方定价
ProductPriceFixTypeUser = 2 // 用户自主定价
ProductPriceFixTypeCalc = 3 // 计算获取价格
)
// 商品
type Product struct {
Id string `json:"id" bson:"_id"` // 物料id
Type string `json:"type" bson:"type"` // 商品类型ProductType*
PayMeans int `json:"pay_means" bson:"pay_means"` // 支付手段ProductPayMeans*
PriceFixType int `json:"price_fix_type" bson:"price_fix_type"` // 定价类型见ProductPriceFixType*
Mid int64 `json:"mid" bson:"mid"` // 用户id
DevType int `json:"dev_type" bson:"dev_type"` // 设备类型common.DeviceType*
Name string `json:"name" bson:"name"` // 商品名
Subject string `json:"subject" json:"subject"` // 主题
Desc string `json:"desc" bson:"desc"` // 描述
RealPrice int64 `json:"real_price" bson:"real_price"` // 真实价格,单位: 分
OriPrice int64 `json:"ori_price" bson:"ori_price"` // 原价格(划线价),单位: 分
ValueCoins int64 `json:"value_coins" bson:"value_coins"` // 该商品价值的金币数
RealCoinPrice int64 `json:"real_coin_price" bson:"real_coin_price"` // 真实价格:心愿币
OriCoinPrice int64 `json:"ori_coin_price" bson:"ori_coin_price"` // 原价格:心愿币
DelFlag int `json:"del_flag" bson:"del_flag"` // 删除标记1已删除0未删除
ImageIds []int64 `json:"image_ids" bson:"image_ids"` // 图片ids
VideoIds []int64 `json:"video_ids" bson:"video_ids"` // 视频ids
Ct int64 `json:"ct" bson:"ct"`
Ut int64 `json:"ut" bson:"ut"`
Images []*ToCImage `json:"images"`
Videos []*ToCVideo `json:"videos"`
}
func (p Product) GetRealPriceCoin() int64 {
return util.RoundUp(float64(p.RealPrice) / 10.0)
}