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)
}
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")
}
@ -78,7 +78,7 @@ func newOptionsByOption(opts ...Option) (options *Options, err error) {
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")
}

View File

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

View File

@ -24,13 +24,13 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.ChatGetListReq)
)
switch req.Channel {
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
return
}
break
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
return
}
@ -50,13 +50,13 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.ChatGetListReq)
code = pb.ErrorCode_ReqParameterError
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
return
}
break
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
return
}

View File

@ -35,8 +35,10 @@ func (this *apiComp) Send(session comm.IUserSession, req *pb.ChatSendReq) (code
Id: primitive.NewObjectID().Hex(),
Channel: req.Channel,
Suid: session.GetUserId(),
Stag: session.GetServiecTag(),
Slv: req.Ulv,
Uname: req.Uname,
Avatar: req.Avatar,
Stag: session.GetServiecTag(),
Content: req.Content,
Ctime: time.Now().Unix(),
}
@ -83,7 +85,7 @@ func (this *apiComp) Send(session comm.IUserSession, req *pb.ChatSendReq) (code
return
}
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
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 (
key string
find bson.M
@ -74,15 +74,15 @@ func (this *modelChatComp) GetChatQueue(channel pb.ChatChannel, union, area int3
)
switch channel {
case pb.ChatChannel_World:
key = worldchatkey
key = fmt.Sprintf("%s-%s", worldchatkey, stag)
find = bson.M{"channel": channel}
break
case pb.ChatChannel_Union:
key = unionchatkey
key = fmt.Sprintf("%s-%s", unionchatkey, union)
find = bson.M{"channel": channel, "unionId": union}
break
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}
break
case pb.ChatChannel_System:
@ -138,7 +138,7 @@ func (this *modelChatComp) AddCrossChannelMember(session comm.IUserSession) (cha
return
}
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 {
this.module.Errorf("err:%v", err)
return
@ -167,7 +167,7 @@ func (this *modelChatComp) ChanageChannel(session comm.IUserSession, channel int
var (
maxnum int32
)
key := fmt.Sprintf("%s:%d-member", crosschatkey, channel)
key := fmt.Sprintf("%s-%d-member", crosschatkey, channel)
count := 0
if maxnum, err = this.module.configure.GetChanageChannelMax(); err != nil {
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) {
key := fmt.Sprintf("%s:%d-member", crosschatkey, channel)
result = make([]*pb.CacheUser, 0)
if err = this.Redis.HGetAll(key, &result); err != nil {
key := fmt.Sprintf("%s-%d-member", crosschatkey, channel)
temp := make(map[string]*pb.CacheUser, 0)
if err = this.Redis.HGetAll(key, &temp); err != nil {
this.module.Errorf("err:%v", err)
return
}
n := 0
result = make([]*pb.CacheUser, len(temp))
for _, v := range temp {
result[n] = v
n++
}
return
}
@ -207,7 +213,7 @@ func (this *modelChatComp) RemoveCrossChannelMember(session comm.IUserSession) (
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 {
this.module.Errorf("err:%v", err)
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) {
var (
tmpUpSkillID map[int32]*pb.SkillData // 即将要升级的技能id
probability map[int32]int32 // 即将升级技能的权重
upSkillPos int32 // 升级的技能位置
totalprobability int32 // 所有技能总权重
tmpValue int32 // 临时对象 存放累加权重
tagColor int32 // 目标卡品质
probability map[int32]int32 // 即将升级技能的权重
upSkillPos int32 // 升级的技能位置
totalprobability int32 // 所有技能总权重
_hero *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)
mapCostObj = make(map[string]*pb.DBHero, 0)
ChangeList = make([]*pb.DBHero, 0)
tmpUpSkillID = make(map[int32]*pb.SkillData, 0)
code = this.StrengthenUpSkillCheck(session, req) // check
if code != pb.ErrorCode_Success {
@ -55,7 +51,7 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt
code = pb.ErrorCode_HeroNoExist
return
}
tagColor = heroCfg.Color
for _, v := range req.CostCardObj { // 数组转 map
mapCostHero[v]++
}
@ -74,7 +70,7 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt
return
}
tmp := this.module.configure.GetHero(costHero.HeroID) // 星级校验
if tmp.Color != tagColor {
if tmp.Color != heroCfg.Color {
code = pb.ErrorCode_HeroColorErr
return
}
@ -99,33 +95,27 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt
return
}
tmpUpSkillID := make(map[int32]bool, 0)
for i := 0; i < int(lvUpCount); i++ { // 升级技能
config, err1 := this.module.configure.GetHeroSkillUpConfig()
if err1 != nil {
code = pb.ErrorCode_ConfigNoFound
return
}
probability = make(map[int32]int32, 0)
for index, skill := range _hero.NormalSkill {
skillMaxLv := this.module.configure.GetHeroSkillMaxLvConfig(uint32(skill.SkillID))
if skill.SkillLv < skillMaxLv { // 找到没有满级的技能id
tmpUpSkillID[int32(index)] = skill
tmpUpSkillID[int32(index)] = true
skillData := this.module.configure.GetHeroSkillUpConfig(skill.SkillID)
if skillData == nil {
code = pb.ErrorCode_ConfigNoFound
return
}
probability[skill.SkillID] = skillData.Probability[skill.SkillLv] // 获取权重
}
}
if len(tmpUpSkillID) == 0 {
code = pb.ErrorCode_HeroMaxSkillLv
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
// 根据权重升级对应的技能
for _, v := range probability {
@ -136,10 +126,10 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt
return
}
n, _ := rand.Int(rand.Reader, big.NewInt(int64(totalprobability)))
tmpValue = 0
tmp := 0
for k, v := range probability {
tmpValue += v
if int32(n.Int64()) < tmpValue { // 找到了
tmp += int(v)
if int32(n.Int64()) < v { // 找到了
upSkillPos = k
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) {
var (
v interface{}
ok bool
)
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)
func (this *configureComp) GetHeroSkillUpConfig(skillid int32) (data *cfg.Game_heroSkillLevelData) {
if v, err := this.GetConfigure(hero_skillup); err == nil {
if conf, ok := v.(*cfg.Game_heroSkillLevel); ok {
data = conf.Get(skillid)
return
}
} else {
err = fmt.Errorf("%T no is *cfg.Game_hero", v)
}
return

View File

@ -3,7 +3,6 @@ package mainline
import (
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/core/cbase"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/sys/configure"
cfg "go_dreamfactory/sys/configure/structs"
)
@ -18,6 +17,7 @@ const (
///配置管理基础组件
type configureComp struct {
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_mainlinepurgatory: cfg.NewGame_mainlinePurgatory,
})
this.module = module.(*Mainline)
return
}
@ -38,7 +38,7 @@ func (this *configureComp) LoadMultiConfigure(confs map[string]interface{}) (err
for k, v := range confs {
err = configure.RegisterConfigure(k, v)
if err != nil {
log.Errorf("配置文件:%s解析失败!", k)
this.module.Errorf("配置文件:%s解析失败!", k)
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) {
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
} else {
var (
@ -60,7 +60,7 @@ func (this *configureComp) GetMainlineChapter(id int32) (data *cfg.Game_mainline
ok bool
)
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
}
@ -74,7 +74,7 @@ func (this *configureComp) GetMainlineChapter(id int32) (data *cfg.Game_mainline
// 获取简单的关卡配置信息
func (this *configureComp) GetMainlineEasyChapter(id int32) (data *cfg.Game_mainlineEasyData) {
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
} else {
var (
@ -82,7 +82,7 @@ func (this *configureComp) GetMainlineEasyChapter(id int32) (data *cfg.Game_main
ok bool
)
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
}
@ -96,7 +96,7 @@ func (this *configureComp) GetMainlineEasyChapter(id int32) (data *cfg.Game_main
// 获取炼狱级别难度的关卡配置
func (this *configureComp) GetMainlinePurgatoryChapter(id int32) (data *cfg.Game_mainlinePurgatoryData) {
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
} else {
var (
@ -104,7 +104,7 @@ func (this *configureComp) GetMainlinePurgatoryChapter(id int32) (data *cfg.Game
ok bool
)
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
}
@ -118,7 +118,7 @@ func (this *configureComp) GetMainlinePurgatoryChapter(id int32) (data *cfg.Game
// 获取困难的关卡配置
func (this *configureComp) GetMainlineHardChapter(id int32) (data *cfg.Game_mainlineHardData) {
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
} else {
var (
@ -126,7 +126,7 @@ func (this *configureComp) GetMainlineHardChapter(id int32) (data *cfg.Game_main
ok bool
)
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
}

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) {
var (
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
ok bool
)
for _, v := range user {
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 {
gateway = make([]string, 0)
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)
for k, v := range gateways {
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,
MainType: mainType,
SubType: subType,
Data: data,
}, reply); err != nil {
}, nil); err != nil {
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)
}
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")
}
return

View File

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

View File

@ -3,7 +3,6 @@ package task
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
@ -35,7 +34,7 @@ func (this *ModelTaskActive) initActiveReward(uid string) {
RId: conf.Key,
}
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
}
}
@ -45,7 +44,7 @@ func (this *ModelTaskActive) initActiveReward(uid string) {
func (this *ModelTaskActive) getActiveListByTag(uid string, taskTag comm.TaskTag) (list []*pb.DBTaskActive) {
al := []*pb.DBTaskActive{}
if err := this.GetList(uid, &al); err != nil {
log.Errorf("getUserActiveList err:%v", err)
this.moduleTask.Errorf("getUserActiveList err:%v", err)
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) {
if len(taskTag) == 0 {
log.Errorf("least one param for taskTag")
this.moduleTask.Errorf("least one param for taskTag")
return
}
data := this.getActiveListByTag(uid, taskTag[0])
for _, v := range data {
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
}
}

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) {
list := []*pb.DBTask{}
if err := this.GetList(uid, &list); err != nil {
log.Errorf("getTaskList err %v", err)
this.moduleTask.Errorf("getTaskList err %v", err)
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) {
list := []*pb.DBTask{}
if err := this.GetList(uid, &list); err != nil {
log.Errorf("getTaskById err %v", err)
this.moduleTask.Errorf("getTaskById err %v", err)
return
}
@ -124,7 +124,7 @@ func (this *ModelTask) initTask(uid string) error {
Sort: cnf.IdList,
}
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
}
}
@ -136,7 +136,7 @@ func (this *ModelTask) initTask(uid string) error {
func (this *ModelTask) getUserTask(uid string, taskId string) *pb.DBTask {
userTask := &pb.DBTask{}
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 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 {
if err := this.ChangeList(uid, taskId, data); err != nil {
log.Errorf("err %v", err)
this.moduleTask.Errorf("err %v", err)
return err
}
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) {
if len(taskTag) == 0 {
log.Errorf("least one param for taskTag")
this.moduleTask.Errorf("least one param for taskTag")
return
}
taskList := this.getTaskListByTag(uid, taskTag[0])
for _, v := range taskList {
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
}
}
@ -260,7 +260,7 @@ func (this *ModelTask) UpHeroLevel(uid string, taskId int32, tp *pb.TaskParam) *
"progress": progress,
}
if err := this.modifyUserTask(task.Uid, task.Id, update); err != nil {
log.Errorf("err %v", err)
this.moduleTask.Errorf("err %v", err)
return nil
}
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) {
data, err := this.moduleTask.configure.getTasks(int32(taskType))
if err != nil {
log.Errorf("taskHandle err %v", err)
this.moduleTask.Errorf("taskHandle err %v", err)
return nil, err
}

View File

@ -3,7 +3,6 @@ package user
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/lego/sys/redis"
"go_dreamfactory/modules"
"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) {
cuser = &pb.CacheUser{}
if err := this.Get(uid, cuser); err != nil {
log.Errorf("GetUserSession err:%v", err)
this.moduleUser.Errorf("GetUserSession err:%v", err)
return
}
return

View File

@ -3,18 +3,19 @@ package user
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
)
type ModelSession struct {
modules.MCompModel
module *User
}
func (this *ModelSession) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
this.TableName = comm.TableSession
err = this.MCompModel.Init(service, module, comp, options)
this.module = module.(*User)
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) {
cuser = &pb.CacheUser{}
if err := this.Get(uid, cuser); err != nil {
log.Errorf("GetUserSession err:%v", err)
this.module.Errorf("GetUserSession err:%v", err)
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) {
user = &pb.DBUser{}
if err := this.Get(uid, user); err != nil {
log.Errorf("getUser err:%v", err)
this.moduleUser.Errorf("getUser err:%v", err)
return
}
return
@ -87,7 +87,7 @@ func (this *ModelUser) updateUserAttr(uid string, data map[string]interface{}) e
func (this *ModelUser) isLoginFirst(timestamp int64) bool {
now := time.Now()
if timestamp == 0 || timestamp > now.Unix() {
log.Debugf("lastlogin time great now")
this.moduleUser.Debugf("lastlogin time great now")
return false
}
tt := time.Unix(timestamp, 0)

View File

@ -8,7 +8,6 @@ import (
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/event"
"go_dreamfactory/lego/sys/log"
)
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) {
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
}
user := this.GetUser(session.GetUserId())
@ -147,11 +146,11 @@ func (this *User) AddAttributeValue(session comm.IUserSession, attr string, add
}
if len(update) == 0 {
log.Warn("AddAttributeValue param is empty")
this.Warn("AddAttributeValue param is empty")
return
}
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
}
@ -178,7 +177,7 @@ func (this *User) AddAttributeValues(session comm.IUserSession, attrs map[string
update := make(map[string]interface{})
for key, add := range attrs {
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
}
switch key {
@ -215,11 +214,11 @@ func (this *User) AddAttributeValues(session comm.IUserSession, attrs map[string
}
if len(update) == 0 {
log.Warn("AddAttributeValue param is empty")
this.Warn("AddAttributeValue param is empty")
return
}
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
}

View File

@ -3,7 +3,6 @@ package web
import (
"go_dreamfactory/lego/sys/gin"
"go_dreamfactory/lego/sys/gin/engine"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/pb"
"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})
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
msg = pb.GetErrorCodeMsg(code)
return
@ -36,7 +35,7 @@ func (this *Api_Comp) CreateNotify(c *engine.Context) {
return
}
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
msg = pb.GetErrorCodeMsg(code)
return

View File

@ -3,7 +3,6 @@ package web
import (
"go_dreamfactory/lego/sys/gin"
"go_dreamfactory/lego/sys/gin/engine"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/pb"
"net/http"
)
@ -34,7 +33,7 @@ func (this *Api_Comp) CreateMail(c *engine.Context) {
"Reward": req.Reward,
"Items": req.Items,
}); sign != req.Sign {
log.Errorf("LoginByCaptchaReq SignError sgin:%s", sign)
this.module.Errorf("LoginByCaptchaReq SignError sgin:%s", sign)
code = pb.ErrorCode_SignError
msg = pb.GetErrorCodeMsg(code)
return
@ -45,7 +44,7 @@ func (this *Api_Comp) CreateMail(c *engine.Context) {
return
}
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
msg = pb.GetErrorCodeMsg(code)
return

View File

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

View File

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

View File

@ -2,7 +2,6 @@ package web
import (
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/modules"
"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) {
notify.Id = primitive.NewObjectID().Hex()
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
}
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

View File

@ -29,7 +29,7 @@ func (this *modelUserComp) User_Create(user *pb.DBUser) (err error) {
now := time.Now().Unix()
_id := primitive.NewObjectID().Hex()
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.Lv = 1 //初始等级
user.Ctime = now

View File

@ -1,11 +1,11 @@
package web
import (
"fmt"
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"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() {
this.options.GetLog().Debugf(fmt.Sprintf("[Module:%s] ", this.GetType())+format, a...)
}
//日志接口
func (this *Web) Debug(msg string, args ...log.Field) {
this.options.GetLog().Debug(msg, args...)
}
func (this *Web) Infof(format string, a ...interface{}) {
if this.options.GetDebug() {
this.options.GetLog().Infof(fmt.Sprintf("[Module:%s] ", this.GetType())+format, a...)
}
func (this *Web) Info(msg string, args ...log.Field) {
this.options.GetLog().Info(msg, args...)
}
func (this *Web) Warnf(format string, a ...interface{}) {
if this.options.Debug {
this.options.GetLog().Warnf(fmt.Sprintf("[Module:%s] ", this.GetType())+format, a...)
}
func (this *Web) Print(msg string, args ...log.Field) {
this.options.GetLog().Print(msg, args...)
}
func (this *Web) Errorf(format string, a ...interface{}) {
if this.options.GetLog() != nil {
this.options.GetLog().Errorf(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) Panicf(format string, a ...interface{}) {
if this.options.GetLog() != nil {
this.options.GetLog().Panicf(fmt.Sprintf("[Module:%s] ", this.GetType())+format, a...)
}
func (this *Web) Error(msg string, args ...log.Field) {
this.options.GetLog().Error(msg, args...)
}
func (this *Web) Fatalf(format string, a ...interface{}) {
if this.options.GetLog() != nil {
this.options.GetLog().Fatalf(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) Fatal(msg string, args ...log.Field) {
this.options.GetLog().Fatal(msg, args...)
}
func (this *Web) Debugf(format string, args ...interface{}) {
this.options.GetLog().Debugf(format, args...)
}
func (this *Web) Infof(format string, args ...interface{}) {
this.options.GetLog().Infof(format, args...)
}
func (this *Web) Printf(format string, args ...interface{}) {
this.options.GetLog().Printf(format, args...)
}
func (this *Web) Warnf(format string, args ...interface{}) {
this.options.GetLog().Warnf(format, args...)
}
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
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
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
UnionId string `protobuf:"bytes,7,opt,name=unionId,proto3" json:"unionId"` //工会id
Stag string `protobuf:"bytes,8,opt,name=stag,proto3" json:"stag"` //区服id
@ -146,6 +147,13 @@ func (x *DBChat) GetSuid() string {
return ""
}
func (x *DBChat) GetSlv() int32 {
if x != nil {
return x.Slv
}
return 0
}
func (x *DBChat) GetRuid() string {
if x != nil {
return x.Ruid
@ -206,30 +214,31 @@ var File_chat_chat_db_proto protoreflect.FileDescriptor
var file_chat_chat_db_proto_rawDesc = []byte{
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,
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,
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,
0x75, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x75, 0x69, 0x64, 0x12,
0x1c, 0x0a, 0x09, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x18, 0x06, 0x20, 0x01,
0x28, 0x05, 0x52, 0x09, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x12, 0x18, 0x0a,
0x07, 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,
0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x74, 0x61, 0x67, 0x18,
0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x73, 0x74, 0x61, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x61,
0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x76, 0x61,
0x74, 0x61, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01,
0x28, 0x09, 0x52, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e,
0x74, 0x65, 0x6e, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74,
0x65, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x0c, 0x20, 0x01,
0x28, 0x03, 0x52, 0x05, 0x63, 0x74, 0x69, 0x6d, 0x65, 0x2a, 0x4d, 0x0a, 0x0b, 0x43, 0x68, 0x61,
0x74, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x09, 0x0a, 0x05, 0x57, 0x6f, 0x72, 0x6c,
0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x10, 0x01, 0x12, 0x0b,
0x0a, 0x07, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x43,
0x72, 0x6f, 0x73, 0x73, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x10, 0x03, 0x12, 0x0a, 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,
0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x73, 0x75, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x73,
0x6c, 0x76, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x73, 0x6c, 0x76, 0x12, 0x12, 0x0a,
0x04, 0x72, 0x75, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x75, 0x69,
0x64, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x18, 0x06,
0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x12,
0x18, 0x0a, 0x07, 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09,
0x52, 0x07, 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x74, 0x61,
0x67, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x73, 0x74, 0x61, 0x67, 0x12, 0x16, 0x0a,
0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61,
0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0a,
0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63,
0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f,
0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x0c,
0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x74, 0x69, 0x6d, 0x65, 0x2a, 0x4d, 0x0a, 0x0b, 0x43,
0x68, 0x61, 0x74, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x09, 0x0a, 0x05, 0x57, 0x6f,
0x72, 0x6c, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x10, 0x01,
0x12, 0x0b, 0x0a, 0x07, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x10, 0x02, 0x12, 0x0f, 0x0a,
0x0b, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x10, 0x03, 0x12, 0x0a,
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 (

View File

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

View File

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

View File

@ -11,11 +11,8 @@ package cfg
import "errors"
type Game_heroSkillLevelData struct {
Key int32
Hid string
Skillpos int32
Skilllevel int32
Probability int32
Id int32
Probability []int32
}
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) {
_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; 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 _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 _tempNum_ float64; if _tempNum_, _ok_ = _buf["probability"].(float64); !_ok_ { err = errors.New("probability error"); return }; _v.Probability = 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 _arr_ []interface{}
var _ok_ bool
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
}