好友协议

This commit is contained in:
zhaocy 2022-06-07 19:45:52 +08:00
parent 1a4aa01d1e
commit c5e99c6604
11 changed files with 1908 additions and 10 deletions

View File

@ -14,11 +14,12 @@ const (
) )
const ( const (
SM_GateModule core.M_Modules = "gateway" //gate模块 网关服务模块 SM_GateModule core.M_Modules = "gateway" //gate模块 网关服务模块
SM_WebModule core.M_Modules = "web" //web模块 SM_WebModule core.M_Modules = "web" //web模块
SM_UserModule core.M_Modules = "user" //用户模块 SM_UserModule core.M_Modules = "user" //用户模块
SM_PackModule core.M_Modules = "pack" //背包模块 SM_PackModule core.M_Modules = "pack" //背包模块
SM_MailModule core.M_Modules = "mail" //邮件模块 SM_MailModule core.M_Modules = "mail" //邮件模块
SM_FriendModule core.M_Modules = "friend" //好友模块
) )
const ( //Rpc const ( //Rpc

View File

@ -0,0 +1,67 @@
package friend
import (
"context"
"go_dreamfactory/comm"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
)
type FriendComp struct {
modules.MComp_GateComp
}
//搜索
func (this *FriendComp) Search(ctx context.Context, session comm.IUserSession, req *pb.FriendSearchReq) error {
return nil
}
//添加好友
func (this *FriendComp) Add(ctx context.Context, session comm.IUserSession, req *pb.FriendAddReq) error {
return nil
}
//删除好友
func (this *FriendComp) Del(ctx context.Context, session comm.IUserSession, req *pb.FriendDelReq) error {
return nil
}
//好友列表
func (this *FriendComp) List(ctx context.Context, session comm.IUserSession, req *pb.FriendListReq) error {
return nil
}
//同意或拒绝
func (this *FriendComp) Check(ctx context.Context, session comm.IUserSession, req *pb.FriendAgreeOrRefuseReq) error {
return nil
}
//批量同意或拒绝
func (this *FriendComp) CheckAll(ctx context.Context, session comm.IUserSession, req *pb.FriendAgreeOrRefuseReq) error {
return nil
}
//赠送或接收
func (this *FriendComp) ReceSend(ctx context.Context, session comm.IUserSession, req *pb.FriendReceiveOrSendReq) error {
return nil
}
//好友数量
func (this *FriendComp) Total(ctx context.Context, session comm.IUserSession, req *pb.FriendTotalReq) error {
return nil
}
//好友详情
func (this *FriendComp) Detail(ctx context.Context, session comm.IUserSession, req *pb.FriendTotalReq) error {
return nil
}
//黑名单
func (this *FriendComp) Blacklist(ctx context.Context, session comm.IUserSession, req *pb.FriendBlackListReq) error {
return nil
}
//加入黑名单
func (this *FriendComp) Addblack(ctx context.Context, session comm.IUserSession, req *pb.FriendBlackAddReq) error {
return nil
}

33
modules/friend/module.go Normal file
View File

@ -0,0 +1,33 @@
package friend
import (
"go_dreamfactory/comm"
"go_dreamfactory/modules"
"github.com/liwei1dao/lego/core"
)
func NewModule() core.IModule {
m := new(Friend)
return m
}
type Friend struct {
modules.ModuleBase
}
func (this *Friend) GetType() core.M_Modules {
return comm.SM_UserModule
}
func (this *Friend) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
err = this.ModuleBase.Init(service, module, options)
return
}
func (this *Friend) OnInstallComp() {
this.ModuleBase.OnInstallComp()
}

146
pb/friend_db.pb.go Normal file
View File

@ -0,0 +1,146 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v3.20.0
// source: friend_db.proto
package pb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
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)
)
type Friend struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
UserData *DB_UserData `protobuf:"bytes,1,opt,name=UserData,proto3" json:"UserData,omitempty"` //用户
}
func (x *Friend) Reset() {
*x = Friend{}
if protoimpl.UnsafeEnabled {
mi := &file_friend_db_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Friend) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Friend) ProtoMessage() {}
func (x *Friend) ProtoReflect() protoreflect.Message {
mi := &file_friend_db_proto_msgTypes[0]
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 Friend.ProtoReflect.Descriptor instead.
func (*Friend) Descriptor() ([]byte, []int) {
return file_friend_db_proto_rawDescGZIP(), []int{0}
}
func (x *Friend) GetUserData() *DB_UserData {
if x != nil {
return x.UserData
}
return nil
}
var File_friend_db_proto protoreflect.FileDescriptor
var file_friend_db_proto_rawDesc = []byte{
0x0a, 0x0f, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x1a, 0x0d, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x22, 0x32, 0x0a, 0x06, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x12, 0x28, 0x0a, 0x08, 0x55, 0x73,
0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x44,
0x42, 0x5f, 0x55, 0x73, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x52, 0x08, 0x55, 0x73, 0x65, 0x72,
0x44, 0x61, 0x74, 0x61, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x33,
}
var (
file_friend_db_proto_rawDescOnce sync.Once
file_friend_db_proto_rawDescData = file_friend_db_proto_rawDesc
)
func file_friend_db_proto_rawDescGZIP() []byte {
file_friend_db_proto_rawDescOnce.Do(func() {
file_friend_db_proto_rawDescData = protoimpl.X.CompressGZIP(file_friend_db_proto_rawDescData)
})
return file_friend_db_proto_rawDescData
}
var file_friend_db_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_friend_db_proto_goTypes = []interface{}{
(*Friend)(nil), // 0: Friend
(*DB_UserData)(nil), // 1: DB_UserData
}
var file_friend_db_proto_depIdxs = []int32{
1, // 0: Friend.UserData:type_name -> DB_UserData
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension 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_friend_db_proto_init() }
func file_friend_db_proto_init() {
if File_friend_db_proto != nil {
return
}
file_user_db_proto_init()
if !protoimpl.UnsafeEnabled {
file_friend_db_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Friend); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_friend_db_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_friend_db_proto_goTypes,
DependencyIndexes: file_friend_db_proto_depIdxs,
MessageInfos: file_friend_db_proto_msgTypes,
}.Build()
File_friend_db_proto = out.File
file_friend_db_proto_rawDesc = nil
file_friend_db_proto_goTypes = nil
file_friend_db_proto_depIdxs = nil
}

1520
pb/friend_msg.pb.go Normal file

File diff suppressed because it is too large Load Diff

View File

@ -80,7 +80,7 @@ type DB_MailData struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
ObjId string `bson:"_id" json:"ObjId,omitempty" protobuf:"bytes,1,opt,name=ObjId,proto3"` // tags:{bson:"_id"} ObjId string `protobuf:"bytes,1,opt,name=ObjId,proto3" json:"ObjId,omitempty" bson:"_id"` // tags:{bson:"_id"}
UserId string `protobuf:"bytes,2,opt,name=UserId,proto3" json:"UserId,omitempty"` UserId string `protobuf:"bytes,2,opt,name=UserId,proto3" json:"UserId,omitempty"`
Title string `protobuf:"bytes,3,opt,name=Title,proto3" json:"Title,omitempty"` // 邮件标题 Title string `protobuf:"bytes,3,opt,name=Title,proto3" json:"Title,omitempty"` // 邮件标题
Contex string `protobuf:"bytes,4,opt,name=Contex,proto3" json:"Contex,omitempty"` // 邮件内容 Contex string `protobuf:"bytes,4,opt,name=Contex,proto3" json:"Contex,omitempty"` // 邮件内容

8
pb/proto/friend_db.proto Normal file
View File

@ -0,0 +1,8 @@
syntax = "proto3";
option go_package = ".;pb";
import "user_db.proto";
message Friend {
DB_UserData UserData = 1;//
//
}

111
pb/proto/friend_msg.proto Normal file
View File

@ -0,0 +1,111 @@
syntax = "proto3";
option go_package = ".;pb";
import "friend_db.proto";
message FriendBase {
string userId = 1; //ID
string NickName = 2; //
int32 level = 3; //
int32 avatar = 4; //
int64 strength = 5; //
int32 serverId = 6;//
int64 offlineTime =7;//线 0线
}
//
message FriendListReq{
}
message FriendListRsp{
repeated Friend list = 1;
}
//
message FriendAddReq{
string friendId = 1; //ID
}
message FriendAddRsp{
string userId = 1; //ID
}
//
message FriendDelReq{
string friendId = 1;//ID
}
message FriendDelRsp{
string friendId = 1;//ID
string userId = 2; //ID
}
//
message FriendAgreeOrRefuseReq{
string friendId = 1; //
bool isAgree = 2;
}
message FriendAgressOrRefuseRsp{
int32 Num = 1;//
bool isAgree = 2;
}
//
message FriendApplyListReq{
}
message FriendApplyListRsp{
}
//
message FriendSearchReq{
string friendId = 1;
string nickName = 2; //
}
message FriendSearchRsp{
repeated FriendBase friends = 1;
}
//
message FriendBlackListReq{
}
message FriendBlackListRsp{
repeated FriendBase friends = 1;
}
//
message FriendBlackAddReq{
string friendId = 1;
}
message FriendBlackAddRsp{
string friendId = 1;
string userId = 2;
}
//
message FriendReceiveOrSendReq{
string friendId = 1;
bool isReceive = 2;
}
message FriendReceiveOrSendRsp{
string friendId = 1;
string userId = 2;
bool isReceive = 3;
}
//
message FriendTotalReq{
string friendId = 1;
}
message FriendTotalRsp{
string friendId = 1;
int32 total = 2; //
}

View File

@ -13,4 +13,5 @@ message DB_UserData {
string NiceName = 3; string NiceName = 3;
int32 ServerId = 4; int32 ServerId = 4;
int32 FriendPoint = 5;// int32 FriendPoint = 5;//
int32 avatar = 6;//
} }

View File

@ -93,6 +93,7 @@ type DB_UserData struct {
NiceName string `protobuf:"bytes,3,opt,name=NiceName,proto3" json:"NiceName,omitempty"` NiceName string `protobuf:"bytes,3,opt,name=NiceName,proto3" json:"NiceName,omitempty"`
ServerId int32 `protobuf:"varint,4,opt,name=ServerId,proto3" json:"ServerId,omitempty"` ServerId int32 `protobuf:"varint,4,opt,name=ServerId,proto3" json:"ServerId,omitempty"`
FriendPoint int32 `protobuf:"varint,5,opt,name=FriendPoint,proto3" json:"FriendPoint,omitempty"` //友情点 FriendPoint int32 `protobuf:"varint,5,opt,name=FriendPoint,proto3" json:"FriendPoint,omitempty"` //友情点
Avatar int32 `protobuf:"varint,6,opt,name=avatar,proto3" json:"avatar,omitempty"` //头像
} }
func (x *DB_UserData) Reset() { func (x *DB_UserData) Reset() {
@ -162,6 +163,13 @@ func (x *DB_UserData) GetFriendPoint() int32 {
return 0 return 0
} }
func (x *DB_UserData) GetAvatar() int32 {
if x != nil {
return x.Avatar
}
return 0
}
var File_user_db_proto protoreflect.FileDescriptor var File_user_db_proto protoreflect.FileDescriptor
var file_user_db_proto_rawDesc = []byte{ var file_user_db_proto_rawDesc = []byte{
@ -174,7 +182,7 @@ var file_user_db_proto_rawDesc = []byte{
0x77, 0x61, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x28, 0x0a, 0x08, 0x77, 0x61, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x28, 0x0a, 0x08,
0x55, 0x73, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x55, 0x73, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c,
0x2e, 0x44, 0x42, 0x5f, 0x55, 0x73, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x52, 0x08, 0x55, 0x73, 0x2e, 0x44, 0x42, 0x5f, 0x55, 0x73, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x52, 0x08, 0x55, 0x73,
0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x22, 0x99, 0x01, 0x0a, 0x0b, 0x44, 0x42, 0x5f, 0x55, 0x73, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x22, 0xb1, 0x01, 0x0a, 0x0b, 0x44, 0x42, 0x5f, 0x55, 0x73,
0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x18, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x18,
0x0a, 0x07, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x07, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
@ -184,8 +192,9 @@ var file_user_db_proto_rawDesc = []byte{
0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64,
0x12, 0x20, 0x0a, 0x0b, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x12, 0x20, 0x0a, 0x0b, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x18,
0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x50, 0x6f, 0x69, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x50, 0x6f, 0x69,
0x6e, 0x74, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x06, 0x20, 0x01,
0x6f, 0x33, 0x28, 0x05, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b,
0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (

View File

@ -33,3 +33,5 @@ buildProto('./pb/proto','./pb','pack_db')
buildProto('./pb/proto','./pb','pack_msg') buildProto('./pb/proto','./pb','pack_msg')
buildProto('./pb/proto','./pb','mail_db') buildProto('./pb/proto','./pb','mail_db')
buildProto('./pb/proto','./pb','mail_msg') buildProto('./pb/proto','./pb','mail_msg')
buildProto('./pb/proto','./pb','friend_db')
buildProto('./pb/proto','./pb','friend_msg')