123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345 |
- package model
- import (
- "leafstalk/otherutils/deepcopy"
- "strconv"
- "xorm.io/xorm"
- )
- const (
- AcRewardStatusUnavailable = 0 // 不可领取
- AcRewardStatusAvailable = 1 // 可领取
- AcRewardStatusClaimed = 2 // 已领取
- // 月卡类型
- MonthCardTypeFreeAd = 1 // 观影月卡
- MonthCardTypeSuper = 2 // 超值月卡
- MonthCardTypeDouble = 3 // 双月卡
- // 活跃战令增加积分
- WarOrderActivePointFastPatrol = 15 // 快速巡逻15分
- WarOrderActivePointPassMainSingle = 5 // 通关主线5分 todo
- WarOrderActivePointPassMainMulti = 80 // 通关精英80分 todo
- WarOrderActivePointPassCooperationGeneral = 150 // 通关合作模式普通150分 todo
- WarOrderActivePointPassCooperationDifficulty = 220 // 通关合作模式困难220分 todo
- WarOrderActivePointPassCooperationNightmare = 260 // 通关合作模式噩梦260分 todo
- WarOrderActivePointPassPVP = 200 // 竞技场200分 todo
- )
- type PlayerAc struct {
- Id int64
- PlayerId int64 `xorm:"BIGINT index 'playerid'"`
- // 活跃战令
- ActiveWarOrder *ActiveWarOrder `xorm:"TEXT json 'activeWarOrder'"`
- // 等级战令
- GradeWarOrder *GeneralWarOrder `xorm:"TEXT json 'gradeWarOrder'"`
- // 主线战令
- LineWarOrder *GeneralWarOrder `xorm:"TEXT json 'lineWarOrder'"`
- // 7日签到
- SevenDaySignIn *SevenDaySignInStatus `xorm:"TEXT json 'sevenDaySignIn'"`
- // 每日特惠
- DailyDeal *DailyDealStatus `xorm:"TEXT json 'dailyDeal'"`
- // 特惠礼包-新手礼包
- DiscountPack *DiscountPackStatus `xorm:"TEXT json 'discountPack'"`
- // 特惠礼包-每日礼包
- DiscountDayPack *DiscountPackStatus `xorm:"TEXT json 'discountDayPack'"`
- // 特惠礼包-每周礼包
- DiscountWeekPack *DiscountPackStatus `xorm:"TEXT json 'discountWeekPack'"`
- // 特惠礼包-每月礼包
- DiscountMoonPack *DiscountPackStatus `xorm:"TEXT json 'discountMoonPack'"`
- DailyRecharges []*DayRecharge `xorm:"TEXT json 'dailyRecharges'"`
- CycleRecharge *CycleRecharge `xorm:"TEXT json 'cycleRecharge'"`
- TriggerGifts map[int64]int64 `xorm:"TEXT json 'triggerGifts'"`
- GateId int64 `xorm:"-"`
- // 开服活动-首充
- FirstCharge map[int64]*FirstChargeStatus `xorm:"TEXT json 'firstCharge'"` // 计费点区分档位 {计费点Id:FirstChargeStatus{}}
- }
- type ActiveWarOrder struct {
- // 周期开始时间
- StartTs int64 `json:"startTs"`
- // 是否开通高级战令
- IsSenior bool `json:"isSenior"`
- // 是否开通豪华战令
- IsLuxury bool `json:"isLuxury"`
- // 看广告获得双倍积分计数
- AdCount int64 `json:"adCount"`
- // 看广告获得双倍积分标志
- AdDoubleFlag bool `json:"adDoubleFlag"`
- // 今日获得积分统计
- DayPointCount int64 `json:"dayCountPoint"`
- // 最后一次获取积分的时间
- LastPointTs int64 `json:"lastPointTs"`
- // 周期内积分总数
- PointTotal int64 `json:"totalPoint"`
- FreeLevel int64 `json:"freeLevel"` // 已领取的最大免费奖励等级
- SeniorLevel int64 `json:"seniorLevel"` // 已领取的最大高级奖励等级
- LuxuryLevel int64 `json:"luxuryLevel"` // 已领取的最大豪华奖励等级
- // 最后一次领取奖励的时间
- LastAwardTs int64 `json:"lastAwardTs"`
- }
- // 通用
- type GeneralWarOrder struct {
- IsSenior bool `json:"isSenior"` // 是否开通高级战令
- FreeLevel int64 `json:"freeLevel"` // 已领取的最大免费奖励等级
- SeniorLevel int64 `json:"seniorLevel"` // 已领取的最大高级奖励等级
- }
- // 7日签到状态
- type SevenDaySignInStatus struct {
- // 当日活跃度
- DayActive int64 `json:"dayActive"`
- // 最后一次获取活跃度的时间
- LastActiveTs int64 `json:"lastActiveTs"`
- // 奖励状态
- Award map[int64]*SignInAwardStatus `json:"award"`
- // 最后一次签到时间
- LastSignInTs int64 `json:"lastSignInTs"`
- }
- // 签到奖励领取状态
- type SignInAwardStatus struct {
- Free int64 `json:"free"`
- Active int64 `json:"active"`
- }
- // 每日特惠
- type DailyDealStatus struct {
- // 每日特惠刷新时间
- RefreshTs int64 `json:"refreshTs"`
- // {Uid:周期内购买次数}
- BuyStatus map[int64]int64 `json:"buyStatus"`
- }
- // 特惠礼包
- type DiscountPackStatus struct {
- // 刷新时间
- RefreshTs int64 `json:"refreshTs"`
- // {Uid:周期内购买次数}
- BuyStatus map[int64]int64 `json:"buyStatus"`
- }
- // 每日充值
- type DayRecharge struct {
- Level int64 `json:"level"` // 档位
- Cycle int64 `json:"cycle"` // 总轮数
- OpenDaySum int64 `json:"openDay"` // 开放的天数
- ProcessReward int64 `json:"prcsReward"` // 领取的进度奖励
- LastTs int64 `json:"lastTs"` // 最后一次充值时间
- LastRecharge int64 `json:"recharge"` // 最后一天充值金额
- DayReward int64 `json:"dayReward"` // 领取的日奖励
- }
- // 任务完成的天数
- func (dr *DayRecharge) GetTaskSucessDay() int64 {
- if dr.LastRecharge >= dr.Level {
- return dr.OpenDaySum
- }
- return dr.OpenDaySum - 1
- }
- // 循环充值
- type CycleRecharge struct {
- Sum int64 `json:"sum"` // 总充值钻石数
- Num int64 `json:"num"` // 本轮累计充值钻石数
- Reward int64 `json:"reward"` // 领取的最后一个奖励的档位
- }
- // 首充
- type FirstChargeStatus struct {
- // 购买时间
- BuyTs int64 `json:"buyTs"`
- // 已领取奖励的最后一个天数
- Reward int64 `json:"reward"`
- }
- func (m PlayerAc) TableName() string {
- return "player_ac"
- }
- func (m *PlayerAc) QueryExist(eng *xorm.Engine) (bool, error) {
- player := new(PlayerAc)
- player.PlayerId = m.PlayerId
- return eng.Exist(player)
- }
- func (m *PlayerAc) UpdateDB(eng *xorm.Engine) (int64, error) {
- return eng.Where("playerid=?", m.PlayerId).AllCols().Update(m)
- }
- func (m *PlayerAc) GetUniqueKey() string {
- return strconv.FormatInt(m.PlayerId, 10)
- }
- func CopyPlayerAc(old *PlayerAc) *PlayerAc {
- nu := deepcopy.MustCopy(old).(*PlayerAc)
- return nu
- }
- func (m *PlayerAc) GetDailyRecharge(level int64) *DayRecharge {
- for _, v := range m.DailyRecharges {
- if v.Level == level {
- return v
- }
- }
- return nil
- }
- // 活跃战令-WarOrderActive exported from 活动-战令.xlsx
- type WarOrderActive struct {
- Lv int64 `json:"Lv"` // 等级
- Exp int64 `json:"Exp"` // 升级经验
- FreeFile [][]int64 `json:"FreeFile"` // 免费战令
- SeniorFile [][]int64 `json:"SeniorFile"` // 高级战令
- IuxuriousFile [][]int64 `json:"IuxuriousFile"` // 豪华战令
- } // package model
- // 等级战令-WarOrderGrade exported from 活动-战令.xlsx
- type WarOrderGrade struct {
- Lv int64 `json:"Lv"` // 玩家等级
- FreeFile [][]int64 `json:"FreeFile"` // 免费奖励
- SeniorFile [][]int64 `json:"SeniorFile"` // 高级奖励
- } // package model
- // 主线战令-WarOrderLine exported from 活动-战令.xlsx
- type WarOrderLine struct {
- Lv int64 `json:"Lv"` // 通过主线ID 关联关卡表ID
- FreeFile [][]int64 `json:"FreeFile"` // 免费奖励
- SeniorFile [][]int64 `json:"SeniorFile"` // 高级奖励
- } // package model
- // 战令配置-WarOrderValue exported from 活动-战令.xlsx
- type WarOrderValue struct {
- Uid int64 `json:"Uid"` // ID
- PriceId int64 `json:"PriceId"` // 参数
- }
- // 7日签到-SevenDaySignIn exported from 活动-签到.xlsx
- type SevenDaySignIn struct {
- Uid int64 `json:"Uid"` // ID
- Days int64 `json:"Days"` // 天数
- Reward [][]int64 `json:"Reward"` // 奖励
- }
- // 签到双倍-SevenDaySignInDouble exported from 活动-7日签到.xlsx
- type SevenDaySignInDouble struct {
- Condition int64 `json:"Condition"` // 签到奖励再次领取要求 (日常任务活跃度)
- }
- // 月卡-MonthlyCard exported from 活动-月卡.xlsx
- type MonthlyCard struct {
- Type int64 `json:"Type"` // 月卡类型 1--观影月卡 2--超值月卡 3---双月卡特权
- NoAd int64 `json:"NoAd"` // 免广告 0--无特权 1-有特权
- InfinitePatrol int64 `json:"InfinitePatrol"` // 无限快速巡逻 0--无特权 1-有特权
- BrawnUp int64 `json:"BrawnUp"` // 体力上限 0--无特权 数值-增加上限
- EnergyUp int64 `json:"EnergyUp"` // 精力上限 0--无特权 数值-增加上限
- BrawnNum int64 `json:"BrawnNum"` // 每日体力购买次数 0--无特权 数值-增加上限
- EnergyNum int64 `json:"EnergyNum"` // 每日精力购买次数 0--无特权 数值-增加上限
- BrawnreStore float64 `json:"BrawnreStore"` // 体力恢复速度 百分比值 0--无特权 数值-增加上限
- Speed int64 `json:"Speed"` // 主线关卡开启3倍速 0--无特权 1-有特权
- ActivationReward []int64 `json:"ActivationReward"` // 激活奖励
- Reward [][]int64 `json:"Reward"` // 每日奖励
- Price int64 `json:"Price"` // 计费点ID
- } // package model
- // 特权卡-PrivilegeCard exported from 活动-月卡.xlsx
- type PrivilegeCard struct {
- Type int64 `json:"Type"` // 月卡类型 1--永久钻石卡 2--永久巡逻卡
- NoAd int64 `json:"NoAd"` // 巡逻钻石基础产出 0--无 数值-增加上限(数量/时)
- InfinitePatrol int64 `json:"InfinitePatrol"` // 快速点数 0--无 数值-增加上限
- BrawnUp int64 `json:"BrawnUp"` // 快速时长增加值 0--无 数值-增加上限
- Price int64 `json:"Price"` // 计费点ID
- } // package model
- // 月卡福利-MonthlyCardBenefit exported from 活动-月卡.xlsx
- type MonthlyCardBenefit struct {
- Reward [][]int64 `json:"Reward"` // 奖励
- }
- const (
- DailyDealFree = 1 // 免费
- DailyDeal6Yuan = 2 // 6元礼包
- DailyDeal12Yuan = 3 // 12元礼包
- DailyDeal18Yuan = 4 // 18元礼包
- DailyDealLucky = 5 // 特惠专属福袋
- )
- // 每日特惠-DailyDeal exported from 活动-每日特惠.xlsx
- type DailyDeal struct {
- Uid int64 `json:"Uid"` // ID
- Name string `json:"Name"` // 名称
- GiftPack [][]int64 `json:"GiftPack"` // 礼包
- Quota int64 `json:"Quota"` // 每日限购次数
- Price []int64 `json:"Price"` // 价格 [支付方式,道具ID,数量] 1-现金 2-广告 3-道具 4-免费
- PriceId int64 `json:"PriceId"` // 价格挡位 关联计费点CDRP中ID
- Video int64 `json:"Video"` // 广告点ID
- } // package model
- // 特惠价格-DailyDealPrice exported from 活动-每日特惠.xlsx
- type DailyDealPrice struct {
- Uid int64 `json:"Uid"` // ID
- Name string `json:"Name"` // 名称
- Quota int64 `json:"Quota"` // 每日限购次数
- PriceId int64 `json:"PriceId"` // 价格挡位 关联计费点CDRP中ID
- }
- // 新手特惠礼包-DiscountPack exported from 活动-特惠礼包.xlsx
- type DiscountPack struct {
- Uid int64 `json:"Uid"` // ID
- Name string `json:"Name"` // 名称
- GiftPack []int64 `json:"GiftPack"` // 礼包
- Quota int64 `json:"Quota"` // 限购次数 终身限购
- Discount float64 `json:"Discount"` // 折扣 用于前端界面显示(百分比值)
- Price []int64 `json:"Price"` // 价格 [支付方式,道具ID,数量] 1-现金 2-广告 3-道具 4-免费
- CdrpId int64 `json:"CdrpId"` // 计费点
- Video int64 `json:"Video"` // 广告点ID
- } // package model
- // 每日特惠礼包-DiscountDayPack exported from 活动-特惠礼包.xlsx
- type DiscountDayPack struct {
- Uid int64 `json:"Uid"` // ID
- Name string `json:"Name"` // 名称
- GiftPack []int64 `json:"GiftPack"` // 礼包
- Quota int64 `json:"Quota"` // 限购次数 每日0点重置
- Discount float64 `json:"Discount"` // 折扣 用于前端界面显示(百分比值)
- Price []int64 `json:"Price"` // 价格 [支付方式,道具ID,数量] 1-现金 2-广告 3-道具 4-免费
- CdrpId int64 `json:"CdrpId"` // 计费点
- Video int64 `json:"Video"` // 广告点ID
- } // package model
- // 每周特惠礼包-DiscountWeekPack exported from 活动-特惠礼包.xlsx
- type DiscountWeekPack struct {
- Uid int64 `json:"Uid"` // ID
- Name string `json:"Name"` // 名称
- GiftPack []int64 `json:"GiftPack"` // 礼包
- Quota int64 `json:"Quota"` // 限购次数 每周一0点重置
- Discount float64 `json:"Discount"` // 折扣 用于前端界面显示(百分比值)
- Price []int64 `json:"Price"` // 价格 [支付方式,道具ID,数量] 1-现金 2-广告 3-道具 4-免费
- CdrpId int64 `json:"CdrpId"` // 计费点
- Video int64 `json:"Video"` // 广告点ID
- } // package model
- // 每月特惠礼包-DiscountMoonPack exported from 活动-特惠礼包.xlsx
- type DiscountMoonPack struct {
- Uid int64 `json:"Uid"` // ID
- Name string `json:"Name"` // 名称
- GiftPack []int64 `json:"GiftPack"` // 礼包
- Quota int64 `json:"Quota"` // 限购次数 每月1号0点重置
- Discount float64 `json:"Discount"` // 折扣 用于前端界面显示(百分比值)
- Price []int64 `json:"Price"` // 价格 [支付方式,道具ID,数量] 1-现金 2-广告 3-道具 4-免费
- CdrpId int64 `json:"CdrpId"` // 计费点
- Video int64 `json:"Video"` // 广告点ID
- }
- // 首充-FirstCharge exported from 活动-首充.xlsx
- type FirstCharge struct {
- Uid int64 `json:"Uid"` // ID
- PriceId int64 `json:"PriceId"` // 价格挡位 关联计费点CDRP中ID
- Day int64 `json:"Day"` // 天数
- Reward [][]int64 `json:"Reward"` // 奖励
- }
|