This commit is contained in:
liwei1dao 2022-07-22 15:18:03 +08:00
commit ae13a7f85c
7 changed files with 223 additions and 35 deletions

View File

@ -101,6 +101,20 @@ func (this *ModelHero) createOneHero(uid string, heroCfgId int32) (hero *pb.DBHe
func (this *ModelHero) initHeroOverlying(uid string, heroCfgId, count int32) (hero *pb.DBHero, err error) { func (this *ModelHero) initHeroOverlying(uid string, heroCfgId, count int32) (hero *pb.DBHero, err error) {
hero = this.initHero(uid, heroCfgId) hero = this.initHero(uid, heroCfgId)
if hero != nil { if hero != nil {
// 添加图鉴
if result, err1 := this.GetUserExpand(uid); err1 == nil {
sz := make(map[int32]bool, 0)
for k := range result.GetTujian() {
sz[k] = true
}
if _, ok := result.GetTujian()[heroCfgId]; !ok {
sz[heroCfgId] = true
initUpdate := map[string]interface{}{
"tujian": sz,
}
this.ChanageUserExpand(uid, initUpdate)
}
}
hero.SameCount += count hero.SameCount += count
if err = this.moduleHero.modelHero.AddList(uid, hero.Id, hero); err != nil { if err = this.moduleHero.modelHero.AddList(uid, hero.Id, hero); err != nil {
this.moduleHero.Errorf("%v", err) this.moduleHero.Errorf("%v", err)

View File

@ -17,6 +17,7 @@ const (
UserSubTypeUpdatesetting = "updatesetting" //更新设置 UserSubTypeUpdatesetting = "updatesetting" //更新设置
UserSubTypeVeriCode = "vericode" //验证码 UserSubTypeVeriCode = "vericode" //验证码
UserSubTypeInitData = "initdata" //初始化用户 UserSubTypeInitData = "initdata" //初始化用户
UserGetTujianResp = "gettujian" //获取图鉴信息
) )
type apiComp struct { type apiComp struct {

View File

@ -0,0 +1,33 @@
package user
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
func (this *apiComp) GetTujianCheck(session comm.IUserSession, req *pb.UserGetTujianReq) (code pb.ErrorCode) {
return
}
func (this *apiComp) GetTujian(session comm.IUserSession, req *pb.UserGetTujianReq) (code pb.ErrorCode, data proto.Message) {
if code = this.GetTujianCheck(session, req); code != pb.ErrorCode_Success {
return
}
rsp := &pb.UserGetTujianResp{}
if result, err := this.module.modelUser.GetUserExpand(session.GetUserId()); err != nil {
this.module.Errorf("err:%v", err)
return
} else {
for k := range result.Tujian {
rsp.Heroids = append(rsp.Heroids, k)
}
}
err := session.SendMsg(string(this.module.GetType()), UserGetTujianResp, rsp)
if err != nil {
code = pb.ErrorCode_SystemError
}
return
}

View File

@ -90,3 +90,11 @@ message UserModifynameResp {
string uid = 1; string uid = 1;
uint32 count = 2; // uint32 count = 2; //
} }
message UserGetTujianReq{
}
message UserGetTujianResp{
repeated int32 heroids = 1;
}

View File

@ -10,4 +10,5 @@ message DBUserExpand {
uint32 initdataCount = 5; // uint32 initdataCount = 5; //
int32 chatchannel = 6; // int32 chatchannel = 6; //
int32 modifynameCount = 7; // int32 modifynameCount = 7; //
map<int32,bool> tujian = 8; //
} }

View File

@ -1074,6 +1074,91 @@ func (x *UserModifynameResp) GetCount() uint32 {
return 0 return 0
} }
type UserGetTujianReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *UserGetTujianReq) Reset() {
*x = UserGetTujianReq{}
if protoimpl.UnsafeEnabled {
mi := &file_user_user_msg_proto_msgTypes[22]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UserGetTujianReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UserGetTujianReq) ProtoMessage() {}
func (x *UserGetTujianReq) ProtoReflect() protoreflect.Message {
mi := &file_user_user_msg_proto_msgTypes[22]
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 UserGetTujianReq.ProtoReflect.Descriptor instead.
func (*UserGetTujianReq) Descriptor() ([]byte, []int) {
return file_user_user_msg_proto_rawDescGZIP(), []int{22}
}
type UserGetTujianResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Heroids []int32 `protobuf:"varint,1,rep,packed,name=heroids,proto3" json:"heroids"`
}
func (x *UserGetTujianResp) Reset() {
*x = UserGetTujianResp{}
if protoimpl.UnsafeEnabled {
mi := &file_user_user_msg_proto_msgTypes[23]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UserGetTujianResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UserGetTujianResp) ProtoMessage() {}
func (x *UserGetTujianResp) ProtoReflect() protoreflect.Message {
mi := &file_user_user_msg_proto_msgTypes[23]
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 UserGetTujianResp.ProtoReflect.Descriptor instead.
func (*UserGetTujianResp) Descriptor() ([]byte, []int) {
return file_user_user_msg_proto_rawDescGZIP(), []int{23}
}
func (x *UserGetTujianResp) GetHeroids() []int32 {
if x != nil {
return x.Heroids
}
return nil
}
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{
@ -1147,8 +1232,12 @@ var file_user_user_msg_proto_rawDesc = []byte{
0x6f, 0x64, 0x69, 0x66, 0x79, 0x6e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x6e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x10, 0x0a,
0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12,
0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05,
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x12, 0x0a, 0x10, 0x55, 0x73, 0x65, 0x72, 0x47, 0x65, 0x74,
0x72, 0x6f, 0x74, 0x6f, 0x33, 0x54, 0x75, 0x6a, 0x69, 0x61, 0x6e, 0x52, 0x65, 0x71, 0x22, 0x2d, 0x0a, 0x11, 0x55, 0x73, 0x65,
0x72, 0x47, 0x65, 0x74, 0x54, 0x75, 0x6a, 0x69, 0x61, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x18,
0x0a, 0x07, 0x68, 0x65, 0x72, 0x6f, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x52,
0x07, 0x68, 0x65, 0x72, 0x6f, 0x69, 0x64, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62,
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
@ -1163,7 +1252,7 @@ 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, 22) var file_user_user_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 24)
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
@ -1187,22 +1276,24 @@ var file_user_user_msg_proto_goTypes = []interface{}{
(*UserInitdataResp)(nil), // 19: UserInitdataResp (*UserInitdataResp)(nil), // 19: UserInitdataResp
(*UserModifynameReq)(nil), // 20: UserModifynameReq (*UserModifynameReq)(nil), // 20: UserModifynameReq
(*UserModifynameResp)(nil), // 21: UserModifynameResp (*UserModifynameResp)(nil), // 21: UserModifynameResp
(*DBUser)(nil), // 22: DBUser (*UserGetTujianReq)(nil), // 22: UserGetTujianReq
(*DBUserExpand)(nil), // 23: DBUserExpand (*UserGetTujianResp)(nil), // 23: UserGetTujianResp
(ErrorCode)(0), // 24: ErrorCode (*DBUser)(nil), // 24: DBUser
(*CacheUser)(nil), // 25: CacheUser (*DBUserExpand)(nil), // 25: DBUserExpand
(*UserAssets)(nil), // 26: UserAssets (ErrorCode)(0), // 26: ErrorCode
(*DBUserSetting)(nil), // 27: DBUserSetting (*CacheUser)(nil), // 27: CacheUser
(*UserAssets)(nil), // 28: UserAssets
(*DBUserSetting)(nil), // 29: DBUserSetting
} }
var file_user_user_msg_proto_depIdxs = []int32{ var file_user_user_msg_proto_depIdxs = []int32{
22, // 0: UserLoginResp.data:type_name -> DBUser 24, // 0: UserLoginResp.data:type_name -> DBUser
23, // 1: UserLoginResp.ex:type_name -> DBUserExpand 25, // 1: UserLoginResp.ex:type_name -> DBUserExpand
24, // 2: UserRegisterResp.Code:type_name -> ErrorCode 26, // 2: UserRegisterResp.Code:type_name -> ErrorCode
25, // 3: UserLoadResp.data:type_name -> CacheUser 27, // 3: UserLoadResp.data:type_name -> CacheUser
26, // 4: UserAddResReq.res:type_name -> UserAssets 28, // 4: UserAddResReq.res:type_name -> UserAssets
26, // 5: UserAddResResp.res:type_name -> UserAssets 28, // 5: UserAddResResp.res:type_name -> UserAssets
27, // 6: UserGetSettingResp.setting:type_name -> DBUserSetting 29, // 6: UserGetSettingResp.setting:type_name -> DBUserSetting
27, // 7: UserUpdateSettingReq.setting:type_name -> DBUserSetting 29, // 7: UserUpdateSettingReq.setting:type_name -> DBUserSetting
8, // [8:8] is the sub-list for method output_type 8, // [8:8] is the sub-list for method output_type
8, // [8:8] is the sub-list for method input_type 8, // [8:8] is the sub-list for method input_type
8, // [8:8] is the sub-list for extension type_name 8, // [8:8] is the sub-list for extension type_name
@ -1484,6 +1575,30 @@ func file_user_user_msg_proto_init() {
return nil return nil
} }
} }
file_user_user_msg_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UserGetTujianReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_user_user_msg_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UserGetTujianResp); 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{
@ -1491,7 +1606,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: 22, NumMessages: 24,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,
}, },

View File

@ -33,6 +33,7 @@ type DBUserExpand struct {
InitdataCount uint32 `protobuf:"varint,5,opt,name=initdataCount,proto3" json:"initdataCount"` //今日初始累计次数 InitdataCount uint32 `protobuf:"varint,5,opt,name=initdataCount,proto3" json:"initdataCount"` //今日初始累计次数
Chatchannel int32 `protobuf:"varint,6,opt,name=chatchannel,proto3" json:"chatchannel"` //跨服聊天频道 Chatchannel int32 `protobuf:"varint,6,opt,name=chatchannel,proto3" json:"chatchannel"` //跨服聊天频道
ModifynameCount int32 `protobuf:"varint,7,opt,name=modifynameCount,proto3" json:"modifynameCount"` //修改昵称次数 ModifynameCount int32 `protobuf:"varint,7,opt,name=modifynameCount,proto3" json:"modifynameCount"` //修改昵称次数
Tujian map[int32]bool `protobuf:"bytes,8,rep,name=tujian,proto3" json:"tujian" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // 图鉴
} }
func (x *DBUserExpand) Reset() { func (x *DBUserExpand) Reset() {
@ -116,11 +117,18 @@ func (x *DBUserExpand) GetModifynameCount() int32 {
return 0 return 0
} }
func (x *DBUserExpand) GetTujian() map[int32]bool {
if x != nil {
return x.Tujian
}
return nil
}
var File_userexpand_proto protoreflect.FileDescriptor var File_userexpand_proto protoreflect.FileDescriptor
var file_userexpand_proto_rawDesc = []byte{ var file_userexpand_proto_rawDesc = []byte{
0x0a, 0x10, 0x75, 0x73, 0x65, 0x72, 0x65, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x0a, 0x10, 0x75, 0x73, 0x65, 0x72, 0x65, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x22, 0xfc, 0x01, 0x0a, 0x0c, 0x44, 0x42, 0x55, 0x73, 0x65, 0x72, 0x45, 0x78, 0x70, 0x74, 0x6f, 0x22, 0xea, 0x02, 0x0a, 0x0c, 0x44, 0x42, 0x55, 0x73, 0x65, 0x72, 0x45, 0x78, 0x70,
0x61, 0x6e, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x61, 0x6e, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x2c, 0x0a, 0x11, 0x6c, 0x61, 0x73, 0x74, 0x72, 0x65, 0x61, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x2c, 0x0a, 0x11, 0x6c, 0x61, 0x73, 0x74, 0x72, 0x65, 0x61,
@ -136,8 +144,14 @@ var file_userexpand_proto_rawDesc = []byte{
0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x28, 0x0a, 0x0f, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x28, 0x0a, 0x0f, 0x6d, 0x6f, 0x64, 0x69, 0x66,
0x79, 0x6e, 0x61, 0x6d, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x79, 0x6e, 0x61, 0x6d, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05,
0x52, 0x0f, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x6e, 0x61, 0x6d, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x52, 0x0f, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x6e, 0x61, 0x6d, 0x65, 0x43, 0x6f, 0x75, 0x6e,
0x74, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x74, 0x12, 0x31, 0x0a, 0x06, 0x74, 0x75, 0x6a, 0x69, 0x61, 0x6e, 0x18, 0x08, 0x20, 0x03, 0x28,
0x33, 0x0b, 0x32, 0x19, 0x2e, 0x44, 0x42, 0x55, 0x73, 0x65, 0x72, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64,
0x2e, 0x54, 0x75, 0x6a, 0x69, 0x61, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x74, 0x75,
0x6a, 0x69, 0x61, 0x6e, 0x1a, 0x39, 0x0a, 0x0b, 0x54, 0x75, 0x6a, 0x69, 0x61, 0x6e, 0x45, 0x6e,
0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02,
0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42,
0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
@ -152,16 +166,18 @@ func file_userexpand_proto_rawDescGZIP() []byte {
return file_userexpand_proto_rawDescData return file_userexpand_proto_rawDescData
} }
var file_userexpand_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_userexpand_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_userexpand_proto_goTypes = []interface{}{ var file_userexpand_proto_goTypes = []interface{}{
(*DBUserExpand)(nil), // 0: DBUserExpand (*DBUserExpand)(nil), // 0: DBUserExpand
nil, // 1: DBUserExpand.TujianEntry
} }
var file_userexpand_proto_depIdxs = []int32{ var file_userexpand_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type 1, // 0: DBUserExpand.tujian:type_name -> DBUserExpand.TujianEntry
0, // [0:0] is the sub-list for method input_type 1, // [1:1] is the sub-list for method output_type
0, // [0:0] is the sub-list for extension type_name 1, // [1:1] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension extendee 1, // [1:1] is the sub-list for extension type_name
0, // [0:0] is the sub-list for field type_name 1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
} }
func init() { file_userexpand_proto_init() } func init() { file_userexpand_proto_init() }
@ -189,7 +205,7 @@ func file_userexpand_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_userexpand_proto_rawDesc, RawDescriptor: file_userexpand_proto_rawDesc,
NumEnums: 0, NumEnums: 0,
NumMessages: 1, NumMessages: 2,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,
}, },