活动配置优化
This commit is contained in:
parent
fa8e1a93d7
commit
76e18cac7b
@ -414,7 +414,7 @@ func GetServerMailData(data *[]*SqlServerMailStruct) error {
|
||||
}
|
||||
|
||||
func GetActivityData(data *[]*SqlActivityCfgStruct) error {
|
||||
sql := "select `id`, `type`, `title`, `mail_title`, `mail_content`, `level_limit`, `start_time`, `end_time`, `reward`, `extra` from t_activity_mod"
|
||||
sql := "select `id`, `type`, `title`, `mail_title`, `mail_content`, `level_limit`, `start_time`, `end_time`, `cfg`, `extra` from t_activity_mod"
|
||||
err := SqlDb.Select(data, sql)
|
||||
return err
|
||||
}
|
||||
|
||||
@ -506,7 +506,7 @@ type SqlActivityCfgStruct struct {
|
||||
Level int `db:"level_limit"`
|
||||
Start_time int64 `db:"start_time"`
|
||||
End_time int64 `db:"end_time"`
|
||||
RewardItem string `db:"reward"`
|
||||
Cfg []byte `db:"cfg_buf"`
|
||||
Extra string `db:"extra"`
|
||||
}
|
||||
|
||||
|
||||
@ -27,13 +27,13 @@ type ActivityCfg struct {
|
||||
Title string
|
||||
MailTitle string
|
||||
MailContent string
|
||||
RewardItem map[string]interface{}
|
||||
cfg map[string]interface{}
|
||||
Extra map[string]interface{}
|
||||
}
|
||||
|
||||
func (ac *ActivityCfg) String() string {
|
||||
return fmt.Sprintf("Id: %d, Type: %d, StartTime: %d, EndTime: %d, Level: %d, Title: %s, MailTitle: %s, MailContent: %s, RewardItem: %v, Extra: %v",
|
||||
ac.Id, ac.Type, ac.Strartime, ac.Endtime, ac.Level, ac.Title, ac.MailTitle, ac.MailContent, ac.RewardItem, ac.Extra)
|
||||
return fmt.Sprintf("Id: %d, Type: %d, StartTime: %d, EndTime: %d, Level: %d, Title: %s, MailTitle: %s, MailContent: %s, cfg: %v, Extra: %v",
|
||||
ac.Id, ac.Type, ac.Strartime, ac.Endtime, ac.Level, ac.Title, ac.MailTitle, ac.MailContent, ac.cfg, ac.Extra)
|
||||
}
|
||||
|
||||
const ()
|
||||
@ -85,13 +85,6 @@ func (r *ActivityMgr) Reload() error {
|
||||
data.List = make(map[int]*ActivityCfg, 0)
|
||||
for _, v := range cfgList {
|
||||
reward := make(map[string]interface{})
|
||||
if v.RewardItem != "" {
|
||||
err := json.Unmarshal([]byte(v.RewardItem), &reward)
|
||||
if err != nil {
|
||||
log.Error("Unmarshal reward error: %v", err)
|
||||
continue
|
||||
}
|
||||
}
|
||||
extra := make(map[string]interface{})
|
||||
if v.Extra != "" {
|
||||
err := json.Unmarshal([]byte(v.Extra), &extra)
|
||||
@ -109,7 +102,7 @@ func (r *ActivityMgr) Reload() error {
|
||||
Title: v.Title,
|
||||
MailTitle: v.MailTitle,
|
||||
MailContent: v.MailContent,
|
||||
RewardItem: reward,
|
||||
cfg: reward,
|
||||
Extra: extra,
|
||||
}
|
||||
log.Debug("load activity cfg: %v", cfg)
|
||||
|
||||
@ -69,6 +69,7 @@ type Player struct {
|
||||
stopOnce sync.Once
|
||||
msgChanOnce sync.Once
|
||||
func_time int
|
||||
config_list map[string]interface{}
|
||||
}
|
||||
|
||||
type PlayerBackUp struct {
|
||||
|
||||
@ -162,7 +162,8 @@ CREATE TABLE IF NOT EXISTS t_activity_mod (
|
||||
`start_time` int unsigned NOT NULL DEFAULT '0' COMMENT '活动开始时间',
|
||||
`end_time` int unsigned NOT NULL DEFAULT '0' COMMENT '活动结束时间',
|
||||
`level_limit` int unsigned NOT NULL DEFAULT '0' COMMENT '等级限制',
|
||||
`reward` varchar(2048) DEFAULT '' COMMENT '活动奖励',
|
||||
`extra` varchar(2048) DEFAULT '' COMMENT '活动额外数据',
|
||||
`cfg` TEXT DEFAULT '' COMMENT '活动配置',
|
||||
`cfg_buf` BLOB DEFAULT NULL COMMENT '活动配置buf',
|
||||
`extra` TEXT DEFAULT '' COMMENT '活动额外数据',
|
||||
`updateTime` int unsigned NOT NULL DEFAULT '0' COMMENT '更新时间'
|
||||
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE utf8mb4_general_ci COMMENT = '系统活动表';
|
||||
Loading…
Reference in New Issue
Block a user