活动配置解析优化

This commit is contained in:
hahwu 2026-04-13 16:19:49 +08:00
parent a074fce5bd
commit d117ad6912
3 changed files with 6 additions and 6 deletions

View File

@ -417,7 +417,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`, `cfg_buf`, `extra`, `interval` from t_activity_mod"
sql := "select `id`, `type`, `title`, `mail_title`, `mail_content`, `level_limit`, `start_time`, `end_time`, `cfg`, `extra`, `interval` from t_activity_mod"
err := SqlDb.Select(data, sql)
return err
}

View File

@ -506,7 +506,7 @@ type SqlActivityCfgStruct struct {
Level int `db:"level_limit"`
Start_time int64 `db:"start_time"`
End_time int64 `db:"end_time"`
Cfg []byte `db:"cfg_buf"`
Cfg string `db:"cfg"`
Interval int64 `db:"interval"`
Extra string `db:"extra"`
}

View File

@ -12,7 +12,7 @@ import (
"gitea.bywaystudios.com/pet_home/leaf/log"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/encoding/protojson"
)
type ActivityMgr struct {
@ -155,21 +155,21 @@ func unmarshalActivityCfg(atype int, buf []byte) (interface{}, error) {
switch atype {
case 1:
cfg := &protoMsg.MiningCfg{}
err := proto.Unmarshal(buf, cfg)
err := protojson.Unmarshal(buf, cfg)
if err != nil {
return nil, err
}
return cfg, nil
case 9:
cfg := &protoMsg.ChampionshipCfg{}
err := proto.Unmarshal(buf, cfg)
err := protojson.Unmarshal(buf, cfg)
if err != nil {
return nil, err
}
return cfg, nil
case 10:
cfg := &protoMsg.CatReturnGiftCfg{}
err := proto.Unmarshal(buf, cfg)
err := protojson.Unmarshal(buf, cfg)
if err != nil {
return nil, err
}