上传配置

This commit is contained in:
liwei1dao 2023-10-24 18:17:13 +08:00
parent 8e97e8d84e
commit dc1a28339b
5 changed files with 125 additions and 38 deletions

View File

@ -656,4 +656,10 @@ type (
// Gm 调整龙的等级
GMModifyDragonLv(uid string, cid string, lv int32) (dragon *pb.DBDragon, err error)
}
IMainCity interface {
//添加好友
AddFriends(user1 *pb.BaseUserInfo, user2 *pb.BaseUserInfo)
//更新关联用户
UpdateRelatedUser(uid string, users []*pb.BaseUserInfo)
}
)

View File

@ -13,11 +13,18 @@ func (this *apiComp) SynchPosCheck(session comm.IUserSession, req *pb.MainCitySy
// 查看某一封邮件
func (this *apiComp) SynchPos(session comm.IUserSession, req *pb.MainCitySynchPosPeek) (errdata *pb.ErrorData) {
var (
user *pb.DBUser
friends []*pb.BaseUserInfo
groupUser map[string][]*pb.BaseUserInfo = make(map[string][]*pb.BaseUserInfo)
ok bool
err error
)
if user, err = this.module.ModuleUser.GetUser(session.GetUserId()); err != nil {
return
}
self := comm.GetUserBaseInfo(user)
friends = this.module.model.getplayerPos(session.GetUserId())
friends = append(friends, self)
for _, v := range friends {
if _, ok = groupUser[v.Sid]; !ok {
groupUser[v.Sid] = make([]*pb.BaseUserInfo, 0)

View File

@ -31,7 +31,7 @@ func (this *modelComp) Init(service core.IService, module core.IModule, comp cor
func (this *modelComp) setplayerPos(uid string, friends []*pb.BaseUserInfo) {
this.lock.Lock()
this.onlines[uid] = friends
this.onlines[uid] = append(this.onlines[uid], friends...)
this.lock.Unlock()
}
func (this *modelComp) getplayerPos(uid string) (friends []*pb.BaseUserInfo) {

View File

@ -95,6 +95,14 @@ func (this *MainCity) EventUserLogin(session comm.IUserSession) {
func (this *MainCity) EventUserOffline(uid string, sessionid string) {
this.model.removelayerPos(uid)
}
func (this *MainCity) AddFriends(user1 *pb.BaseUserInfo, user2 *pb.BaseUserInfo) {
this.model.setplayerPos(user1.Uid, []*pb.BaseUserInfo{user2})
this.model.setplayerPos(user2.Uid, []*pb.BaseUserInfo{user1})
}
func (this *MainCity) UpdateRelatedUser(uid string, users []*pb.BaseUserInfo) {
this.model.setplayerPos(uid, users)
}
// 向多个用户发送消息
func (this *MainCity) SendMsgToSession(mainType, subType string, msg proto.Message, users map[string][]*pb.BaseUserInfo) (err error) {

View File

@ -23,19 +23,22 @@ const (
type MainCityScene int32
const (
MainCityScene_MainCity MainCityScene = 0 //主城
MainCityScene_WUGUAN MainCityScene = 1 //武馆
MainCityScene_Scene_None MainCityScene = 0
MainCityScene_Scene_MainCity MainCityScene = 1 //主城
MainCityScene_Scene_WUGUAN MainCityScene = 2 //武馆
)
// Enum value maps for MainCityScene.
var (
MainCityScene_name = map[int32]string{
0: "MainCity",
1: "WUGUAN",
0: "Scene_None",
1: "Scene_MainCity",
2: "Scene_WUGUAN",
}
MainCityScene_value = map[string]int32{
"MainCity": 0,
"WUGUAN": 1,
"Scene_None": 0,
"Scene_MainCity": 1,
"Scene_WUGUAN": 2,
}
)
@ -66,6 +69,52 @@ func (MainCityScene) EnumDescriptor() ([]byte, []int) {
return file_maincity_maincity_db_proto_rawDescGZIP(), []int{0}
}
type MainCitySyncType int32
const (
MainCitySyncType_Target MainCitySyncType = 0
MainCitySyncType_Direction MainCitySyncType = 1
)
// Enum value maps for MainCitySyncType.
var (
MainCitySyncType_name = map[int32]string{
0: "Target",
1: "Direction",
}
MainCitySyncType_value = map[string]int32{
"Target": 0,
"Direction": 1,
}
)
func (x MainCitySyncType) Enum() *MainCitySyncType {
p := new(MainCitySyncType)
*p = x
return p
}
func (x MainCitySyncType) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (MainCitySyncType) Descriptor() protoreflect.EnumDescriptor {
return file_maincity_maincity_db_proto_enumTypes[1].Descriptor()
}
func (MainCitySyncType) Type() protoreflect.EnumType {
return &file_maincity_maincity_db_proto_enumTypes[1]
}
func (x MainCitySyncType) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use MainCitySyncType.Descriptor instead.
func (MainCitySyncType) EnumDescriptor() ([]byte, []int) {
return file_maincity_maincity_db_proto_rawDescGZIP(), []int{1}
}
type DBVector3 struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -134,10 +183,11 @@ type DBMainCityPos struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Player *BaseUserInfo `protobuf:"bytes,1,opt,name=player,proto3" json:"player"`
Pos *DBVector3 `protobuf:"bytes,2,opt,name=pos,proto3" json:"pos"`
Target *DBVector3 `protobuf:"bytes,3,opt,name=target,proto3" json:"target"`
Scene MainCityScene `protobuf:"varint,4,opt,name=scene,proto3,enum=MainCityScene" json:"scene"`
Player *BaseUserInfo `protobuf:"bytes,1,opt,name=player,proto3" json:"player"`
Stype MainCitySyncType `protobuf:"varint,2,opt,name=stype,proto3,enum=MainCitySyncType" json:"stype"`
Pos *DBVector3 `protobuf:"bytes,3,opt,name=pos,proto3" json:"pos"`
Target *DBVector3 `protobuf:"bytes,4,opt,name=target,proto3" json:"target"`
Scene MainCityScene `protobuf:"varint,5,opt,name=scene,proto3,enum=MainCityScene" json:"scene"`
}
func (x *DBMainCityPos) Reset() {
@ -179,6 +229,13 @@ func (x *DBMainCityPos) GetPlayer() *BaseUserInfo {
return nil
}
func (x *DBMainCityPos) GetStype() MainCitySyncType {
if x != nil {
return x.Stype
}
return MainCitySyncType_Target
}
func (x *DBMainCityPos) GetPos() *DBVector3 {
if x != nil {
return x.Pos
@ -197,7 +254,7 @@ func (x *DBMainCityPos) GetScene() MainCityScene {
if x != nil {
return x.Scene
}
return MainCityScene_MainCity
return MainCityScene_Scene_None
}
var File_maincity_maincity_db_proto protoreflect.FileDescriptor
@ -209,20 +266,27 @@ var file_maincity_maincity_db_proto_rawDesc = []byte{
0x63, 0x74, 0x6f, 0x72, 0x33, 0x12, 0x0c, 0x0a, 0x01, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x02,
0x52, 0x01, 0x78, 0x12, 0x0c, 0x0a, 0x01, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x02, 0x52, 0x01,
0x79, 0x12, 0x0c, 0x0a, 0x01, 0x7a, 0x18, 0x03, 0x20, 0x01, 0x28, 0x02, 0x52, 0x01, 0x7a, 0x22,
0x9e, 0x01, 0x0a, 0x0d, 0x44, 0x42, 0x4d, 0x61, 0x69, 0x6e, 0x43, 0x69, 0x74, 0x79, 0x50, 0x6f,
0xc7, 0x01, 0x0a, 0x0d, 0x44, 0x42, 0x4d, 0x61, 0x69, 0x6e, 0x43, 0x69, 0x74, 0x79, 0x50, 0x6f,
0x73, 0x12, 0x25, 0x0a, 0x06, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x0d, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f,
0x52, 0x06, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x03, 0x70, 0x6f, 0x73, 0x18,
0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x44, 0x42, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72,
0x33, 0x52, 0x03, 0x70, 0x6f, 0x73, 0x12, 0x22, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74,
0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x44, 0x42, 0x56, 0x65, 0x63, 0x74, 0x6f,
0x72, 0x33, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x24, 0x0a, 0x05, 0x73, 0x63,
0x65, 0x6e, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x4d, 0x61, 0x69, 0x6e,
0x43, 0x69, 0x74, 0x79, 0x53, 0x63, 0x65, 0x6e, 0x65, 0x52, 0x05, 0x73, 0x63, 0x65, 0x6e, 0x65,
0x2a, 0x29, 0x0a, 0x0d, 0x4d, 0x61, 0x69, 0x6e, 0x43, 0x69, 0x74, 0x79, 0x53, 0x63, 0x65, 0x6e,
0x65, 0x12, 0x0c, 0x0a, 0x08, 0x4d, 0x61, 0x69, 0x6e, 0x43, 0x69, 0x74, 0x79, 0x10, 0x00, 0x12,
0x0a, 0x0a, 0x06, 0x57, 0x55, 0x47, 0x55, 0x41, 0x4e, 0x10, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e,
0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x52, 0x06, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x12, 0x27, 0x0a, 0x05, 0x73, 0x74, 0x79, 0x70,
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x4d, 0x61, 0x69, 0x6e, 0x43, 0x69,
0x74, 0x79, 0x53, 0x79, 0x6e, 0x63, 0x54, 0x79, 0x70, 0x65, 0x52, 0x05, 0x73, 0x74, 0x79, 0x70,
0x65, 0x12, 0x1c, 0x0a, 0x03, 0x70, 0x6f, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a,
0x2e, 0x44, 0x42, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x33, 0x52, 0x03, 0x70, 0x6f, 0x73, 0x12,
0x22, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x0a, 0x2e, 0x44, 0x42, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x33, 0x52, 0x06, 0x74, 0x61, 0x72,
0x67, 0x65, 0x74, 0x12, 0x24, 0x0a, 0x05, 0x73, 0x63, 0x65, 0x6e, 0x65, 0x18, 0x05, 0x20, 0x01,
0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x4d, 0x61, 0x69, 0x6e, 0x43, 0x69, 0x74, 0x79, 0x53, 0x63, 0x65,
0x6e, 0x65, 0x52, 0x05, 0x73, 0x63, 0x65, 0x6e, 0x65, 0x2a, 0x45, 0x0a, 0x0d, 0x4d, 0x61, 0x69,
0x6e, 0x43, 0x69, 0x74, 0x79, 0x53, 0x63, 0x65, 0x6e, 0x65, 0x12, 0x0e, 0x0a, 0x0a, 0x53, 0x63,
0x65, 0x6e, 0x65, 0x5f, 0x4e, 0x6f, 0x6e, 0x65, 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0e, 0x53, 0x63,
0x65, 0x6e, 0x65, 0x5f, 0x4d, 0x61, 0x69, 0x6e, 0x43, 0x69, 0x74, 0x79, 0x10, 0x01, 0x12, 0x10,
0x0a, 0x0c, 0x53, 0x63, 0x65, 0x6e, 0x65, 0x5f, 0x57, 0x55, 0x47, 0x55, 0x41, 0x4e, 0x10, 0x02,
0x2a, 0x2d, 0x0a, 0x10, 0x4d, 0x61, 0x69, 0x6e, 0x43, 0x69, 0x74, 0x79, 0x53, 0x79, 0x6e, 0x63,
0x54, 0x79, 0x70, 0x65, 0x12, 0x0a, 0x0a, 0x06, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x10, 0x00,
0x12, 0x0d, 0x0a, 0x09, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x01, 0x42,
0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -237,24 +301,26 @@ func file_maincity_maincity_db_proto_rawDescGZIP() []byte {
return file_maincity_maincity_db_proto_rawDescData
}
var file_maincity_maincity_db_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_maincity_maincity_db_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
var file_maincity_maincity_db_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_maincity_maincity_db_proto_goTypes = []interface{}{
(MainCityScene)(0), // 0: MainCityScene
(*DBVector3)(nil), // 1: DBVector3
(*DBMainCityPos)(nil), // 2: DBMainCityPos
(*BaseUserInfo)(nil), // 3: BaseUserInfo
(MainCitySyncType)(0), // 1: MainCitySyncType
(*DBVector3)(nil), // 2: DBVector3
(*DBMainCityPos)(nil), // 3: DBMainCityPos
(*BaseUserInfo)(nil), // 4: BaseUserInfo
}
var file_maincity_maincity_db_proto_depIdxs = []int32{
3, // 0: DBMainCityPos.player:type_name -> BaseUserInfo
1, // 1: DBMainCityPos.pos:type_name -> DBVector3
1, // 2: DBMainCityPos.target:type_name -> DBVector3
0, // 3: DBMainCityPos.scene:type_name -> MainCityScene
4, // [4:4] is the sub-list for method output_type
4, // [4:4] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension type_name
4, // [4:4] is the sub-list for extension extendee
0, // [0:4] is the sub-list for field type_name
4, // 0: DBMainCityPos.player:type_name -> BaseUserInfo
1, // 1: DBMainCityPos.stype:type_name -> MainCitySyncType
2, // 2: DBMainCityPos.pos:type_name -> DBVector3
2, // 3: DBMainCityPos.target:type_name -> DBVector3
0, // 4: DBMainCityPos.scene:type_name -> MainCityScene
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 extension type_name
5, // [5:5] is the sub-list for extension extendee
0, // [0:5] is the sub-list for field type_name
}
func init() { file_maincity_maincity_db_proto_init() }
@ -294,7 +360,7 @@ func file_maincity_maincity_db_proto_init() {
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_maincity_maincity_db_proto_rawDesc,
NumEnums: 1,
NumEnums: 2,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,