This commit is contained in:
liwei 2022-08-11 12:04:05 +08:00
commit 227e1c1d20
29 changed files with 1659 additions and 463 deletions

File diff suppressed because it is too large Load Diff

View File

@ -60,7 +60,7 @@ func newOptions(config map[string]interface{}, opts ...Option) (options *Options
o(options) o(options)
} }
if options.Log = log.NewTurnlog(options.Debug, log.Clone("sys.discovery", 2)); options.Log == nil { if options.Log = log.NewTurnlog(options.Debug, log.Clone("sys.gin", 3)); options.Log == nil {
err = errors.New("log is nil") err = errors.New("log is nil")
} }
@ -78,7 +78,7 @@ func newOptionsByOption(opts ...Option) (options *Options, err error) {
o(options) o(options)
} }
if options.Log = log.NewTurnlog(options.Debug, log.Clone("sys.discovery", 2)); options.Log == nil { if options.Log = log.NewTurnlog(options.Debug, log.Clone("sys.gin", 3)); options.Log == nil {
err = errors.New("log is nil") err = errors.New("log is nil")
} }

View File

@ -52,6 +52,7 @@ func GetWriter() codecore.IWriter {
} }
func PutWriter(w codecore.IWriter) { func PutWriter(w codecore.IWriter) {
w.Reset()
writerPool.Put(w) writerPool.Put(w)
} }

View File

@ -24,13 +24,13 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.ChatGetListReq)
) )
switch req.Channel { switch req.Channel {
case pb.ChatChannel_World: case pb.ChatChannel_World:
if list, err = this.module.modelChat.GetChatQueue(req.Channel, 0, 0); err != nil { if list, err = this.module.modelChat.getChatQueue(req.Channel, session.GetServiecTag(), "", 0); err != nil {
code = pb.ErrorCode_DBError code = pb.ErrorCode_DBError
return return
} }
break break
case pb.ChatChannel_Union: case pb.ChatChannel_Union:
if list, err = this.module.modelChat.GetChatQueue(req.Channel, 0, 0); err != nil { if list, err = this.module.modelChat.getChatQueue(req.Channel, session.GetServiecTag(), "", 0); err != nil {
code = pb.ErrorCode_DBError code = pb.ErrorCode_DBError
return return
} }
@ -50,13 +50,13 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.ChatGetListReq)
code = pb.ErrorCode_ReqParameterError code = pb.ErrorCode_ReqParameterError
return return
} }
if list, err = this.module.modelChat.GetChatQueue(req.Channel, 0, req.ChannelId); err != nil { if list, err = this.module.modelChat.getChatQueue(req.Channel, session.GetServiecTag(), "", req.ChannelId); err != nil {
code = pb.ErrorCode_DBError code = pb.ErrorCode_DBError
return return
} }
break break
case pb.ChatChannel_System: case pb.ChatChannel_System:
if list, err = this.module.modelChat.GetChatQueue(req.Channel, 0, 0); err != nil { if list, err = this.module.modelChat.getChatQueue(req.Channel, session.GetServiecTag(), "", 0); err != nil {
code = pb.ErrorCode_DBError code = pb.ErrorCode_DBError
return return
} }

View File

@ -35,8 +35,10 @@ func (this *apiComp) Send(session comm.IUserSession, req *pb.ChatSendReq) (code
Id: primitive.NewObjectID().Hex(), Id: primitive.NewObjectID().Hex(),
Channel: req.Channel, Channel: req.Channel,
Suid: session.GetUserId(), Suid: session.GetUserId(),
Stag: session.GetServiecTag(), Slv: req.Ulv,
Uname: req.Uname,
Avatar: req.Avatar, Avatar: req.Avatar,
Stag: session.GetServiecTag(),
Content: req.Content, Content: req.Content,
Ctime: time.Now().Unix(), Ctime: time.Now().Unix(),
} }
@ -83,7 +85,7 @@ func (this *apiComp) Send(session comm.IUserSession, req *pb.ChatSendReq) (code
return return
} }
msg.ChannelId = userexpand.Chatchannel //指定频道 msg.ChannelId = userexpand.Chatchannel //指定频道
if err = this.module.modelChat.addChatMsg(fmt.Sprintf("%s:%d", crosschatkey, userexpand.Chatchannel), int64(max_chat), msg); err != nil { if err = this.module.modelChat.addChatMsg(fmt.Sprintf("%s-%d", crosschatkey, userexpand.Chatchannel), int64(max_chat), msg); err != nil {
code = pb.ErrorCode_DBError code = pb.ErrorCode_DBError
return return
} }

View File

@ -63,7 +63,7 @@ func (this *modelChatComp) QueryUserMsg(uid string) (result []*pb.DBChat, err er
} }
//查询用户未读消息 //查询用户未读消息
func (this *modelChatComp) GetChatQueue(channel pb.ChatChannel, union, area int32) (result []*pb.DBChat, err error) { func (this *modelChatComp) getChatQueue(channel pb.ChatChannel, stag, union string, area int32) (result []*pb.DBChat, err error) {
var ( var (
key string key string
find bson.M find bson.M
@ -74,15 +74,15 @@ func (this *modelChatComp) GetChatQueue(channel pb.ChatChannel, union, area int3
) )
switch channel { switch channel {
case pb.ChatChannel_World: case pb.ChatChannel_World:
key = worldchatkey key = fmt.Sprintf("%s-%s", worldchatkey, stag)
find = bson.M{"channel": channel} find = bson.M{"channel": channel}
break break
case pb.ChatChannel_Union: case pb.ChatChannel_Union:
key = unionchatkey key = fmt.Sprintf("%s-%s", unionchatkey, union)
find = bson.M{"channel": channel, "unionId": union} find = bson.M{"channel": channel, "unionId": union}
break break
case pb.ChatChannel_CrossServer: case pb.ChatChannel_CrossServer:
key = fmt.Sprintf("%s:%d", crosschatkey, area) key = fmt.Sprintf("%s-%d", crosschatkey, area)
find = bson.M{"channel": channel, "areaId": area} find = bson.M{"channel": channel, "areaId": area}
break break
case pb.ChatChannel_System: case pb.ChatChannel_System:
@ -138,7 +138,7 @@ func (this *modelChatComp) AddCrossChannelMember(session comm.IUserSession) (cha
return return
} }
for { for {
key := fmt.Sprintf("%s:%d-member", crosschatkey, channel) key := fmt.Sprintf("%s-%d-member", crosschatkey, channel)
if count, err = this.Redis.Hlen(key); err != nil { if count, err = this.Redis.Hlen(key); err != nil {
this.module.Errorf("err:%v", err) this.module.Errorf("err:%v", err)
return return
@ -167,7 +167,7 @@ func (this *modelChatComp) ChanageChannel(session comm.IUserSession, channel int
var ( var (
maxnum int32 maxnum int32
) )
key := fmt.Sprintf("%s:%d-member", crosschatkey, channel) key := fmt.Sprintf("%s-%d-member", crosschatkey, channel)
count := 0 count := 0
if maxnum, err = this.module.configure.GetChanageChannelMax(); err != nil { if maxnum, err = this.module.configure.GetChanageChannelMax(); err != nil {
return return
@ -188,12 +188,18 @@ func (this *modelChatComp) ChanageChannel(session comm.IUserSession, channel int
//读取跨服聊天频道下成员 //读取跨服聊天频道下成员
func (this *modelChatComp) GetCrossChannelMember(channel int32) (result []*pb.CacheUser, err error) { func (this *modelChatComp) GetCrossChannelMember(channel int32) (result []*pb.CacheUser, err error) {
key := fmt.Sprintf("%s:%d-member", crosschatkey, channel) key := fmt.Sprintf("%s-%d-member", crosschatkey, channel)
result = make([]*pb.CacheUser, 0) temp := make(map[string]*pb.CacheUser, 0)
if err = this.Redis.HGetAll(key, &result); err != nil { if err = this.Redis.HGetAll(key, &temp); err != nil {
this.module.Errorf("err:%v", err) this.module.Errorf("err:%v", err)
return return
} }
n := 0
result = make([]*pb.CacheUser, len(temp))
for _, v := range temp {
result[n] = v
n++
}
return return
} }
@ -207,7 +213,7 @@ func (this *modelChatComp) RemoveCrossChannelMember(session comm.IUserSession) (
return return
} }
key := fmt.Sprintf("%s:%d-member", crosschatkey, result.Chatchannel) key := fmt.Sprintf("%s-%d-member", crosschatkey, result.Chatchannel)
if err = this.Redis.HDel(key, session.GetUserId()); err != nil { if err = this.Redis.HDel(key, session.GetUserId()); err != nil {
this.module.Errorf("err:%v", err) this.module.Errorf("err:%v", err)
return return

View File

@ -22,12 +22,9 @@ func (this *apiComp) StrengthenUpSkillCheck(session comm.IUserSession, req *pb.H
/// 英雄技能升级 /// 英雄技能升级
func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroStrengthenUpSkillReq) (code pb.ErrorCode, data proto.Message) { func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroStrengthenUpSkillReq) (code pb.ErrorCode, data proto.Message) {
var ( var (
tmpUpSkillID map[int32]*pb.SkillData // 即将要升级的技能id
probability map[int32]int32 // 即将升级技能的权重 probability map[int32]int32 // 即将升级技能的权重
upSkillPos int32 // 升级的技能位置 upSkillPos int32 // 升级的技能位置
totalprobability int32 // 所有技能总权重 totalprobability int32 // 所有技能总权重
tmpValue int32 // 临时对象 存放累加权重
tagColor int32 // 目标卡品质
_hero *pb.DBHero // 操作的英雄 _hero *pb.DBHero // 操作的英雄
ChangeList []*pb.DBHero // 推送 改变的英雄 ChangeList []*pb.DBHero // 推送 改变的英雄
@ -39,7 +36,6 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt
mapCostHero = make(map[string]int32, 0) mapCostHero = make(map[string]int32, 0)
mapCostObj = make(map[string]*pb.DBHero, 0) mapCostObj = make(map[string]*pb.DBHero, 0)
ChangeList = make([]*pb.DBHero, 0) ChangeList = make([]*pb.DBHero, 0)
tmpUpSkillID = make(map[int32]*pb.SkillData, 0)
code = this.StrengthenUpSkillCheck(session, req) // check code = this.StrengthenUpSkillCheck(session, req) // check
if code != pb.ErrorCode_Success { if code != pb.ErrorCode_Success {
@ -55,7 +51,7 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt
code = pb.ErrorCode_HeroNoExist code = pb.ErrorCode_HeroNoExist
return return
} }
tagColor = heroCfg.Color
for _, v := range req.CostCardObj { // 数组转 map for _, v := range req.CostCardObj { // 数组转 map
mapCostHero[v]++ mapCostHero[v]++
} }
@ -74,7 +70,7 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt
return return
} }
tmp := this.module.configure.GetHero(costHero.HeroID) // 星级校验 tmp := this.module.configure.GetHero(costHero.HeroID) // 星级校验
if tmp.Color != tagColor { if tmp.Color != heroCfg.Color {
code = pb.ErrorCode_HeroColorErr code = pb.ErrorCode_HeroColorErr
return return
} }
@ -99,33 +95,27 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt
return return
} }
tmpUpSkillID := make(map[int32]bool, 0)
for i := 0; i < int(lvUpCount); i++ { // 升级技能 for i := 0; i < int(lvUpCount); i++ { // 升级技能
config, err1 := this.module.configure.GetHeroSkillUpConfig() probability = make(map[int32]int32, 0)
if err1 != nil { for index, skill := range _hero.NormalSkill {
skillMaxLv := this.module.configure.GetHeroSkillMaxLvConfig(uint32(skill.SkillID))
if skill.SkillLv < skillMaxLv { // 找到没有满级的技能id
tmpUpSkillID[int32(index)] = true
skillData := this.module.configure.GetHeroSkillUpConfig(skill.SkillID)
if skillData == nil {
code = pb.ErrorCode_ConfigNoFound code = pb.ErrorCode_ConfigNoFound
return return
} }
for index, skill := range _hero.NormalSkill { probability[skill.SkillID] = skillData.Probability[skill.SkillLv] // 获取权重
skillMaxLv := this.module.configure.GetHeroSkillMaxLvConfig(uint32(skill.SkillID))
if skill.SkillLv < skillMaxLv { // 找到没有满级的技能id
tmpUpSkillID[int32(index)] = skill
} }
} }
if len(tmpUpSkillID) == 0 { if len(tmpUpSkillID) == 0 {
code = pb.ErrorCode_HeroMaxSkillLv code = pb.ErrorCode_HeroMaxSkillLv
return return
} }
probability = make(map[int32]int32, 0)
// 获取权重
for k, v := range tmpUpSkillID {
for _, v2 := range config.GetDataList() { // 需要优化配置表
if v2.Hid == _hero.HeroID && (k+1) == v2.Skillpos && v.SkillLv == v2.Skilllevel {
probability[k] = v2.Probability // 设置权重
break
}
}
}
totalprobability = 0 totalprobability = 0
// 根据权重升级对应的技能 // 根据权重升级对应的技能
for _, v := range probability { for _, v := range probability {
@ -136,10 +126,10 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt
return return
} }
n, _ := rand.Int(rand.Reader, big.NewInt(int64(totalprobability))) n, _ := rand.Int(rand.Reader, big.NewInt(int64(totalprobability)))
tmpValue = 0 tmp := 0
for k, v := range probability { for k, v := range probability {
tmpValue += v tmp += int(v)
if int32(n.Int64()) < tmpValue { // 找到了 if int32(n.Int64()) < v { // 找到了
upSkillPos = k upSkillPos = k
break break
} }

View File

@ -270,18 +270,13 @@ func (this *configureComp) GetHeroLvgrow(heroId string) *cfg.Game_heroLevelgrowD
} }
// 获取英雄技能升级相关信息 // 获取英雄技能升级相关信息
func (this *configureComp) GetHeroSkillUpConfig() (configure *cfg.Game_heroSkillLevel, err error) { func (this *configureComp) GetHeroSkillUpConfig(skillid int32) (data *cfg.Game_heroSkillLevelData) {
var (
v interface{} if v, err := this.GetConfigure(hero_skillup); err == nil {
ok bool if conf, ok := v.(*cfg.Game_heroSkillLevel); ok {
) data = conf.Get(skillid)
if v, err = this.GetConfigure(hero_skillup); err == nil {
if configure, ok = v.(*cfg.Game_heroSkillLevel); !ok {
err = fmt.Errorf("%T no is *cfg.Game_hero", v)
return return
} }
} else {
err = fmt.Errorf("%T no is *cfg.Game_hero", v)
} }
return return

View File

@ -3,7 +3,6 @@ package mainline
import ( import (
"go_dreamfactory/lego/core" "go_dreamfactory/lego/core"
"go_dreamfactory/lego/core/cbase" "go_dreamfactory/lego/core/cbase"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/sys/configure" "go_dreamfactory/sys/configure"
cfg "go_dreamfactory/sys/configure/structs" cfg "go_dreamfactory/sys/configure/structs"
) )
@ -18,6 +17,7 @@ const (
///配置管理基础组件 ///配置管理基础组件
type configureComp struct { type configureComp struct {
cbase.ModuleCompBase cbase.ModuleCompBase
module *Mainline
} }
//组件初始化接口 //组件初始化接口
@ -29,7 +29,7 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
game_mainlinehard: cfg.NewGame_mainlineHard, game_mainlinehard: cfg.NewGame_mainlineHard,
game_mainlinepurgatory: cfg.NewGame_mainlinePurgatory, game_mainlinepurgatory: cfg.NewGame_mainlinePurgatory,
}) })
this.module = module.(*Mainline)
return return
} }
@ -38,7 +38,7 @@ func (this *configureComp) LoadMultiConfigure(confs map[string]interface{}) (err
for k, v := range confs { for k, v := range confs {
err = configure.RegisterConfigure(k, v) err = configure.RegisterConfigure(k, v)
if err != nil { if err != nil {
log.Errorf("配置文件:%s解析失败!", k) this.module.Errorf("配置文件:%s解析失败!", k)
break break
} }
} }
@ -52,7 +52,7 @@ func (this *configureComp) GetConfigure(name string) (v interface{}, err error)
func (this *configureComp) GetMainlineChapter(id int32) (data *cfg.Game_mainlineChapterData) { func (this *configureComp) GetMainlineChapter(id int32) (data *cfg.Game_mainlineChapterData) {
if v, err := this.GetConfigure(game_mainlinechapter); err != nil { if v, err := this.GetConfigure(game_mainlinechapter); err != nil {
log.Errorf("get global conf err:%v", err) this.module.Errorf("get global conf err:%v", err)
return return
} else { } else {
var ( var (
@ -60,7 +60,7 @@ func (this *configureComp) GetMainlineChapter(id int32) (data *cfg.Game_mainline
ok bool ok bool
) )
if configure, ok = v.(*cfg.Game_mainlineChapter); !ok { if configure, ok = v.(*cfg.Game_mainlineChapter); !ok {
log.Errorf("%T no is *cfg.Game_mainlineChapterData", v) this.module.Errorf("%T no is *cfg.Game_mainlineChapterData", v)
return return
} }
@ -74,7 +74,7 @@ func (this *configureComp) GetMainlineChapter(id int32) (data *cfg.Game_mainline
// 获取简单的关卡配置信息 // 获取简单的关卡配置信息
func (this *configureComp) GetMainlineEasyChapter(id int32) (data *cfg.Game_mainlineEasyData) { func (this *configureComp) GetMainlineEasyChapter(id int32) (data *cfg.Game_mainlineEasyData) {
if v, err := this.GetConfigure(game_mainlineeasy); err != nil { if v, err := this.GetConfigure(game_mainlineeasy); err != nil {
log.Errorf("get global conf err:%v", err) this.module.Errorf("get global conf err:%v", err)
return return
} else { } else {
var ( var (
@ -82,7 +82,7 @@ func (this *configureComp) GetMainlineEasyChapter(id int32) (data *cfg.Game_main
ok bool ok bool
) )
if configure, ok = v.(*cfg.Game_mainlineEasy); !ok { if configure, ok = v.(*cfg.Game_mainlineEasy); !ok {
log.Errorf("%T no is *cfg.Game_mainlineEasyData", v) this.module.Errorf("%T no is *cfg.Game_mainlineEasyData", v)
return return
} }
@ -96,7 +96,7 @@ func (this *configureComp) GetMainlineEasyChapter(id int32) (data *cfg.Game_main
// 获取炼狱级别难度的关卡配置 // 获取炼狱级别难度的关卡配置
func (this *configureComp) GetMainlinePurgatoryChapter(id int32) (data *cfg.Game_mainlinePurgatoryData) { func (this *configureComp) GetMainlinePurgatoryChapter(id int32) (data *cfg.Game_mainlinePurgatoryData) {
if v, err := this.GetConfigure(game_mainlinepurgatory); err != nil { if v, err := this.GetConfigure(game_mainlinepurgatory); err != nil {
log.Errorf("get global conf err:%v", err) this.module.Errorf("get global conf err:%v", err)
return return
} else { } else {
var ( var (
@ -104,7 +104,7 @@ func (this *configureComp) GetMainlinePurgatoryChapter(id int32) (data *cfg.Game
ok bool ok bool
) )
if configure, ok = v.(*cfg.Game_mainlinePurgatory); !ok { if configure, ok = v.(*cfg.Game_mainlinePurgatory); !ok {
log.Errorf("%T no is *cfg.Game_mainlinePurgatoryData", v) this.module.Errorf("%T no is *cfg.Game_mainlinePurgatoryData", v)
return return
} }
@ -118,7 +118,7 @@ func (this *configureComp) GetMainlinePurgatoryChapter(id int32) (data *cfg.Game
// 获取困难的关卡配置 // 获取困难的关卡配置
func (this *configureComp) GetMainlineHardChapter(id int32) (data *cfg.Game_mainlineHardData) { func (this *configureComp) GetMainlineHardChapter(id int32) (data *cfg.Game_mainlineHardData) {
if v, err := this.GetConfigure(game_mainlinehard); err != nil { if v, err := this.GetConfigure(game_mainlinehard); err != nil {
log.Errorf("get global conf err:%v", err) this.module.Errorf("get global conf err:%v", err)
return return
} else { } else {
var ( var (
@ -126,7 +126,7 @@ func (this *configureComp) GetMainlineHardChapter(id int32) (data *cfg.Game_main
ok bool ok bool
) )
if configure, ok = v.(*cfg.Game_mainlineHard); !ok { if configure, ok = v.(*cfg.Game_mainlineHard); !ok {
log.Errorf("%T no is *cfg.Game_mainlineHardData", v) this.module.Errorf("%T no is *cfg.Game_mainlineHardData", v)
return return
} }

View File

@ -111,30 +111,30 @@ func (this *ModuleBase) SendMsgToUser(mainType, subType string, msg proto.Messag
func (this *ModuleBase) SendMsgToUsers(mainType, subType string, msg proto.Message, user ...*pb.CacheUser) (err error) { func (this *ModuleBase) SendMsgToUsers(mainType, subType string, msg proto.Message, user ...*pb.CacheUser) (err error) {
var ( var (
gateways map[string]map[string][]string = make(map[string]map[string][]string) gateways map[string]map[string][]string = make(map[string]map[string][]string)
cluster map[string][]string cluster map[string][]string = make(map[string][]string)
gateway []string gateway []string
ok bool ok bool
) )
for _, v := range user { for _, v := range user {
if cluster, ok = gateways[v.ServiceTag]; !ok { if cluster, ok = gateways[v.ServiceTag]; !ok {
gateways[v.ServiceTag] = make(map[string][]string) cluster = make(map[string][]string)
gateways[v.ServiceTag] = cluster
} }
if gateway, ok = cluster[v.GatewayServiceId]; !ok { if gateway, ok = cluster[v.GatewayServiceId]; !ok {
gateway = make([]string, 0) gateway = make([]string, 0)
cluster[v.GatewayServiceId] = gateway cluster[v.GatewayServiceId] = gateway
} }
gateway = append(gateway, v.SessionId) cluster[v.GatewayServiceId] = append(cluster[v.GatewayServiceId], v.SessionId)
} }
reply := &pb.RPCMessageReply{}
data, _ := anypb.New(msg) data, _ := anypb.New(msg)
for k, v := range gateways { for k, v := range gateways {
for k1, v1 := range v { for k1, v1 := range v {
if _, err = this.service.AcrossClusterRpcGo(context.Background(), k1, fmt.Sprintf("%s/%s", comm.Service_Gateway, k), string(comm.Rpc_GatewayAgentSendMsg), &pb.BatchMessageReq{ if _, err = this.service.AcrossClusterRpcGo(context.Background(), k, fmt.Sprintf("%s/%s", comm.Service_Gateway, k1), string(comm.Rpc_GatewaySendBatchMsg), &pb.BatchMessageReq{
UserSessionIds: v1, UserSessionIds: v1,
MainType: mainType, MainType: mainType,
SubType: subType, SubType: subType,
Data: data, Data: data,
}, reply); err != nil { }, nil); err != nil {
log.Errorf("SendMsgToUsers:%s.%s->%s.%s err:%v", k1, k, mainType, subType, err) log.Errorf("SendMsgToUsers:%s.%s->%s.%s err:%v", k1, k, mainType, subType, err)
} }
} }

View File

@ -33,7 +33,7 @@ func (this *Options) LoadConfig(settings map[string]interface{}) (err error) {
err = mapstructure.Decode(settings, this) err = mapstructure.Decode(settings, this)
} }
if this.Log = log.NewTurnlog(this.Debug, log.Clone("", 3)); this.Log == nil { if this.Log = log.NewTurnlog(this.Debug, log.Clone("", 4)); this.Log == nil {
err = errors.New("log is nil") err = errors.New("log is nil")
} }
return return

View File

@ -2,7 +2,6 @@ package task
import ( import (
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/pb" "go_dreamfactory/pb"
"google.golang.org/protobuf/proto" "google.golang.org/protobuf/proto"
@ -72,7 +71,7 @@ func (this *apiComp) ActiveReceive(session comm.IUserSession, req *pb.TaskActive
ua.Id, ua.Id,
comm.TaskTag(req.TaskTag), comm.TaskTag(req.TaskTag),
update); err != nil { update); err != nil {
log.Errorf("updateReceive err %v", err) this.moduleTask.Errorf("updateReceive err %v", err)
code = pb.ErrorCode_DBError code = pb.ErrorCode_DBError
return return
} }

View File

@ -3,7 +3,6 @@ package task
import ( import (
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/lego/core" "go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/modules" "go_dreamfactory/modules"
"go_dreamfactory/pb" "go_dreamfactory/pb"
@ -35,7 +34,7 @@ func (this *ModelTaskActive) initActiveReward(uid string) {
RId: conf.Key, RId: conf.Key,
} }
if err := this.moduleTask.modelTaskActive.AddList(uid, ta.Id, ta); err != nil { if err := this.moduleTask.modelTaskActive.AddList(uid, ta.Id, ta); err != nil {
log.Errorf("uid:%v tag:%v initActiv add err %v", uid, err) this.moduleTask.Errorf("uid:%v tag:%v initActiv add err %v", uid, err)
return return
} }
} }
@ -45,7 +44,7 @@ func (this *ModelTaskActive) initActiveReward(uid string) {
func (this *ModelTaskActive) getActiveListByTag(uid string, taskTag comm.TaskTag) (list []*pb.DBTaskActive) { func (this *ModelTaskActive) getActiveListByTag(uid string, taskTag comm.TaskTag) (list []*pb.DBTaskActive) {
al := []*pb.DBTaskActive{} al := []*pb.DBTaskActive{}
if err := this.GetList(uid, &al); err != nil { if err := this.GetList(uid, &al); err != nil {
log.Errorf("getUserActiveList err:%v", err) this.moduleTask.Errorf("getUserActiveList err:%v", err)
return al return al
} }
@ -79,13 +78,13 @@ func (this *ModelTaskActive) updateReceive(uid, id string, taskTag comm.TaskTag,
//清空任务 //清空任务
func (this *ModelTaskActive) clearTask(uid string, taskTag ...comm.TaskTag) { func (this *ModelTaskActive) clearTask(uid string, taskTag ...comm.TaskTag) {
if len(taskTag) == 0 { if len(taskTag) == 0 {
log.Errorf("least one param for taskTag") this.moduleTask.Errorf("least one param for taskTag")
return return
} }
data := this.getActiveListByTag(uid, taskTag[0]) data := this.getActiveListByTag(uid, taskTag[0])
for _, v := range data { for _, v := range data {
if err := this.moduleTask.modelTaskActive.DelListlds(uid, v.Id); err != nil { if err := this.moduleTask.modelTaskActive.DelListlds(uid, v.Id); err != nil {
log.Errorf("uid: %v err:%v", uid, err) this.moduleTask.Errorf("uid: %v err:%v", uid, err)
return return
} }
} }

View File

@ -27,7 +27,7 @@ func (this *ModelTask) Init(service core.IService, module core.IModule, comp cor
func (this *ModelTask) getTaskListByTag(uid string, taskTag comm.TaskTag) (newlist []*pb.DBTask) { func (this *ModelTask) getTaskListByTag(uid string, taskTag comm.TaskTag) (newlist []*pb.DBTask) {
list := []*pb.DBTask{} list := []*pb.DBTask{}
if err := this.GetList(uid, &list); err != nil { if err := this.GetList(uid, &list); err != nil {
log.Errorf("getTaskList err %v", err) this.moduleTask.Errorf("getTaskList err %v", err)
return return
} }
@ -96,7 +96,7 @@ func (this *ModelTask) getTaskListByTag(uid string, taskTag comm.TaskTag) (newli
func (this *ModelTask) getTaskById(uid string, taskId int32) (newlist []*pb.DBTask) { func (this *ModelTask) getTaskById(uid string, taskId int32) (newlist []*pb.DBTask) {
list := []*pb.DBTask{} list := []*pb.DBTask{}
if err := this.GetList(uid, &list); err != nil { if err := this.GetList(uid, &list); err != nil {
log.Errorf("getTaskById err %v", err) this.moduleTask.Errorf("getTaskById err %v", err)
return return
} }
@ -124,7 +124,7 @@ func (this *ModelTask) initTask(uid string) error {
Sort: cnf.IdList, Sort: cnf.IdList,
} }
if err := this.AddList(uid, task.Id, task); err != nil { if err := this.AddList(uid, task.Id, task); err != nil {
log.Errorf("initTask addlists err %v", err) this.moduleTask.Errorf("initTask addlists err %v", err)
return err return err
} }
} }
@ -136,7 +136,7 @@ func (this *ModelTask) initTask(uid string) error {
func (this *ModelTask) getUserTask(uid string, taskId string) *pb.DBTask { func (this *ModelTask) getUserTask(uid string, taskId string) *pb.DBTask {
userTask := &pb.DBTask{} userTask := &pb.DBTask{}
if err := this.moduleTask.modelTask.GetListObj(uid, taskId, userTask); err != nil { if err := this.moduleTask.modelTask.GetListObj(uid, taskId, userTask); err != nil {
log.Errorf("getUserTask err:%v", err) this.moduleTask.Errorf("getUserTask err:%v", err)
return nil return nil
} }
return userTask return userTask
@ -167,7 +167,7 @@ func (this *ModelTask) checkTask(uid string, taskId int32) (*pb.DBTask, bool) {
//更改用户任务 //更改用户任务
func (this *ModelTask) modifyUserTask(uid string, taskId string, data map[string]interface{}) error { func (this *ModelTask) modifyUserTask(uid string, taskId string, data map[string]interface{}) error {
if err := this.ChangeList(uid, taskId, data); err != nil { if err := this.ChangeList(uid, taskId, data); err != nil {
log.Errorf("err %v", err) this.moduleTask.Errorf("err %v", err)
return err return err
} }
return nil return nil
@ -176,13 +176,13 @@ func (this *ModelTask) modifyUserTask(uid string, taskId string, data map[string
//清空任务 //清空任务
func (this *ModelTask) clearTask(uid string, taskTag ...comm.TaskTag) { func (this *ModelTask) clearTask(uid string, taskTag ...comm.TaskTag) {
if len(taskTag) == 0 { if len(taskTag) == 0 {
log.Errorf("least one param for taskTag") this.moduleTask.Errorf("least one param for taskTag")
return return
} }
taskList := this.getTaskListByTag(uid, taskTag[0]) taskList := this.getTaskListByTag(uid, taskTag[0])
for _, v := range taskList { for _, v := range taskList {
if err := this.moduleTask.modelTask.DelListlds(uid, v.Id); err != nil { if err := this.moduleTask.modelTask.DelListlds(uid, v.Id); err != nil {
log.Errorf("uid: %v err:%v", uid, err) this.moduleTask.Errorf("uid: %v err:%v", uid, err)
return return
} }
} }
@ -260,7 +260,7 @@ func (this *ModelTask) UpHeroLevel(uid string, taskId int32, tp *pb.TaskParam) *
"progress": progress, "progress": progress,
} }
if err := this.modifyUserTask(task.Uid, task.Id, update); err != nil { if err := this.modifyUserTask(task.Uid, task.Id, update); err != nil {
log.Errorf("err %v", err) this.moduleTask.Errorf("err %v", err)
return nil return nil
} }
task.Progress = progress task.Progress = progress
@ -274,7 +274,7 @@ func (this *ModelTask) UpHeroLevel(uid string, taskId int32, tp *pb.TaskParam) *
func (this *ModelTask) doTaskHandle(uid string, taskType comm.TaskType, taskParam *pb.TaskParam) (tasks []*pb.DBTask, err error) { func (this *ModelTask) doTaskHandle(uid string, taskType comm.TaskType, taskParam *pb.TaskParam) (tasks []*pb.DBTask, err error) {
data, err := this.moduleTask.configure.getTasks(int32(taskType)) data, err := this.moduleTask.configure.getTasks(int32(taskType))
if err != nil { if err != nil {
log.Errorf("taskHandle err %v", err) this.moduleTask.Errorf("taskHandle err %v", err)
return nil, err return nil, err
} }

View File

@ -3,7 +3,6 @@ package user
import ( import (
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/lego/core" "go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/lego/sys/redis" "go_dreamfactory/lego/sys/redis"
"go_dreamfactory/modules" "go_dreamfactory/modules"
"go_dreamfactory/pb" "go_dreamfactory/pb"
@ -26,7 +25,7 @@ func (this *ModelExpand) Init(service core.IService, module core.IModule, comp c
func (this *ModelExpand) getUserSession(uid string) (cuser *pb.CacheUser) { func (this *ModelExpand) getUserSession(uid string) (cuser *pb.CacheUser) {
cuser = &pb.CacheUser{} cuser = &pb.CacheUser{}
if err := this.Get(uid, cuser); err != nil { if err := this.Get(uid, cuser); err != nil {
log.Errorf("GetUserSession err:%v", err) this.moduleUser.Errorf("GetUserSession err:%v", err)
return return
} }
return return

View File

@ -3,18 +3,19 @@ package user
import ( import (
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/lego/core" "go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/modules" "go_dreamfactory/modules"
"go_dreamfactory/pb" "go_dreamfactory/pb"
) )
type ModelSession struct { type ModelSession struct {
modules.MCompModel modules.MCompModel
module *User
} }
func (this *ModelSession) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { func (this *ModelSession) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
this.TableName = comm.TableSession this.TableName = comm.TableSession
err = this.MCompModel.Init(service, module, comp, options) err = this.MCompModel.Init(service, module, comp, options)
this.module = module.(*User)
return return
} }
@ -22,7 +23,7 @@ func (this *ModelSession) Init(service core.IService, module core.IModule, comp
func (this *ModelSession) getUserSession(uid string) (cuser *pb.CacheUser) { func (this *ModelSession) getUserSession(uid string) (cuser *pb.CacheUser) {
cuser = &pb.CacheUser{} cuser = &pb.CacheUser{}
if err := this.Get(uid, cuser); err != nil { if err := this.Get(uid, cuser); err != nil {
log.Errorf("GetUserSession err:%v", err) this.module.Errorf("GetUserSession err:%v", err)
return return
} }
return return

View File

@ -72,7 +72,7 @@ func (this *ModelUser) User_Create(user *pb.DBUser) (err error) {
func (this *ModelUser) GetUser(uid string) (user *pb.DBUser) { func (this *ModelUser) GetUser(uid string) (user *pb.DBUser) {
user = &pb.DBUser{} user = &pb.DBUser{}
if err := this.Get(uid, user); err != nil { if err := this.Get(uid, user); err != nil {
log.Errorf("getUser err:%v", err) this.moduleUser.Errorf("getUser err:%v", err)
return return
} }
return return
@ -87,7 +87,7 @@ func (this *ModelUser) updateUserAttr(uid string, data map[string]interface{}) e
func (this *ModelUser) isLoginFirst(timestamp int64) bool { func (this *ModelUser) isLoginFirst(timestamp int64) bool {
now := time.Now() now := time.Now()
if timestamp == 0 || timestamp > now.Unix() { if timestamp == 0 || timestamp > now.Unix() {
log.Debugf("lastlogin time great now") this.moduleUser.Debugf("lastlogin time great now")
return false return false
} }
tt := time.Unix(timestamp, 0) tt := time.Unix(timestamp, 0)

View File

@ -8,7 +8,6 @@ import (
"go_dreamfactory/lego/core" "go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/event" "go_dreamfactory/lego/sys/event"
"go_dreamfactory/lego/sys/log"
) )
func NewModule() core.IModule { func NewModule() core.IModule {
@ -97,7 +96,7 @@ func (this *User) QueryAttributeValue(uid string, attr string) (value int32) {
//用户资源 //用户资源
func (this *User) AddAttributeValue(session comm.IUserSession, attr string, add int32, bPush bool) (code pb.ErrorCode) { func (this *User) AddAttributeValue(session comm.IUserSession, attr string, add int32, bPush bool) (code pb.ErrorCode) {
if add == 0 { if add == 0 {
log.Errorf("attr no changed,uid: %s attr: %s add: %d", session.GetUserId(), attr, add) this.Errorf("attr no changed,uid: %s attr: %s add: %d", session.GetUserId(), attr, add)
return return
} }
user := this.GetUser(session.GetUserId()) user := this.GetUser(session.GetUserId())
@ -147,11 +146,11 @@ func (this *User) AddAttributeValue(session comm.IUserSession, attr string, add
} }
if len(update) == 0 { if len(update) == 0 {
log.Warn("AddAttributeValue param is empty") this.Warn("AddAttributeValue param is empty")
return return
} }
if err := this.modelUser.updateUserAttr(session.GetUserId(), update); err != nil { if err := this.modelUser.updateUserAttr(session.GetUserId(), update); err != nil {
log.Errorf("AddAttributeValue err:%v", err) this.Errorf("AddAttributeValue err:%v", err)
code = pb.ErrorCode_DBError code = pb.ErrorCode_DBError
} }
@ -178,7 +177,7 @@ func (this *User) AddAttributeValues(session comm.IUserSession, attrs map[string
update := make(map[string]interface{}) update := make(map[string]interface{})
for key, add := range attrs { for key, add := range attrs {
if add == 0 { if add == 0 {
log.Errorf("attr no changed,uid: %s attr: %s add: %d", session.GetUserId(), key, add) this.Errorf("attr no changed,uid: %s attr: %s add: %d", session.GetUserId(), key, add)
continue continue
} }
switch key { switch key {
@ -215,11 +214,11 @@ func (this *User) AddAttributeValues(session comm.IUserSession, attrs map[string
} }
if len(update) == 0 { if len(update) == 0 {
log.Warn("AddAttributeValue param is empty") this.Warn("AddAttributeValue param is empty")
return return
} }
if err := this.modelUser.updateUserAttr(session.GetUserId(), update); err != nil { if err := this.modelUser.updateUserAttr(session.GetUserId(), update); err != nil {
log.Errorf("AddAttributeValue err:%v", err) this.Errorf("AddAttributeValue err:%v", err)
code = pb.ErrorCode_DBError code = pb.ErrorCode_DBError
} }

View File

@ -3,7 +3,6 @@ package web
import ( import (
"go_dreamfactory/lego/sys/gin" "go_dreamfactory/lego/sys/gin"
"go_dreamfactory/lego/sys/gin/engine" "go_dreamfactory/lego/sys/gin/engine"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/pb" "go_dreamfactory/pb"
"net/http" "net/http"
) )
@ -25,7 +24,7 @@ func (this *Api_Comp) CreateNotify(c *engine.Context) {
) )
defer c.JSON(http.StatusOK, &Respond{Code: code, Message: msg, Data: data}) defer c.JSON(http.StatusOK, &Respond{Code: code, Message: msg, Data: data})
if sign := gin.ParamSign(this.options.Key, map[string]interface{}{"Title": req.Title, "Ctime": req.Ctime, "Rtime": req.Rtime}); sign != req.Sign { if sign := gin.ParamSign(this.options.Key, map[string]interface{}{"Title": req.Title, "Ctime": req.Ctime, "Rtime": req.Rtime}); sign != req.Sign {
log.Errorf("LoginByCaptchaReq SignError sgin:%s", sign) this.module.Errorf("LoginByCaptchaReq SignError sgin:%s", sign)
code = pb.ErrorCode_SignError code = pb.ErrorCode_SignError
msg = pb.GetErrorCodeMsg(code) msg = pb.GetErrorCodeMsg(code)
return return
@ -36,7 +35,7 @@ func (this *Api_Comp) CreateNotify(c *engine.Context) {
return return
} }
if err = this.module.modelNotify.CreateSystemNotify(&req.DBSystemNotify); err != nil { if err = this.module.modelNotify.CreateSystemNotify(&req.DBSystemNotify); err != nil {
log.Errorf("LoginByCaptchaReq CreateSystemNotify err:%v", err) this.module.Errorf("LoginByCaptchaReq CreateSystemNotify err:%v", err)
code = pb.ErrorCode_DBError code = pb.ErrorCode_DBError
msg = pb.GetErrorCodeMsg(code) msg = pb.GetErrorCodeMsg(code)
return return

View File

@ -3,7 +3,6 @@ package web
import ( import (
"go_dreamfactory/lego/sys/gin" "go_dreamfactory/lego/sys/gin"
"go_dreamfactory/lego/sys/gin/engine" "go_dreamfactory/lego/sys/gin/engine"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/pb" "go_dreamfactory/pb"
"net/http" "net/http"
) )
@ -34,7 +33,7 @@ func (this *Api_Comp) CreateMail(c *engine.Context) {
"Reward": req.Reward, "Reward": req.Reward,
"Items": req.Items, "Items": req.Items,
}); sign != req.Sign { }); sign != req.Sign {
log.Errorf("LoginByCaptchaReq SignError sgin:%s", sign) this.module.Errorf("LoginByCaptchaReq SignError sgin:%s", sign)
code = pb.ErrorCode_SignError code = pb.ErrorCode_SignError
msg = pb.GetErrorCodeMsg(code) msg = pb.GetErrorCodeMsg(code)
return return
@ -45,7 +44,7 @@ func (this *Api_Comp) CreateMail(c *engine.Context) {
return return
} }
if err = this.module.modelMail.CreateGMMail(&req.DBMailData); err != nil { if err = this.module.modelMail.CreateGMMail(&req.DBMailData); err != nil {
log.Errorf("LoginByCaptchaReq CreateMail err:%v", err) this.module.Errorf("LoginByCaptchaReq CreateMail err:%v", err)
code = pb.ErrorCode_DBError code = pb.ErrorCode_DBError
msg = pb.GetErrorCodeMsg(code) msg = pb.GetErrorCodeMsg(code)
return return

View File

@ -2,7 +2,6 @@ package web
import ( import (
"go_dreamfactory/lego/sys/gin/engine" "go_dreamfactory/lego/sys/gin/engine"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/pb" "go_dreamfactory/pb"
"net/http" "net/http"
) )
@ -19,7 +18,7 @@ func (this *Api_Comp) Register(c *engine.Context) {
Sid: req.Sid, Sid: req.Sid,
}) })
if err != nil { if err != nil {
log.Errorf("create user err: %v", err) this.module.Errorf("create user err: %v", err)
rsp.Code = pb.ErrorCode_SqlExecutionError rsp.Code = pb.ErrorCode_SqlExecutionError
} }
rsp.Account = req.Account rsp.Account = req.Account

View File

@ -3,7 +3,6 @@ package web
import ( import (
"errors" "errors"
"go_dreamfactory/lego/core" "go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/modules" "go_dreamfactory/modules"
"go_dreamfactory/pb" "go_dreamfactory/pb"
@ -30,7 +29,7 @@ func (this *modelMailComp) CreateGMMail(mail *pb.DBMailData) (err error) {
} }
mail.ObjId = primitive.NewObjectID().Hex() mail.ObjId = primitive.NewObjectID().Hex()
if _, err = this.DB.InsertOne(core.SqlTable(this.TableName), mail); err != nil { if _, err = this.DB.InsertOne(core.SqlTable(this.TableName), mail); err != nil {
log.Errorf("CreateGMMail err:%v", err) this.module.Errorln(err)
return return
} }
return return

View File

@ -2,7 +2,6 @@ package web
import ( import (
"go_dreamfactory/lego/core" "go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/modules" "go_dreamfactory/modules"
"go_dreamfactory/pb" "go_dreamfactory/pb"
@ -26,11 +25,11 @@ func (this *modelNotifyComp) Init(service core.IService, module core.IModule, co
func (this *modelNotifyComp) CreateSystemNotify(notify *pb.DBSystemNotify) (err error) { func (this *modelNotifyComp) CreateSystemNotify(notify *pb.DBSystemNotify) (err error) {
notify.Id = primitive.NewObjectID().Hex() notify.Id = primitive.NewObjectID().Hex()
if _, err = this.DB.InsertOne(core.SqlTable(this.TableName), notify); err != nil { if _, err = this.DB.InsertOne(core.SqlTable(this.TableName), notify); err != nil {
log.Errorf("CreateSystemNotify err:%v", err) this.module.Errorf("CreateSystemNotify err:%v", err)
return return
} }
if err = this.Redis.HSet(this.TableName, notify.Id, notify); err != nil { if err = this.Redis.HSet(this.TableName, notify.Id, notify); err != nil {
log.Errorf("CreateSystemNotify err:%v", err) this.module.Errorf("CreateSystemNotify err:%v", err)
return return
} }
return return

View File

@ -29,7 +29,7 @@ func (this *modelUserComp) User_Create(user *pb.DBUser) (err error) {
now := time.Now().Unix() now := time.Now().Unix()
_id := primitive.NewObjectID().Hex() _id := primitive.NewObjectID().Hex()
user.Id = _id user.Id = _id
user.Uid = fmt.Sprintf("%d_%s", user.Sid, _id) user.Uid = fmt.Sprintf("%s_%s", user.Sid, _id)
user.Uuid = uuid.NewV4().String() user.Uuid = uuid.NewV4().String()
user.Lv = 1 //初始等级 user.Lv = 1 //初始等级
user.Ctime = now user.Ctime = now

View File

@ -1,11 +1,11 @@
package web package web
import ( import (
"fmt"
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/lego/core" "go_dreamfactory/lego/core"
"go_dreamfactory/lego/core/cbase" "go_dreamfactory/lego/core/cbase"
"go_dreamfactory/lego/sys/log"
) )
/* /*
@ -54,33 +54,69 @@ func (this *Web) OnInstallComp() {
} }
//日志 //日志
func (this *Web) Debugf(format string, a ...interface{}) { //日志接口
if this.options.GetDebug() { func (this *Web) Debug(msg string, args ...log.Field) {
this.options.GetLog().Debugf(fmt.Sprintf("[Module:%s] ", this.GetType())+format, a...) this.options.GetLog().Debug(msg, args...)
} }
func (this *Web) Info(msg string, args ...log.Field) {
this.options.GetLog().Info(msg, args...)
} }
func (this *Web) Infof(format string, a ...interface{}) { func (this *Web) Print(msg string, args ...log.Field) {
if this.options.GetDebug() { this.options.GetLog().Print(msg, args...)
this.options.GetLog().Infof(fmt.Sprintf("[Module:%s] ", this.GetType())+format, a...)
} }
func (this *Web) Warn(msg string, args ...log.Field) {
this.options.GetLog().Warn(msg, args...)
} }
func (this *Web) Warnf(format string, a ...interface{}) { func (this *Web) Error(msg string, args ...log.Field) {
if this.options.Debug { this.options.GetLog().Error(msg, args...)
this.options.GetLog().Warnf(fmt.Sprintf("[Module:%s] ", this.GetType())+format, a...)
} }
func (this *Web) Panic(msg string, args ...log.Field) {
this.options.GetLog().Panic(msg, args...)
} }
func (this *Web) Errorf(format string, a ...interface{}) { func (this *Web) Fatal(msg string, args ...log.Field) {
if this.options.GetLog() != nil { this.options.GetLog().Fatal(msg, args...)
this.options.GetLog().Errorf(fmt.Sprintf("[Module:%s] ", this.GetType())+format, a...)
} }
func (this *Web) Debugf(format string, args ...interface{}) {
this.options.GetLog().Debugf(format, args...)
} }
func (this *Web) Panicf(format string, a ...interface{}) { func (this *Web) Infof(format string, args ...interface{}) {
if this.options.GetLog() != nil { this.options.GetLog().Infof(format, args...)
this.options.GetLog().Panicf(fmt.Sprintf("[Module:%s] ", this.GetType())+format, a...)
} }
func (this *Web) Printf(format string, args ...interface{}) {
this.options.GetLog().Printf(format, args...)
} }
func (this *Web) Fatalf(format string, a ...interface{}) { func (this *Web) Warnf(format string, args ...interface{}) {
if this.options.GetLog() != nil { this.options.GetLog().Warnf(format, args...)
this.options.GetLog().Fatalf(fmt.Sprintf("[Module:%s] ", this.GetType())+format, a...)
} }
func (this *Web) Errorf(format string, args ...interface{}) {
this.options.GetLog().Errorf(format, args...)
}
func (this *Web) Fatalf(format string, args ...interface{}) {
this.options.GetLog().Fatalf(format, args...)
}
func (this *Web) Panicf(format string, args ...interface{}) {
this.options.GetLog().Panicf(format, args...)
}
func (this *Web) Debugln(args ...interface{}) {
this.options.GetLog().Debugln(args...)
}
func (this *Web) Infoln(args ...interface{}) {
this.options.GetLog().Infoln(args...)
}
func (this *Web) Println(args ...interface{}) {
this.options.GetLog().Println(args...)
}
func (this *Web) Warnln(args ...interface{}) {
this.options.GetLog().Warnln(args...)
}
func (this *Web) Errorln(args ...interface{}) {
this.options.GetLog().Errorln(args...)
}
func (this *Web) Fatalln(args ...interface{}) {
this.options.GetLog().Fatalln(args...)
}
func (this *Web) Panicln(args ...interface{}) {
this.options.GetLog().Panicln(args...)
} }

View File

@ -83,7 +83,8 @@ type DBChat struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id"` //主键id Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id"` //主键id
Channel ChatChannel `protobuf:"varint,2,opt,name=channel,proto3,enum=ChatChannel" json:"channel"` //频道 Channel ChatChannel `protobuf:"varint,2,opt,name=channel,proto3,enum=ChatChannel" json:"channel"` //频道
Suid string `protobuf:"bytes,3,opt,name=suid,proto3" json:"suid"` //发送用户id Suid string `protobuf:"bytes,3,opt,name=suid,proto3" json:"suid"` //发送用户id
Ruid string `protobuf:"bytes,4,opt,name=ruid,proto3" json:"ruid"` //接收用户id channel == Private 有效 Slv int32 `protobuf:"varint,4,opt,name=slv,proto3" json:"slv"` //发送者等级
Ruid string `protobuf:"bytes,5,opt,name=ruid,proto3" json:"ruid"` //接收用户id channel == Private 有效
ChannelId int32 `protobuf:"varint,6,opt,name=channelId,proto3" json:"channelId"` //跨服频道 频道Id ChannelId int32 `protobuf:"varint,6,opt,name=channelId,proto3" json:"channelId"` //跨服频道 频道Id
UnionId string `protobuf:"bytes,7,opt,name=unionId,proto3" json:"unionId"` //工会id UnionId string `protobuf:"bytes,7,opt,name=unionId,proto3" json:"unionId"` //工会id
Stag string `protobuf:"bytes,8,opt,name=stag,proto3" json:"stag"` //区服id Stag string `protobuf:"bytes,8,opt,name=stag,proto3" json:"stag"` //区服id
@ -146,6 +147,13 @@ func (x *DBChat) GetSuid() string {
return "" return ""
} }
func (x *DBChat) GetSlv() int32 {
if x != nil {
return x.Slv
}
return 0
}
func (x *DBChat) GetRuid() string { func (x *DBChat) GetRuid() string {
if x != nil { if x != nil {
return x.Ruid return x.Ruid
@ -206,30 +214,31 @@ var File_chat_chat_db_proto protoreflect.FileDescriptor
var file_chat_chat_db_proto_rawDesc = []byte{ var file_chat_chat_db_proto_rawDesc = []byte{
0x0a, 0x12, 0x63, 0x68, 0x61, 0x74, 0x2f, 0x63, 0x68, 0x61, 0x74, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x0a, 0x12, 0x63, 0x68, 0x61, 0x74, 0x2f, 0x63, 0x68, 0x61, 0x74, 0x5f, 0x64, 0x62, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x22, 0x92, 0x02, 0x0a, 0x06, 0x44, 0x42, 0x43, 0x68, 0x61, 0x74, 0x12, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa4, 0x02, 0x0a, 0x06, 0x44, 0x42, 0x43, 0x68, 0x61, 0x74, 0x12,
0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12,
0x26, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x26, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e,
0x32, 0x0c, 0x2e, 0x43, 0x68, 0x61, 0x74, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x07, 0x32, 0x0c, 0x2e, 0x43, 0x68, 0x61, 0x74, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x07,
0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x75, 0x69, 0x64, 0x18, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x75, 0x69, 0x64, 0x18,
0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x73, 0x75, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x73, 0x75, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x73,
0x75, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x75, 0x69, 0x64, 0x12, 0x6c, 0x76, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x73, 0x6c, 0x76, 0x12, 0x12, 0x0a,
0x1c, 0x0a, 0x09, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x18, 0x06, 0x20, 0x01, 0x04, 0x72, 0x75, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x75, 0x69,
0x28, 0x05, 0x52, 0x09, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x18, 0x06,
0x07, 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x12,
0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x74, 0x61, 0x67, 0x18, 0x18, 0x0a, 0x07, 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09,
0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x73, 0x74, 0x61, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x52, 0x07, 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x74, 0x61,
0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x76, 0x61, 0x67, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x73, 0x74, 0x61, 0x67, 0x12, 0x16, 0x0a,
0x74, 0x61, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61,
0x28, 0x09, 0x52, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0a,
0x74, 0x65, 0x6e, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63,
0x65, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f,
0x28, 0x03, 0x52, 0x05, 0x63, 0x74, 0x69, 0x6d, 0x65, 0x2a, 0x4d, 0x0a, 0x0b, 0x43, 0x68, 0x61, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x0c,
0x74, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x09, 0x0a, 0x05, 0x57, 0x6f, 0x72, 0x6c, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x74, 0x69, 0x6d, 0x65, 0x2a, 0x4d, 0x0a, 0x0b, 0x43,
0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x10, 0x01, 0x12, 0x0b, 0x68, 0x61, 0x74, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x09, 0x0a, 0x05, 0x57, 0x6f,
0x0a, 0x07, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x43, 0x72, 0x6c, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x10, 0x01,
0x72, 0x6f, 0x73, 0x73, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x10, 0x02, 0x12, 0x0f, 0x0a,
0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x10, 0x04, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x0b, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x10, 0x03, 0x12, 0x0a,
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x0a, 0x06, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x10, 0x04, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b,
0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (

View File

@ -371,9 +371,10 @@ type ChatSendReq struct {
Avatar string `protobuf:"bytes,1,opt,name=avatar,proto3" json:"avatar"` //用户头像 Avatar string `protobuf:"bytes,1,opt,name=avatar,proto3" json:"avatar"` //用户头像
Uname string `protobuf:"bytes,2,opt,name=uname,proto3" json:"uname"` //用户名 Uname string `protobuf:"bytes,2,opt,name=uname,proto3" json:"uname"` //用户名
Channel ChatChannel `protobuf:"varint,3,opt,name=channel,proto3,enum=ChatChannel" json:"channel"` //频道 Ulv int32 `protobuf:"varint,3,opt,name=ulv,proto3" json:"ulv"` //用户等级
TargetId string `protobuf:"bytes,4,opt,name=targetId,proto3" json:"targetId"` //目标用户id Channel ChatChannel `protobuf:"varint,4,opt,name=channel,proto3,enum=ChatChannel" json:"channel"` //频道
Content string `protobuf:"bytes,5,opt,name=content,proto3" json:"content"` //内容 TargetId string `protobuf:"bytes,5,opt,name=targetId,proto3" json:"targetId"` //目标用户id
Content string `protobuf:"bytes,6,opt,name=content,proto3" json:"content"` //内容
} }
func (x *ChatSendReq) Reset() { func (x *ChatSendReq) Reset() {
@ -422,6 +423,13 @@ func (x *ChatSendReq) GetUname() string {
return "" return ""
} }
func (x *ChatSendReq) GetUlv() int32 {
if x != nil {
return x.Ulv
}
return 0
}
func (x *ChatSendReq) GetChannel() ChatChannel { func (x *ChatSendReq) GetChannel() ChatChannel {
if x != nil { if x != nil {
return x.Channel return x.Channel
@ -448,6 +456,8 @@ type ChatSendResp struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Issucc bool `protobuf:"varint,1,opt,name=issucc,proto3" json:"issucc"` //是否成功
} }
func (x *ChatSendResp) Reset() { func (x *ChatSendResp) Reset() {
@ -482,6 +492,13 @@ func (*ChatSendResp) Descriptor() ([]byte, []int) {
return file_chat_chat_msg_proto_rawDescGZIP(), []int{8} return file_chat_chat_msg_proto_rawDescGZIP(), []int{8}
} }
func (x *ChatSendResp) GetIssucc() bool {
if x != nil {
return x.Issucc
}
return false
}
var File_chat_chat_msg_proto protoreflect.FileDescriptor var File_chat_chat_msg_proto protoreflect.FileDescriptor
var file_chat_chat_msg_proto_rawDesc = []byte{ var file_chat_chat_msg_proto_rawDesc = []byte{
@ -512,19 +529,21 @@ var file_chat_chat_msg_proto_rawDesc = []byte{
0x6e, 0x65, 0x6c, 0x49, 0x64, 0x22, 0x30, 0x0a, 0x0f, 0x43, 0x68, 0x61, 0x74, 0x47, 0x65, 0x74, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x22, 0x30, 0x0a, 0x0f, 0x43, 0x68, 0x61, 0x74, 0x47, 0x65, 0x74,
0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x05, 0x63, 0x68, 0x61, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x05, 0x63, 0x68, 0x61, 0x74,
0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x44, 0x42, 0x43, 0x68, 0x61, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x44, 0x42, 0x43, 0x68, 0x61, 0x74,
0x52, 0x05, 0x63, 0x68, 0x61, 0x74, 0x73, 0x22, 0x99, 0x01, 0x0a, 0x0b, 0x43, 0x68, 0x61, 0x74, 0x52, 0x05, 0x63, 0x68, 0x61, 0x74, 0x73, 0x22, 0xab, 0x01, 0x0a, 0x0b, 0x43, 0x68, 0x61, 0x74,
0x53, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x53, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61,
0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12,
0x14, 0x0a, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x14, 0x0a, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,
0x75, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x6c, 0x76, 0x18, 0x03, 0x20, 0x01,
0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0c, 0x2e, 0x43, 0x68, 0x61, 0x74, 0x43, 0x68, 0x61, 0x28, 0x05, 0x52, 0x03, 0x75, 0x6c, 0x76, 0x12, 0x26, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e,
0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x1a, 0x0a, 0x65, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0c, 0x2e, 0x43, 0x68, 0x61, 0x74, 0x43,
0x08, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12,
0x08, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x1a, 0x0a, 0x08, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x49, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28,
0x74, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x09, 0x52, 0x08, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x63,
0x65, 0x6e, 0x74, 0x22, 0x0e, 0x0a, 0x0c, 0x43, 0x68, 0x61, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x52, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f,
0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x26, 0x0a, 0x0c, 0x43, 0x68, 0x61, 0x74, 0x53, 0x65, 0x6e,
0x74, 0x6f, 0x33, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x73, 0x75, 0x63, 0x63, 0x18,
0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x63, 0x63, 0x42, 0x06, 0x5a,
0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (

View File

@ -21,7 +21,7 @@ func NewGame_heroSkillLevel(_buf []map[string]interface{}) (*Game_heroSkillLevel
return nil, err2 return nil, err2
} else { } else {
_dataList = append(_dataList, _v) _dataList = append(_dataList, _v)
dataMap[_v.Key] = _v dataMap[_v.Id] = _v
} }
} }
return &Game_heroSkillLevel{_dataList:_dataList, _dataMap:dataMap}, nil return &Game_heroSkillLevel{_dataList:_dataList, _dataMap:dataMap}, nil

View File

@ -11,11 +11,8 @@ package cfg
import "errors" import "errors"
type Game_heroSkillLevelData struct { type Game_heroSkillLevelData struct {
Key int32 Id int32
Hid string Probability []int32
Skillpos int32
Skilllevel int32
Probability int32
} }
func (Game_heroSkillLevelData) GetTypeId() int { func (Game_heroSkillLevelData) GetTypeId() int {
@ -24,10 +21,20 @@ func (Game_heroSkillLevelData) GetTypeId() int {
func NewGame_heroSkillLevelData(_buf map[string]interface{}) (_v *Game_heroSkillLevelData, err error) { func NewGame_heroSkillLevelData(_buf map[string]interface{}) (_v *Game_heroSkillLevelData, err error) {
_v = &Game_heroSkillLevelData{} _v = &Game_heroSkillLevelData{}
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["key"].(float64); !_ok_ { err = errors.New("key error"); return }; _v.Key = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) }
{ var _ok_ bool; if _v.Hid, _ok_ = _buf["hid"].(string); !_ok_ { err = errors.New("hid error"); return } } {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["skillpos"].(float64); !_ok_ { err = errors.New("skillpos error"); return }; _v.Skillpos = int32(_tempNum_) } var _arr_ []interface{}
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["skilllevel"].(float64); !_ok_ { err = errors.New("skilllevel error"); return }; _v.Skilllevel = int32(_tempNum_) } var _ok_ bool
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["probability"].(float64); !_ok_ { err = errors.New("probability error"); return }; _v.Probability = int32(_tempNum_) } if _arr_, _ok_ = _buf["probability"].([]interface{}); !_ok_ { err = errors.New("probability error"); return }
_v.Probability = make([]int32, 0, len(_arr_))
for _, _e_ := range _arr_ {
var _list_v_ int32
{ var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) }
_v.Probability = append(_v.Probability, _list_v_)
}
}
return return
} }