This commit is contained in:
meixiongfeng 2022-07-14 14:19:54 +08:00
parent 522aa5e01f
commit 76de1d7245
12 changed files with 289 additions and 63 deletions

2
go.mod
View File

@ -15,6 +15,7 @@ require (
github.com/hashicorp/consul/api v1.12.0 github.com/hashicorp/consul/api v1.12.0
github.com/json-iterator/go v1.1.12 github.com/json-iterator/go v1.1.12
github.com/mitchellh/hashstructure v1.1.0 github.com/mitchellh/hashstructure v1.1.0
github.com/modern-go/reflect2 v1.0.2
github.com/nacos-group/nacos-sdk-go v1.0.8 github.com/nacos-group/nacos-sdk-go v1.0.8
github.com/natefinch/lumberjack v2.0.0+incompatible github.com/natefinch/lumberjack v2.0.0+incompatible
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475
@ -95,7 +96,6 @@ require (
github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.4.3 // indirect github.com/mitchellh/mapstructure v1.4.3 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/nxadm/tail v1.4.8 // indirect github.com/nxadm/tail v1.4.8 // indirect
github.com/onsi/ginkgo v1.16.5 // indirect github.com/onsi/ginkgo v1.16.5 // indirect
github.com/philhofer/fwd v1.1.1 // indirect github.com/philhofer/fwd v1.1.1 // indirect

View File

@ -1,9 +1,5 @@
package mgolog package mgolog
import (
"go_dreamfactory/lego/core"
)
const ( const (
WriteMaxNum uint32 = 1000 //一次性最处理条数 WriteMaxNum uint32 = 1000 //一次性最处理条数
ErrorMaxNum uint32 = 5 // 数据库操作最大失败次数 ErrorMaxNum uint32 = 5 // 数据库操作最大失败次数
@ -13,7 +9,3 @@ const (
var ( var (
ErrorLogCount = make(map[string]uint32, 0) ErrorLogCount = make(map[string]uint32, 0)
) )
const (
DB_ModelTable core.SqlTable = "model_log"
)

View File

@ -22,7 +22,7 @@ type DB_Comp struct {
func (this *DB_Comp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { func (this *DB_Comp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
this.MCompModel.Init(service, module, comp, options) this.MCompModel.Init(service, module, comp, options)
this.task = make(chan string, TaskMaxNum) this.task = make(chan string, TaskMaxNum)
this.TableName = "model_log"
return return
} }
@ -60,12 +60,12 @@ func (this *DB_Comp) PushUserTask(uid string) {
func (this *DB_Comp) Model_UpdateDBByLog(uid string) (err error) { func (this *DB_Comp) Model_UpdateDBByLog(uid string) (err error) {
var _data *mongo.Cursor var _data *mongo.Cursor
if uid == "" { if uid == "" {
_data, err = this.DB.Find(DB_ModelTable, bson.M{}, options.Find().SetLimit(int64(WriteMaxNum))) _data, err = this.DB.Find(core.SqlTable(this.TableName), bson.M{}, options.Find().SetLimit(int64(WriteMaxNum)))
if err != nil { if err != nil {
return err return err
} }
} else { } else {
_data, err = this.DB.Find(DB_ModelTable, bson.M{"uid": uid}, options.Find()) _data, err = this.DB.Find(core.SqlTable(this.TableName), bson.M{"uid": uid}, options.Find())
if err != nil { if err != nil {
return err return err
} }
@ -97,7 +97,7 @@ func (this *DB_Comp) Model_UpdateDBByLog(uid string) (err error) {
ErrorLogCount[data.ID]++ ErrorLogCount[data.ID]++
if ErrorLogCount[data.ID] >= ErrorMaxNum { // 实在是写失败了那就删除吧 if ErrorLogCount[data.ID] >= ErrorMaxNum { // 实在是写失败了那就删除吧
log.Errorf("insert db err max num %s db err:%v", data.ID, err) log.Errorf("insert db err max num %s db err:%v", data.ID, err)
_, err = this.DB.DeleteOne(DB_ModelTable, bson.M{"_id": data.ID}) _, err = this.DB.DeleteOne(core.SqlTable(this.TableName), bson.M{"_id": data.ID})
if err != nil { if err != nil {
log.Errorf("insert %s db err:%+v", data.ID, err) log.Errorf("insert %s db err:%+v", data.ID, err)
} }
@ -125,7 +125,7 @@ func (this *DB_Comp) Model_UpdateDBByLog(uid string) (err error) {
ErrorLogCount[data.ID]++ ErrorLogCount[data.ID]++
if ErrorLogCount[data.ID] >= ErrorMaxNum { // 实在是写失败了那就删除吧 if ErrorLogCount[data.ID] >= ErrorMaxNum { // 实在是写失败了那就删除吧
log.Errorf("del db err max num %s db err:%v", data.ID, err) log.Errorf("del db err max num %s db err:%v", data.ID, err)
_, err = this.DB.DeleteOne(DB_ModelTable, bson.M{"_id": data.ID}) _, err = this.DB.DeleteOne(core.SqlTable(this.TableName), bson.M{"_id": data.ID})
if err != nil { if err != nil {
log.Errorf("insert %s db err:%+v", data.ID, err) log.Errorf("insert %s db err:%+v", data.ID, err)
} }
@ -154,7 +154,7 @@ func (this *DB_Comp) Model_UpdateDBByLog(uid string) (err error) {
ErrorLogCount[data.ID]++ ErrorLogCount[data.ID]++
if ErrorLogCount[data.ID] >= ErrorMaxNum { // 超过一定次数写失败了那就删除吧 if ErrorLogCount[data.ID] >= ErrorMaxNum { // 超过一定次数写失败了那就删除吧
log.Errorf("update db err max num %s db err:%v", data.ID, err) log.Errorf("update db err max num %s db err:%v", data.ID, err)
_, err = this.DB.DeleteOne(DB_ModelTable, bson.M{"_id": data.ID}) _, err = this.DB.DeleteOne(core.SqlTable(this.TableName), bson.M{"_id": data.ID})
if err != nil { if err != nil {
log.Errorf("insert %s db err:%+v", data.ID, err) log.Errorf("insert %s db err:%+v", data.ID, err)
} }
@ -166,7 +166,7 @@ func (this *DB_Comp) Model_UpdateDBByLog(uid string) (err error) {
} }
if len(_delID) > 0 { if len(_delID) > 0 {
_, err = this.DB.DeleteMany(DB_ModelTable, bson.M{"_id": bson.M{"$in": _delID}}, options.Delete()) // 批量删除已处理的数据 _, err = this.DB.DeleteMany(core.SqlTable(this.TableName), bson.M{"_id": bson.M{"$in": _delID}}, options.Delete()) // 批量删除已处理的数据
if err != nil { if err != nil {
log.Errorf("del err %v", err) log.Errorf("del err %v", err)
} }
@ -178,7 +178,7 @@ func (this *DB_Comp) Model_UpdateDBByLog(uid string) (err error) {
// 写入日志数据 // 写入日志数据
func (this *DB_Comp) Model_InsertDBByLog(data *comm.Autogenerated) (err error) { func (this *DB_Comp) Model_InsertDBByLog(data *comm.Autogenerated) (err error) {
_, err = this.DB.InsertOne(DB_ModelTable, data) _, err = this.DB.InsertOne(core.SqlTable(this.TableName), data)
if err != nil { if err != nil {
log.Errorf("insert model db err %v", err) log.Errorf("insert model db err %v", err)
} }
@ -188,7 +188,7 @@ func (this *DB_Comp) Model_InsertDBByLog(data *comm.Autogenerated) (err error) {
// 查询 当前日志列表还有没有处理完条数 // 查询 当前日志列表还有没有处理完条数
func (this *DB_Comp) Model_TotalCount() int { func (this *DB_Comp) Model_TotalCount() int {
_data, err := this.DB.Find("DB_ModelTable", bson.M{}) _data, err := this.DB.Find(core.SqlTable(this.TableName), bson.M{})
if err == nil { if err == nil {
return _data.RemainingBatchLength() return _data.RemainingBatchLength()
} }

View File

@ -221,16 +221,20 @@ func (this *ModuleBase) DispenseRes(uid string, res []*cfg.Game_atn) (code pb.Er
} }
for _, v := range res { for _, v := range res {
if v.A == comm.AttrType { //用户属性资源 if v.A == comm.AttrType { //用户属性资源
this.ModuleUser.AddAttributeValue(uid, v.T, v.N) code = this.ModuleUser.AddAttributeValue(uid, v.T, v.N)
} else if v.A == comm.ItemType { //道具资源 } else if v.A == comm.ItemType { //道具资源
resID, _ = strconv.Atoi(v.T) resID, _ = strconv.Atoi(v.T)
this.ModuleItems.AddItem(source, uid, int32(resID), v.N) code = this.ModuleItems.AddItem(source, uid, int32(resID), v.N)
} else if v.A == comm.HeroType { //卡片资源 } else if v.A == comm.HeroType { //卡片资源
resID, _ = strconv.Atoi(v.T) resID, _ = strconv.Atoi(v.T)
this.ModuleHero.CreateHero(uid, int32(resID), v.N) err := this.ModuleHero.CreateHero(uid, int32(resID), v.N)
if err != nil {
code = pb.ErrorCode_HeroMaxCount
}
} else if v.A == comm.EquipmentType { } else if v.A == comm.EquipmentType {
resID, _ = strconv.Atoi(v.T) resID, _ = strconv.Atoi(v.T)
this.ModuleEquipment.AddNewEquipments(source, uid, map[int32]uint32{int32(resID): uint32(v.N)}) code = this.ModuleEquipment.AddNewEquipments(source, uid, map[int32]uint32{int32(resID): uint32(v.N)})
} }
} }
return return

View File

@ -2,6 +2,7 @@ package story
import ( import (
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/lego/sys/redis"
"go_dreamfactory/pb" "go_dreamfactory/pb"
"sort" "sort"
@ -30,7 +31,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.StoryChallenge
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
list, err := this.module.modelStory.getStoryList(session.GetUserId()) list, err := this.module.modelStory.getStoryList(session.GetUserId())
if err != nil { if err != nil && err != redis.RedisNil {
code = pb.ErrorCode_DBError code = pb.ErrorCode_DBError
return return
} }
@ -60,7 +61,9 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.StoryChallenge
_data.Id = primitive.NewObjectID().Hex() _data.Id = primitive.NewObjectID().Hex()
_data.ChapterId = int32(req.ChapterId) _data.ChapterId = int32(req.ChapterId)
_mData := make(map[string]interface{}, 0) _mData := make(map[string]interface{}, 0)
_data.Uid = session.GetUserId()
_mData[_data.Id] = _data _mData[_data.Id] = _data
this.module.modelStory.addNewChapter(session.GetUserId(), _mData) this.module.modelStory.addNewChapter(session.GetUserId(), _mData)
curChapter = _data curChapter = _data
//curChapter.StoryId = chaptConfig.Fubendata[0] // 第一次挑战 //curChapter.StoryId = chaptConfig.Fubendata[0] // 第一次挑战
@ -94,6 +97,9 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.StoryChallenge
"branchID": curChapter.BranchID, "branchID": curChapter.BranchID,
} }
err = this.module.modelStory.modifyStoryData(session.GetUserId(), curChapter.Id, update) err = this.module.modelStory.modifyStoryData(session.GetUserId(), curChapter.Id, update)
} else {
code = pb.ErrorCode_ReqParameterError
return
} }
// 发奖 (奖励数据还没配置,后续补充) // 发奖 (奖励数据还没配置,后续补充)
session.SendMsg(string(this.module.GetType()), StoryChallengeResp, &pb.StoryChallengeResp{Data: curChapter}) session.SendMsg(string(this.module.GetType()), StoryChallengeResp, &pb.StoryChallengeResp{Data: curChapter})

View File

@ -121,5 +121,12 @@ func (this *User) AddAttributeValue(uid string, attr string, add int32) (code pb
log.Errorf("AddAttributeValue err:%v", err) log.Errorf("AddAttributeValue err:%v", err)
code = pb.ErrorCode_DBError code = pb.ErrorCode_DBError
} }
data := &pb.UserResChangePush{}
var _cache = &pb.CacheUser{}
err := this.modelUser.MCompModel.Get(uid, _cache)
if err != nil {
this.SendMsgToUser(string(this.GetType()), "addres", data, _cache)
}
return return
} }

View File

@ -83,6 +83,7 @@ const (
ErrorCode_HeroEquipUpdate ErrorCode = 1311 // 更新装备失败 ErrorCode_HeroEquipUpdate ErrorCode = 1311 // 更新装备失败
ErrorCode_HeroMaxAwaken ErrorCode = 1312 // 达到最大觉醒等级 ErrorCode_HeroMaxAwaken ErrorCode = 1312 // 达到最大觉醒等级
ErrorCode_HeroIsLock ErrorCode = 1313 // 英雄被锁定不能被消耗 ErrorCode_HeroIsLock ErrorCode = 1313 // 英雄被锁定不能被消耗
ErrorCode_HeroMaxCount ErrorCode = 1314 // 英雄达到最大数量
// equipment // equipment
ErrorCode_EquipmentOnFoundEquipment ErrorCode = 1400 // 未找到武器 ErrorCode_EquipmentOnFoundEquipment ErrorCode = 1400 // 未找到武器
ErrorCode_EquipmentLvlimitReached ErrorCode = 1401 // 武器等级已达上限 ErrorCode_EquipmentLvlimitReached ErrorCode = 1401 // 武器等级已达上限
@ -158,6 +159,7 @@ var (
1311: "HeroEquipUpdate", 1311: "HeroEquipUpdate",
1312: "HeroMaxAwaken", 1312: "HeroMaxAwaken",
1313: "HeroIsLock", 1313: "HeroIsLock",
1314: "HeroMaxCount",
1400: "EquipmentOnFoundEquipment", 1400: "EquipmentOnFoundEquipment",
1401: "EquipmentLvlimitReached", 1401: "EquipmentLvlimitReached",
1500: "StoryNotFindChapter", 1500: "StoryNotFindChapter",
@ -227,6 +229,7 @@ var (
"HeroEquipUpdate": 1311, "HeroEquipUpdate": 1311,
"HeroMaxAwaken": 1312, "HeroMaxAwaken": 1312,
"HeroIsLock": 1313, "HeroIsLock": 1313,
"HeroMaxCount": 1314,
"EquipmentOnFoundEquipment": 1400, "EquipmentOnFoundEquipment": 1400,
"EquipmentLvlimitReached": 1401, "EquipmentLvlimitReached": 1401,
"StoryNotFindChapter": 1500, "StoryNotFindChapter": 1500,
@ -272,7 +275,7 @@ var File_errorcode_proto protoreflect.FileDescriptor
var file_errorcode_proto_rawDesc = []byte{ var file_errorcode_proto_rawDesc = []byte{
0x0a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x0a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x2a, 0xf4, 0x0a, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x6f, 0x2a, 0x87, 0x0b, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12,
0x0b, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x0b, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d,
0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x10, 0x0a, 0x12, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x10, 0x0a, 0x12,
0x1b, 0x0a, 0x17, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x1b, 0x0a, 0x17, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
@ -344,23 +347,24 @@ var file_errorcode_proto_rawDesc = []byte{
0x45, 0x71, 0x75, 0x69, 0x70, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x10, 0x9f, 0x0a, 0x12, 0x12, 0x45, 0x71, 0x75, 0x69, 0x70, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x10, 0x9f, 0x0a, 0x12, 0x12,
0x0a, 0x0d, 0x48, 0x65, 0x72, 0x6f, 0x4d, 0x61, 0x78, 0x41, 0x77, 0x61, 0x6b, 0x65, 0x6e, 0x10, 0x0a, 0x0d, 0x48, 0x65, 0x72, 0x6f, 0x4d, 0x61, 0x78, 0x41, 0x77, 0x61, 0x6b, 0x65, 0x6e, 0x10,
0xa0, 0x0a, 0x12, 0x0f, 0x0a, 0x0a, 0x48, 0x65, 0x72, 0x6f, 0x49, 0x73, 0x4c, 0x6f, 0x63, 0x6b, 0xa0, 0x0a, 0x12, 0x0f, 0x0a, 0x0a, 0x48, 0x65, 0x72, 0x6f, 0x49, 0x73, 0x4c, 0x6f, 0x63, 0x6b,
0x10, 0xa1, 0x0a, 0x12, 0x1e, 0x0a, 0x19, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0xa1, 0x0a, 0x12, 0x11, 0x0a, 0x0c, 0x48, 0x65, 0x72, 0x6f, 0x4d, 0x61, 0x78, 0x43, 0x6f,
0x4f, 0x6e, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x75, 0x6e, 0x74, 0x10, 0xa2, 0x0a, 0x12, 0x1e, 0x0a, 0x19, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d,
0x10, 0xf8, 0x0a, 0x12, 0x1c, 0x0a, 0x17, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x4f, 0x6e, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d,
0x4c, 0x76, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x61, 0x63, 0x68, 0x65, 0x64, 0x10, 0xf9, 0x65, 0x6e, 0x74, 0x10, 0xf8, 0x0a, 0x12, 0x1c, 0x0a, 0x17, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d,
0x0a, 0x12, 0x18, 0x0a, 0x13, 0x53, 0x74, 0x6f, 0x72, 0x79, 0x4e, 0x6f, 0x74, 0x46, 0x69, 0x6e, 0x65, 0x6e, 0x74, 0x4c, 0x76, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x61, 0x63, 0x68, 0x65,
0x64, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x10, 0xdc, 0x0b, 0x12, 0x12, 0x0a, 0x0d, 0x53, 0x64, 0x10, 0xf9, 0x0a, 0x12, 0x18, 0x0a, 0x13, 0x53, 0x74, 0x6f, 0x72, 0x79, 0x4e, 0x6f, 0x74,
0x74, 0x6f, 0x72, 0x79, 0x49, 0x44, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x10, 0xdd, 0x0b, 0x12, 0x46, 0x69, 0x6e, 0x64, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x10, 0xdc, 0x0b, 0x12, 0x12,
0x0d, 0x0a, 0x08, 0x54, 0x61, 0x73, 0x6b, 0x49, 0x6e, 0x69, 0x74, 0x10, 0xc0, 0x0c, 0x12, 0x0e, 0x0a, 0x0d, 0x53, 0x74, 0x6f, 0x72, 0x79, 0x49, 0x44, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x10,
0x0a, 0x09, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x73, 0x65, 0x74, 0x10, 0xc1, 0x0c, 0x12, 0x0f, 0xdd, 0x0b, 0x12, 0x0d, 0x0a, 0x08, 0x54, 0x61, 0x73, 0x6b, 0x49, 0x6e, 0x69, 0x74, 0x10, 0xc0,
0x0a, 0x0a, 0x54, 0x61, 0x73, 0x6b, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x10, 0xc2, 0x0c, 0x12, 0x0c, 0x12, 0x0e, 0x0a, 0x09, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x73, 0x65, 0x74, 0x10, 0xc1,
0x11, 0x0a, 0x0c, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x10, 0x0c, 0x12, 0x0f, 0x0a, 0x0a, 0x54, 0x61, 0x73, 0x6b, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x10,
0xc3, 0x0c, 0x12, 0x13, 0x0a, 0x0e, 0x54, 0x61, 0x73, 0x6b, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0xc2, 0x0c, 0x12, 0x11, 0x0a, 0x0c, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76,
0x49, 0x6e, 0x69, 0x74, 0x10, 0xc6, 0x0c, 0x12, 0x16, 0x0a, 0x11, 0x54, 0x61, 0x73, 0x6b, 0x41, 0x65, 0x64, 0x10, 0xc3, 0x0c, 0x12, 0x13, 0x0a, 0x0e, 0x54, 0x61, 0x73, 0x6b, 0x41, 0x63, 0x74,
0x63, 0x74, 0x69, 0x76, 0x65, 0x4e, 0x6f, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0xc4, 0x0c, 0x12, 0x69, 0x76, 0x65, 0x49, 0x6e, 0x69, 0x74, 0x10, 0xc6, 0x0c, 0x12, 0x16, 0x0a, 0x11, 0x54, 0x61,
0x17, 0x0a, 0x12, 0x54, 0x61, 0x73, 0x6b, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x4e, 0x6f, 0x65, 0x73, 0x6b, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x4e, 0x6f, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x10,
0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0xc5, 0x0c, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0xc4, 0x0c, 0x12, 0x17, 0x0a, 0x12, 0x54, 0x61, 0x73, 0x6b, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65,
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x4e, 0x6f, 0x65, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0xc5, 0x0c, 0x42, 0x06, 0x5a, 0x04, 0x2e,
0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (

61
pb/forum_db.pb.go Normal file
View File

@ -0,0 +1,61 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v3.20.0
// source: forum/forum_db.proto
package pb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
var File_forum_forum_db_proto protoreflect.FileDescriptor
var file_forum_forum_db_proto_rawDesc = []byte{
0x0a, 0x14, 0x66, 0x6f, 0x72, 0x75, 0x6d, 0x2f, 0x66, 0x6f, 0x72, 0x75, 0x6d, 0x5f, 0x64, 0x62,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var file_forum_forum_db_proto_goTypes = []interface{}{}
var file_forum_forum_db_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_forum_forum_db_proto_init() }
func file_forum_forum_db_proto_init() {
if File_forum_forum_db_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_forum_forum_db_proto_rawDesc,
NumEnums: 0,
NumMessages: 0,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_forum_forum_db_proto_goTypes,
DependencyIndexes: file_forum_forum_db_proto_depIdxs,
}.Build()
File_forum_forum_db_proto = out.File
file_forum_forum_db_proto_rawDesc = nil
file_forum_forum_db_proto_goTypes = nil
file_forum_forum_db_proto_depIdxs = nil
}

61
pb/forum_msg.pb.go Normal file
View File

@ -0,0 +1,61 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v3.20.0
// source: forum/forum_msg.proto
package pb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
var File_forum_forum_msg_proto protoreflect.FileDescriptor
var file_forum_forum_msg_proto_rawDesc = []byte{
0x0a, 0x15, 0x66, 0x6f, 0x72, 0x75, 0x6d, 0x2f, 0x66, 0x6f, 0x72, 0x75, 0x6d, 0x5f, 0x6d, 0x73,
0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var file_forum_forum_msg_proto_goTypes = []interface{}{}
var file_forum_forum_msg_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_forum_forum_msg_proto_init() }
func file_forum_forum_msg_proto_init() {
if File_forum_forum_msg_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_forum_forum_msg_proto_rawDesc,
NumEnums: 0,
NumMessages: 0,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_forum_forum_msg_proto_goTypes,
DependencyIndexes: file_forum_forum_msg_proto_depIdxs,
}.Build()
File_forum_forum_msg_proto = out.File
file_forum_forum_msg_proto_rawDesc = nil
file_forum_forum_msg_proto_goTypes = nil
file_forum_forum_msg_proto_depIdxs = nil
}

View File

@ -66,6 +66,7 @@ enum ErrorCode {
HeroEquipUpdate = 1311; // HeroEquipUpdate = 1311; //
HeroMaxAwaken = 1312; // HeroMaxAwaken = 1312; //
HeroIsLock = 1313; // HeroIsLock = 1313; //
HeroMaxCount = 1314; //
// equipment // equipment
EquipmentOnFoundEquipment = 1400; // EquipmentOnFoundEquipment = 1400; //

View File

@ -39,3 +39,9 @@ message UserAddResResp {
UserAssets res = 1; // UserAssets res = 1; //
} }
//
message UserResChangePush{
int32 changeType = 1; // 0 1
int32 value = 2;
string resName = 3; //
}

View File

@ -461,6 +461,70 @@ func (x *UserAddResResp) GetRes() *UserAssets {
return nil return nil
} }
// 玩家资源变更推送
type UserResChangePush struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ChangeType int32 `protobuf:"varint,1,opt,name=changeType,proto3" json:"changeType"` // 变化类型 0 增加 1 减少
Value int32 `protobuf:"varint,2,opt,name=value,proto3" json:"value"`
ResName string `protobuf:"bytes,3,opt,name=resName,proto3" json:"resName"` // 资源名称
}
func (x *UserResChangePush) Reset() {
*x = UserResChangePush{}
if protoimpl.UnsafeEnabled {
mi := &file_user_user_msg_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UserResChangePush) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UserResChangePush) ProtoMessage() {}
func (x *UserResChangePush) ProtoReflect() protoreflect.Message {
mi := &file_user_user_msg_proto_msgTypes[9]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use UserResChangePush.ProtoReflect.Descriptor instead.
func (*UserResChangePush) Descriptor() ([]byte, []int) {
return file_user_user_msg_proto_rawDescGZIP(), []int{9}
}
func (x *UserResChangePush) GetChangeType() int32 {
if x != nil {
return x.ChangeType
}
return 0
}
func (x *UserResChangePush) GetValue() int32 {
if x != nil {
return x.Value
}
return 0
}
func (x *UserResChangePush) GetResName() string {
if x != nil {
return x.ResName
}
return ""
}
var File_user_user_msg_proto protoreflect.FileDescriptor var File_user_user_msg_proto protoreflect.FileDescriptor
var file_user_user_msg_proto_rawDesc = []byte{ var file_user_user_msg_proto_rawDesc = []byte{
@ -496,8 +560,15 @@ var file_user_user_msg_proto_rawDesc = []byte{
0x72, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x03, 0x72, 0x65, 0x73, 0x22, 0x2f, 0x0a, 0x0e, 0x72, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x03, 0x72, 0x65, 0x73, 0x22, 0x2f, 0x0a, 0x0e,
0x55, 0x73, 0x65, 0x72, 0x41, 0x64, 0x64, 0x52, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x55, 0x73, 0x65, 0x72, 0x41, 0x64, 0x64, 0x52, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d,
0x0a, 0x03, 0x72, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x55, 0x73, 0x0a, 0x03, 0x72, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x55, 0x73,
0x65, 0x72, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x03, 0x72, 0x65, 0x73, 0x42, 0x06, 0x5a, 0x65, 0x72, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x03, 0x72, 0x65, 0x73, 0x22, 0x63, 0x0a,
0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x11, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x75,
0x73, 0x68, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65,
0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x54, 0x79,
0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x73, 0x4e,
0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x73, 0x4e, 0x61,
0x6d, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x33,
} }
var ( var (
@ -512,28 +583,29 @@ func file_user_user_msg_proto_rawDescGZIP() []byte {
return file_user_user_msg_proto_rawDescData return file_user_user_msg_proto_rawDescData
} }
var file_user_user_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 9) var file_user_user_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
var file_user_user_msg_proto_goTypes = []interface{}{ var file_user_user_msg_proto_goTypes = []interface{}{
(*UserLoginReq)(nil), // 0: UserLoginReq (*UserLoginReq)(nil), // 0: UserLoginReq
(*UserLoginResp)(nil), // 1: UserLoginResp (*UserLoginResp)(nil), // 1: UserLoginResp
(*UserRegisterReq)(nil), // 2: UserRegisterReq (*UserRegisterReq)(nil), // 2: UserRegisterReq
(*UserRegisterResp)(nil), // 3: UserRegisterResp (*UserRegisterResp)(nil), // 3: UserRegisterResp
(*UserLoadResp)(nil), // 4: UserLoadResp (*UserLoadResp)(nil), // 4: UserLoadResp
(*UserCreateReq)(nil), // 5: UserCreateReq (*UserCreateReq)(nil), // 5: UserCreateReq
(*UserCreateResp)(nil), // 6: UserCreateResp (*UserCreateResp)(nil), // 6: UserCreateResp
(*UserAddResReq)(nil), // 7: UserAddResReq (*UserAddResReq)(nil), // 7: UserAddResReq
(*UserAddResResp)(nil), // 8: UserAddResResp (*UserAddResResp)(nil), // 8: UserAddResResp
(*DBUser)(nil), // 9: DBUser (*UserResChangePush)(nil), // 9: UserResChangePush
(ErrorCode)(0), // 10: ErrorCode (*DBUser)(nil), // 10: DBUser
(*CacheUser)(nil), // 11: CacheUser (ErrorCode)(0), // 11: ErrorCode
(*UserAssets)(nil), // 12: UserAssets (*CacheUser)(nil), // 12: CacheUser
(*UserAssets)(nil), // 13: UserAssets
} }
var file_user_user_msg_proto_depIdxs = []int32{ var file_user_user_msg_proto_depIdxs = []int32{
9, // 0: UserLoginResp.data:type_name -> DBUser 10, // 0: UserLoginResp.data:type_name -> DBUser
10, // 1: UserRegisterResp.Code:type_name -> ErrorCode 11, // 1: UserRegisterResp.Code:type_name -> ErrorCode
11, // 2: UserLoadResp.data:type_name -> CacheUser 12, // 2: UserLoadResp.data:type_name -> CacheUser
12, // 3: UserAddResReq.res:type_name -> UserAssets 13, // 3: UserAddResReq.res:type_name -> UserAssets
12, // 4: UserAddResResp.res:type_name -> UserAssets 13, // 4: UserAddResResp.res:type_name -> UserAssets
5, // [5:5] is the sub-list for method output_type 5, // [5:5] is the sub-list for method output_type
5, // [5:5] is the sub-list for method input_type 5, // [5:5] is the sub-list for method input_type
5, // [5:5] is the sub-list for extension type_name 5, // [5:5] is the sub-list for extension type_name
@ -658,6 +730,18 @@ func file_user_user_msg_proto_init() {
return nil return nil
} }
} }
file_user_user_msg_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UserResChangePush); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
} }
type x struct{} type x struct{}
out := protoimpl.TypeBuilder{ out := protoimpl.TypeBuilder{
@ -665,7 +749,7 @@ func file_user_user_msg_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_user_user_msg_proto_rawDesc, RawDescriptor: file_user_user_msg_proto_rawDesc,
NumEnums: 0, NumEnums: 0,
NumMessages: 9, NumMessages: 10,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,
}, },