From 765d9ce83378729ae773cb99aeb705d5863f45bf Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Tue, 18 Oct 2022 12:05:45 +0800 Subject: [PATCH] =?UTF-8?q?=E9=93=81=E5=8C=A0=E9=93=BA=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=9C=A8=E7=BA=BF=E7=8E=A9=E5=AE=B6=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/gourmet/api.go | 1 + modules/gourmet/api_getranduser.go | 63 +++++++++ modules/hero/hero_test.go | 6 +- modules/smithy/api_getranduser.go | 41 ++++-- pb/gourmet_msg.pb.go | 205 +++++++++++++++++++++++------ pb/smithy_msg.pb.go | 93 +++++++------ 6 files changed, 323 insertions(+), 86 deletions(-) create mode 100644 modules/gourmet/api_getranduser.go diff --git a/modules/gourmet/api.go b/modules/gourmet/api.go index 911595587..2e07071d9 100644 --- a/modules/gourmet/api.go +++ b/modules/gourmet/api.go @@ -10,6 +10,7 @@ const ( GourmetCreateOrderResp = "createorder" GourmetSkillLvResp = "skilllv" GourmetGetRewardResp = "getreward" + GourmetGetRandUserResp = "getranduser" ) type apiComp struct { diff --git a/modules/gourmet/api_getranduser.go b/modules/gourmet/api_getranduser.go new file mode 100644 index 000000000..ad48dba38 --- /dev/null +++ b/modules/gourmet/api_getranduser.go @@ -0,0 +1,63 @@ +package gourmet + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/pb" + "go_dreamfactory/utils" + + "google.golang.org/protobuf/proto" +) + +//参数校验 +func (this *apiComp) GetRandUserCheck(session comm.IUserSession, req *pb.GourmetGetRandUserReq) (code pb.ErrorCode) { + if req.People <= 0 { + code = pb.ErrorCode_ReqParameterError + return + } + return +} + +/// 获取一些玩家数据 +func (this *apiComp) GetRandUser(session comm.IUserSession, req *pb.GourmetGetRandUserReq) (code pb.ErrorCode, data proto.Message) { + var ( + szDbUser []*pb.DBUser + randOnlineUsers []string + ) + code = this.GetRandUserCheck(session, req) + if code != pb.ErrorCode_Success { + return // 参数校验失败直接返回 + } + // 获取在线玩家信息 + onlineList, err := this.module.ModuleUser.UserOnlineList() + if err != nil { + code = pb.ErrorCode_DBError + return + } + + var szUid []string + for _, v := range onlineList { + if v.Uid == session.GetUserId() { // 过滤自己信息 + continue + } + + szUid = append(szUid, v.Uid) + } + // 随机在线玩家信息 + if len(onlineList) > int(req.People) { + randArr := utils.Numbers(0, len(onlineList), int(req.People)) + for _, v := range randArr { + if szUid[v] != "" { + randOnlineUsers = append(randOnlineUsers, szUid[v]) + } + } + } else { // 数量不足 则有多少给多少 + for _, v := range szUid { + randOnlineUsers = append(randOnlineUsers, v) + } + } + for _, v := range randOnlineUsers { + szDbUser = append(szDbUser, this.module.ModuleUser.GetUser(v)) // 转成user对象 + } + session.SendMsg(string(this.module.GetType()), GourmetGetRandUserResp, &pb.GourmetGetRandUserResp{User: szDbUser}) + return +} diff --git a/modules/hero/hero_test.go b/modules/hero/hero_test.go index 86084e2ec..663fbb5aa 100644 --- a/modules/hero/hero_test.go +++ b/modules/hero/hero_test.go @@ -17,6 +17,7 @@ import ( "go_dreamfactory/services" "go_dreamfactory/sys/configure" "go_dreamfactory/sys/db" + "go_dreamfactory/utils" "reflect" "strings" "testing" @@ -59,7 +60,10 @@ func (this *TestService) InitSys() { } func Test_Main(t *testing.T) { - + ids := utils.Numbers(0, 10, 5) + for _, v := range ids { + fmt.Printf("%d", v) + } oldHero := new(pb.DBHero) oldHero.Lv = 2 new := copyPoint(oldHero) diff --git a/modules/smithy/api_getranduser.go b/modules/smithy/api_getranduser.go index 7840b5947..3f2ddb9f7 100644 --- a/modules/smithy/api_getranduser.go +++ b/modules/smithy/api_getranduser.go @@ -10,31 +10,54 @@ import ( //参数校验 func (this *apiComp) GetRandUserCheck(session comm.IUserSession, req *pb.SmithyGetRandUserReq) (code pb.ErrorCode) { - + if req.People <= 0 { + code = pb.ErrorCode_ReqParameterError + return + } return } /// 获取一些玩家数据 func (this *apiComp) GetRandUser(session comm.IUserSession, req *pb.SmithyGetRandUserReq) (code pb.ErrorCode, data proto.Message) { - + var ( + szDbUser []*pb.DBUser + randOnlineUsers []string + ) code = this.GetRandUserCheck(session, req) if code != pb.ErrorCode_Success { return // 参数校验失败直接返回 } - cu, err := this.module.ModuleUser.UserOnlineList() + // 获取在线玩家信息 + onlineList, err := this.module.ModuleUser.UserOnlineList() if err != nil { code = pb.ErrorCode_DBError return } - var randOnlineUsers []string - if len(cu) > 5 { - randArr := utils.Numbers(0, len(cu), 5) + + var szUid []string + for _, v := range onlineList { + if v.Uid == session.GetUserId() { // 过滤自己信息 + continue + } + + szUid = append(szUid, v.Uid) + } + // 随机在线玩家信息 + if len(onlineList) > int(req.People) { + randArr := utils.Numbers(0, len(onlineList), int(req.People)) for _, v := range randArr { - if cu[v] != nil { - randOnlineUsers = append(randOnlineUsers, cu[v].Uid) + if szUid[v] != "" { + randOnlineUsers = append(randOnlineUsers, szUid[v]) } } + } else { // 数量不足 则有多少给多少 + for _, v := range szUid { + randOnlineUsers = append(randOnlineUsers, v) + } } - session.SendMsg(string(this.module.GetType()), SmithyGetRandUserResp, &pb.SmithyGetRandUserResp{User: randOnlineUsers}) + for _, v := range randOnlineUsers { + szDbUser = append(szDbUser, this.module.ModuleUser.GetUser(v)) // 转成user对象 + } + session.SendMsg(string(this.module.GetType()), SmithyGetRandUserResp, &pb.SmithyGetRandUserResp{User: szDbUser}) return } diff --git a/pb/gourmet_msg.pb.go b/pb/gourmet_msg.pb.go index ca021a38b..af8c6b20f 100644 --- a/pb/gourmet_msg.pb.go +++ b/pb/gourmet_msg.pb.go @@ -383,37 +383,139 @@ func (x *GourmetSkillLvResp) GetData() *DBGourmet { return nil } +type GourmetGetRandUserReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + People int32 `protobuf:"varint,1,opt,name=people,proto3" json:"people"` //人数 +} + +func (x *GourmetGetRandUserReq) Reset() { + *x = GourmetGetRandUserReq{} + if protoimpl.UnsafeEnabled { + mi := &file_gourmet_gourmet_msg_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GourmetGetRandUserReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GourmetGetRandUserReq) ProtoMessage() {} + +func (x *GourmetGetRandUserReq) ProtoReflect() protoreflect.Message { + mi := &file_gourmet_gourmet_msg_proto_msgTypes[8] + 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 GourmetGetRandUserReq.ProtoReflect.Descriptor instead. +func (*GourmetGetRandUserReq) Descriptor() ([]byte, []int) { + return file_gourmet_gourmet_msg_proto_rawDescGZIP(), []int{8} +} + +func (x *GourmetGetRandUserReq) GetPeople() int32 { + if x != nil { + return x.People + } + return 0 +} + +type GourmetGetRandUserResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + User []*DBUser `protobuf:"bytes,1,rep,name=user,proto3" json:"user"` +} + +func (x *GourmetGetRandUserResp) Reset() { + *x = GourmetGetRandUserResp{} + if protoimpl.UnsafeEnabled { + mi := &file_gourmet_gourmet_msg_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GourmetGetRandUserResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GourmetGetRandUserResp) ProtoMessage() {} + +func (x *GourmetGetRandUserResp) ProtoReflect() protoreflect.Message { + mi := &file_gourmet_gourmet_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 GourmetGetRandUserResp.ProtoReflect.Descriptor instead. +func (*GourmetGetRandUserResp) Descriptor() ([]byte, []int) { + return file_gourmet_gourmet_msg_proto_rawDescGZIP(), []int{9} +} + +func (x *GourmetGetRandUserResp) GetUser() []*DBUser { + if x != nil { + return x.User + } + return nil +} + var File_gourmet_gourmet_msg_proto protoreflect.FileDescriptor var file_gourmet_gourmet_msg_proto_rawDesc = []byte{ 0x0a, 0x19, 0x67, 0x6f, 0x75, 0x72, 0x6d, 0x65, 0x74, 0x2f, 0x67, 0x6f, 0x75, 0x72, 0x6d, 0x65, 0x74, 0x5f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x67, 0x6f, 0x75, 0x72, 0x6d, 0x65, 0x74, 0x2f, 0x67, 0x6f, 0x75, 0x72, 0x6d, 0x65, 0x74, 0x5f, 0x64, 0x62, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x13, 0x0a, 0x11, 0x47, 0x6f, 0x75, 0x72, 0x6d, 0x65, 0x74, - 0x47, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x22, 0x34, 0x0a, 0x12, 0x47, 0x6f, - 0x75, 0x72, 0x6d, 0x65, 0x74, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, - 0x12, 0x1e, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, - 0x2e, 0x44, 0x42, 0x47, 0x6f, 0x75, 0x72, 0x6d, 0x65, 0x74, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, - 0x22, 0x39, 0x0a, 0x15, 0x47, 0x6f, 0x75, 0x72, 0x6d, 0x65, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, - 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x12, 0x20, 0x0a, 0x05, 0x6f, 0x72, 0x64, - 0x65, 0x72, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, - 0x43, 0x6f, 0x6f, 0x6b, 0x52, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x22, 0x38, 0x0a, 0x16, 0x47, - 0x6f, 0x75, 0x72, 0x6d, 0x65, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x64, 0x65, - 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x44, 0x42, 0x47, 0x6f, 0x75, 0x72, 0x6d, 0x65, 0x74, 0x52, - 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x15, 0x0a, 0x13, 0x47, 0x6f, 0x75, 0x72, 0x6d, 0x65, 0x74, - 0x47, 0x65, 0x74, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x71, 0x22, 0x36, 0x0a, 0x14, - 0x47, 0x6f, 0x75, 0x72, 0x6d, 0x65, 0x74, 0x47, 0x65, 0x74, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x12, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x75, 0x73, 0x65, 0x72, + 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x13, 0x0a, 0x11, 0x47, 0x6f, 0x75, + 0x72, 0x6d, 0x65, 0x74, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x22, 0x34, + 0x0a, 0x12, 0x47, 0x6f, 0x75, 0x72, 0x6d, 0x65, 0x74, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x44, 0x42, 0x47, 0x6f, 0x75, 0x72, 0x6d, 0x65, 0x74, 0x52, 0x04, - 0x64, 0x61, 0x74, 0x61, 0x22, 0x31, 0x0a, 0x11, 0x47, 0x6f, 0x75, 0x72, 0x6d, 0x65, 0x74, 0x53, - 0x6b, 0x69, 0x6c, 0x6c, 0x4c, 0x76, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x6b, 0x69, - 0x6c, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x73, 0x6b, - 0x69, 0x6c, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x22, 0x34, 0x0a, 0x12, 0x47, 0x6f, 0x75, 0x72, 0x6d, - 0x65, 0x74, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x4c, 0x76, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, 0x0a, - 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x44, 0x42, - 0x47, 0x6f, 0x75, 0x72, 0x6d, 0x65, 0x74, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x42, 0x06, 0x5a, - 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x64, 0x61, 0x74, 0x61, 0x22, 0x39, 0x0a, 0x15, 0x47, 0x6f, 0x75, 0x72, 0x6d, 0x65, 0x74, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x12, 0x20, 0x0a, + 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x4f, + 0x72, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6f, 0x6b, 0x52, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x22, + 0x38, 0x0a, 0x16, 0x47, 0x6f, 0x75, 0x72, 0x6d, 0x65, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, 0x0a, 0x04, 0x64, 0x61, 0x74, + 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x44, 0x42, 0x47, 0x6f, 0x75, 0x72, + 0x6d, 0x65, 0x74, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x15, 0x0a, 0x13, 0x47, 0x6f, 0x75, + 0x72, 0x6d, 0x65, 0x74, 0x47, 0x65, 0x74, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x71, + 0x22, 0x36, 0x0a, 0x14, 0x47, 0x6f, 0x75, 0x72, 0x6d, 0x65, 0x74, 0x47, 0x65, 0x74, 0x52, 0x65, + 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x44, 0x42, 0x47, 0x6f, 0x75, 0x72, 0x6d, + 0x65, 0x74, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x31, 0x0a, 0x11, 0x47, 0x6f, 0x75, 0x72, + 0x6d, 0x65, 0x74, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x4c, 0x76, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, + 0x09, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x09, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x22, 0x34, 0x0a, 0x12, 0x47, + 0x6f, 0x75, 0x72, 0x6d, 0x65, 0x74, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x4c, 0x76, 0x52, 0x65, 0x73, + 0x70, 0x12, 0x1e, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x0a, 0x2e, 0x44, 0x42, 0x47, 0x6f, 0x75, 0x72, 0x6d, 0x65, 0x74, 0x52, 0x04, 0x64, 0x61, 0x74, + 0x61, 0x22, 0x2f, 0x0a, 0x15, 0x47, 0x6f, 0x75, 0x72, 0x6d, 0x65, 0x74, 0x47, 0x65, 0x74, 0x52, + 0x61, 0x6e, 0x64, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x65, + 0x6f, 0x70, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x70, 0x65, 0x6f, 0x70, + 0x6c, 0x65, 0x22, 0x35, 0x0a, 0x16, 0x47, 0x6f, 0x75, 0x72, 0x6d, 0x65, 0x74, 0x47, 0x65, 0x74, + 0x52, 0x61, 0x6e, 0x64, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1b, 0x0a, 0x04, + 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x44, 0x42, 0x55, + 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, + 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -428,7 +530,7 @@ func file_gourmet_gourmet_msg_proto_rawDescGZIP() []byte { return file_gourmet_gourmet_msg_proto_rawDescData } -var file_gourmet_gourmet_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_gourmet_gourmet_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 10) var file_gourmet_gourmet_msg_proto_goTypes = []interface{}{ (*GourmetGetListReq)(nil), // 0: GourmetGetListReq (*GourmetGetListResp)(nil), // 1: GourmetGetListResp @@ -438,20 +540,24 @@ var file_gourmet_gourmet_msg_proto_goTypes = []interface{}{ (*GourmetGetRewardResp)(nil), // 5: GourmetGetRewardResp (*GourmetSkillLvReq)(nil), // 6: GourmetSkillLvReq (*GourmetSkillLvResp)(nil), // 7: GourmetSkillLvResp - (*DBGourmet)(nil), // 8: DBGourmet - (*OrderCook)(nil), // 9: OrderCook + (*GourmetGetRandUserReq)(nil), // 8: GourmetGetRandUserReq + (*GourmetGetRandUserResp)(nil), // 9: GourmetGetRandUserResp + (*DBGourmet)(nil), // 10: DBGourmet + (*OrderCook)(nil), // 11: OrderCook + (*DBUser)(nil), // 12: DBUser } var file_gourmet_gourmet_msg_proto_depIdxs = []int32{ - 8, // 0: GourmetGetListResp.data:type_name -> DBGourmet - 9, // 1: GourmetCreateOrderReq.order:type_name -> OrderCook - 8, // 2: GourmetCreateOrderResp.data:type_name -> DBGourmet - 8, // 3: GourmetGetRewardResp.data:type_name -> DBGourmet - 8, // 4: GourmetSkillLvResp.data:type_name -> DBGourmet - 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 + 10, // 0: GourmetGetListResp.data:type_name -> DBGourmet + 11, // 1: GourmetCreateOrderReq.order:type_name -> OrderCook + 10, // 2: GourmetCreateOrderResp.data:type_name -> DBGourmet + 10, // 3: GourmetGetRewardResp.data:type_name -> DBGourmet + 10, // 4: GourmetSkillLvResp.data:type_name -> DBGourmet + 12, // 5: GourmetGetRandUserResp.user:type_name -> DBUser + 6, // [6:6] is the sub-list for method output_type + 6, // [6:6] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name } func init() { file_gourmet_gourmet_msg_proto_init() } @@ -460,6 +566,7 @@ func file_gourmet_gourmet_msg_proto_init() { return } file_gourmet_gourmet_db_proto_init() + file_user_user_db_proto_init() if !protoimpl.UnsafeEnabled { file_gourmet_gourmet_msg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GourmetGetListReq); i { @@ -557,6 +664,30 @@ func file_gourmet_gourmet_msg_proto_init() { return nil } } + file_gourmet_gourmet_msg_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GourmetGetRandUserReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_gourmet_gourmet_msg_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GourmetGetRandUserResp); 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{ @@ -564,7 +695,7 @@ func file_gourmet_gourmet_msg_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_gourmet_gourmet_msg_proto_rawDesc, NumEnums: 0, - NumMessages: 8, + NumMessages: 10, NumExtensions: 0, NumServices: 0, }, diff --git a/pb/smithy_msg.pb.go b/pb/smithy_msg.pb.go index 668b38508..eea3ee1fa 100644 --- a/pb/smithy_msg.pb.go +++ b/pb/smithy_msg.pb.go @@ -473,6 +473,8 @@ type SmithyGetRandUserReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + People int32 `protobuf:"varint,1,opt,name=people,proto3" json:"people"` //人数 } func (x *SmithyGetRandUserReq) Reset() { @@ -507,12 +509,19 @@ func (*SmithyGetRandUserReq) Descriptor() ([]byte, []int) { return file_smithy_smithy_msg_proto_rawDescGZIP(), []int{10} } +func (x *SmithyGetRandUserReq) GetPeople() int32 { + if x != nil { + return x.People + } + return 0 +} + type SmithyGetRandUserResp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - User []string `protobuf:"bytes,1,rep,name=user,proto3" json:"user"` + User []*DBUser `protobuf:"bytes,1,rep,name=user,proto3" json:"user"` } func (x *SmithyGetRandUserResp) Reset() { @@ -547,7 +556,7 @@ func (*SmithyGetRandUserResp) Descriptor() ([]byte, []int) { return file_smithy_smithy_msg_proto_rawDescGZIP(), []int{11} } -func (x *SmithyGetRandUserResp) GetUser() []string { +func (x *SmithyGetRandUserResp) GetUser() []*DBUser { if x != nil { return x.User } @@ -560,40 +569,43 @@ var file_smithy_smithy_msg_proto_rawDesc = []byte{ 0x0a, 0x17, 0x73, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x2f, 0x73, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x5f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x16, 0x73, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x2f, 0x73, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x22, 0x12, 0x0a, 0x10, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x47, 0x65, 0x74, 0x4c, 0x69, - 0x73, 0x74, 0x52, 0x65, 0x71, 0x22, 0x32, 0x0a, 0x11, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x47, - 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x04, 0x64, 0x61, - 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x44, 0x42, 0x53, 0x6d, 0x69, - 0x74, 0x68, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x39, 0x0a, 0x14, 0x53, 0x6d, 0x69, - 0x74, 0x68, 0x79, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, - 0x71, 0x12, 0x21, 0x0a, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x0b, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x43, 0x6c, 0x61, 0x6e, 0x67, 0x52, 0x05, 0x6f, - 0x72, 0x64, 0x65, 0x72, 0x22, 0x36, 0x0a, 0x15, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, + 0x6f, 0x1a, 0x12, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x64, 0x62, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x12, 0x0a, 0x10, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x47, + 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x22, 0x32, 0x0a, 0x11, 0x53, 0x6d, 0x69, + 0x74, 0x68, 0x79, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, + 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x44, + 0x42, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x39, 0x0a, + 0x14, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x64, + 0x65, 0x72, 0x52, 0x65, 0x71, 0x12, 0x21, 0x0a, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x43, 0x6c, 0x61, 0x6e, + 0x67, 0x52, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x22, 0x36, 0x0a, 0x15, 0x53, 0x6d, 0x69, 0x74, + 0x68, 0x79, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, + 0x70, 0x12, 0x1d, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x09, 0x2e, 0x44, 0x42, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, + 0x22, 0x14, 0x0a, 0x12, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x47, 0x65, 0x74, 0x52, 0x65, 0x77, + 0x61, 0x72, 0x64, 0x52, 0x65, 0x71, 0x22, 0x34, 0x0a, 0x13, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, + 0x47, 0x65, 0x74, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x44, 0x42, - 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x14, 0x0a, 0x12, - 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x47, 0x65, 0x74, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, - 0x65, 0x71, 0x22, 0x34, 0x0a, 0x13, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x47, 0x65, 0x74, 0x52, - 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x04, 0x64, 0x61, 0x74, - 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x44, 0x42, 0x53, 0x6d, 0x69, 0x74, - 0x68, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x32, 0x0a, 0x14, 0x53, 0x6d, 0x69, 0x74, - 0x68, 0x79, 0x44, 0x65, 0x73, 0x6b, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x4c, 0x76, 0x52, 0x65, 0x71, - 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x08, 0x64, 0x65, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x22, 0x36, 0x0a, 0x15, + 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x32, 0x0a, 0x14, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x44, 0x65, 0x73, 0x6b, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x4c, - 0x76, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x44, 0x42, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x52, 0x04, - 0x64, 0x61, 0x74, 0x61, 0x22, 0x17, 0x0a, 0x15, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x53, 0x74, - 0x6f, 0x76, 0x65, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x4c, 0x76, 0x52, 0x65, 0x71, 0x22, 0x37, 0x0a, - 0x16, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x53, 0x74, 0x6f, 0x76, 0x65, 0x53, 0x6b, 0x69, 0x6c, - 0x6c, 0x4c, 0x76, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x44, 0x42, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, - 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x16, 0x0a, 0x14, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, - 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x64, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x22, 0x2b, - 0x0a, 0x15, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x64, 0x55, - 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x42, 0x06, 0x5a, 0x04, 0x2e, - 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x76, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x64, 0x65, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, + 0x22, 0x36, 0x0a, 0x15, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x44, 0x65, 0x73, 0x6b, 0x53, 0x6b, + 0x69, 0x6c, 0x6c, 0x4c, 0x76, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x04, 0x64, 0x61, 0x74, + 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x44, 0x42, 0x53, 0x6d, 0x69, 0x74, + 0x68, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x17, 0x0a, 0x15, 0x53, 0x6d, 0x69, 0x74, + 0x68, 0x79, 0x53, 0x74, 0x6f, 0x76, 0x65, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x4c, 0x76, 0x52, 0x65, + 0x71, 0x22, 0x37, 0x0a, 0x16, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x53, 0x74, 0x6f, 0x76, 0x65, + 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x4c, 0x76, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x04, 0x64, + 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x44, 0x42, 0x53, 0x6d, + 0x69, 0x74, 0x68, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x2e, 0x0a, 0x14, 0x53, 0x6d, + 0x69, 0x74, 0x68, 0x79, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x64, 0x55, 0x73, 0x65, 0x72, 0x52, + 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x65, 0x6f, 0x70, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x06, 0x70, 0x65, 0x6f, 0x70, 0x6c, 0x65, 0x22, 0x34, 0x0a, 0x15, 0x53, 0x6d, + 0x69, 0x74, 0x68, 0x79, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x64, 0x55, 0x73, 0x65, 0x72, 0x52, + 0x65, 0x73, 0x70, 0x12, 0x1b, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x07, 0x2e, 0x44, 0x42, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, + 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -624,6 +636,7 @@ var file_smithy_smithy_msg_proto_goTypes = []interface{}{ (*SmithyGetRandUserResp)(nil), // 11: SmithyGetRandUserResp (*DBSmithy)(nil), // 12: DBSmithy (*OrderClang)(nil), // 13: OrderClang + (*DBUser)(nil), // 14: DBUser } var file_smithy_smithy_msg_proto_depIdxs = []int32{ 12, // 0: SmithyGetListResp.data:type_name -> DBSmithy @@ -632,11 +645,12 @@ var file_smithy_smithy_msg_proto_depIdxs = []int32{ 12, // 3: SmithyGetRewardResp.data:type_name -> DBSmithy 12, // 4: SmithyDeskSkillLvResp.data:type_name -> DBSmithy 12, // 5: SmithyStoveSkillLvResp.data:type_name -> DBSmithy - 6, // [6:6] is the sub-list for method output_type - 6, // [6:6] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name + 14, // 6: SmithyGetRandUserResp.user:type_name -> DBUser + 7, // [7:7] is the sub-list for method output_type + 7, // [7:7] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name } func init() { file_smithy_smithy_msg_proto_init() } @@ -645,6 +659,7 @@ func file_smithy_smithy_msg_proto_init() { return } file_smithy_smithy_db_proto_init() + file_user_user_db_proto_init() if !protoimpl.UnsafeEnabled { file_smithy_smithy_msg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SmithyGetListReq); i {