铁匠铺获取在线玩家数据

This commit is contained in:
meixiongfeng 2022-10-18 12:05:45 +08:00
parent f3c8c8f52c
commit 765d9ce833
6 changed files with 323 additions and 86 deletions

View File

@ -10,6 +10,7 @@ const (
GourmetCreateOrderResp = "createorder" GourmetCreateOrderResp = "createorder"
GourmetSkillLvResp = "skilllv" GourmetSkillLvResp = "skilllv"
GourmetGetRewardResp = "getreward" GourmetGetRewardResp = "getreward"
GourmetGetRandUserResp = "getranduser"
) )
type apiComp struct { type apiComp struct {

View File

@ -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
}

View File

@ -17,6 +17,7 @@ import (
"go_dreamfactory/services" "go_dreamfactory/services"
"go_dreamfactory/sys/configure" "go_dreamfactory/sys/configure"
"go_dreamfactory/sys/db" "go_dreamfactory/sys/db"
"go_dreamfactory/utils"
"reflect" "reflect"
"strings" "strings"
"testing" "testing"
@ -59,7 +60,10 @@ func (this *TestService) InitSys() {
} }
func Test_Main(t *testing.T) { 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 := new(pb.DBHero)
oldHero.Lv = 2 oldHero.Lv = 2
new := copyPoint(oldHero) new := copyPoint(oldHero)

View File

@ -10,31 +10,54 @@ import (
//参数校验 //参数校验
func (this *apiComp) GetRandUserCheck(session comm.IUserSession, req *pb.SmithyGetRandUserReq) (code pb.ErrorCode) { func (this *apiComp) GetRandUserCheck(session comm.IUserSession, req *pb.SmithyGetRandUserReq) (code pb.ErrorCode) {
if req.People <= 0 {
code = pb.ErrorCode_ReqParameterError
return
}
return return
} }
/// 获取一些玩家数据 /// 获取一些玩家数据
func (this *apiComp) GetRandUser(session comm.IUserSession, req *pb.SmithyGetRandUserReq) (code pb.ErrorCode, data proto.Message) { 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) code = this.GetRandUserCheck(session, req)
if code != pb.ErrorCode_Success { if code != pb.ErrorCode_Success {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
cu, err := this.module.ModuleUser.UserOnlineList() // 获取在线玩家信息
onlineList, err := this.module.ModuleUser.UserOnlineList()
if err != nil { if err != nil {
code = pb.ErrorCode_DBError code = pb.ErrorCode_DBError
return return
} }
var randOnlineUsers []string
if len(cu) > 5 { var szUid []string
randArr := utils.Numbers(0, len(cu), 5) 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 { for _, v := range randArr {
if cu[v] != nil { if szUid[v] != "" {
randOnlineUsers = append(randOnlineUsers, cu[v].Uid) 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 return
} }

View File

@ -383,37 +383,139 @@ func (x *GourmetSkillLvResp) GetData() *DBGourmet {
return nil 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 protoreflect.FileDescriptor
var file_gourmet_gourmet_msg_proto_rawDesc = []byte{ var file_gourmet_gourmet_msg_proto_rawDesc = []byte{
0x0a, 0x19, 0x67, 0x6f, 0x75, 0x72, 0x6d, 0x65, 0x74, 0x2f, 0x67, 0x6f, 0x75, 0x72, 0x6d, 0x65, 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, 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, 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, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x12, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x75, 0x73, 0x65, 0x72,
0x47, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x22, 0x34, 0x0a, 0x12, 0x47, 0x6f, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x13, 0x0a, 0x11, 0x47, 0x6f, 0x75,
0x75, 0x72, 0x6d, 0x65, 0x74, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x72, 0x6d, 0x65, 0x74, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x22, 0x34,
0x12, 0x1e, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x0a, 0x12, 0x47, 0x6f, 0x75, 0x72, 0x6d, 0x65, 0x74, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74,
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,
0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 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, 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, 0x64, 0x61, 0x74, 0x61, 0x22, 0x39, 0x0a, 0x15, 0x47, 0x6f, 0x75, 0x72, 0x6d, 0x65, 0x74, 0x43,
0x6b, 0x69, 0x6c, 0x6c, 0x4c, 0x76, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x6b, 0x69, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x12, 0x20, 0x0a,
0x6c, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x73, 0x6b, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x4f,
0x69, 0x6c, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x22, 0x34, 0x0a, 0x12, 0x47, 0x6f, 0x75, 0x72, 0x6d, 0x72, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6f, 0x6b, 0x52, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x22,
0x65, 0x74, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x4c, 0x76, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, 0x0a, 0x38, 0x0a, 0x16, 0x47, 0x6f, 0x75, 0x72, 0x6d, 0x65, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,
0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x44, 0x42, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, 0x0a, 0x04, 0x64, 0x61, 0x74,
0x47, 0x6f, 0x75, 0x72, 0x6d, 0x65, 0x74, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x42, 0x06, 0x5a, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x44, 0x42, 0x47, 0x6f, 0x75, 0x72,
0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 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 ( var (
@ -428,7 +530,7 @@ func file_gourmet_gourmet_msg_proto_rawDescGZIP() []byte {
return file_gourmet_gourmet_msg_proto_rawDescData 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{}{ var file_gourmet_gourmet_msg_proto_goTypes = []interface{}{
(*GourmetGetListReq)(nil), // 0: GourmetGetListReq (*GourmetGetListReq)(nil), // 0: GourmetGetListReq
(*GourmetGetListResp)(nil), // 1: GourmetGetListResp (*GourmetGetListResp)(nil), // 1: GourmetGetListResp
@ -438,20 +540,24 @@ var file_gourmet_gourmet_msg_proto_goTypes = []interface{}{
(*GourmetGetRewardResp)(nil), // 5: GourmetGetRewardResp (*GourmetGetRewardResp)(nil), // 5: GourmetGetRewardResp
(*GourmetSkillLvReq)(nil), // 6: GourmetSkillLvReq (*GourmetSkillLvReq)(nil), // 6: GourmetSkillLvReq
(*GourmetSkillLvResp)(nil), // 7: GourmetSkillLvResp (*GourmetSkillLvResp)(nil), // 7: GourmetSkillLvResp
(*DBGourmet)(nil), // 8: DBGourmet (*GourmetGetRandUserReq)(nil), // 8: GourmetGetRandUserReq
(*OrderCook)(nil), // 9: OrderCook (*GourmetGetRandUserResp)(nil), // 9: GourmetGetRandUserResp
(*DBGourmet)(nil), // 10: DBGourmet
(*OrderCook)(nil), // 11: OrderCook
(*DBUser)(nil), // 12: DBUser
} }
var file_gourmet_gourmet_msg_proto_depIdxs = []int32{ var file_gourmet_gourmet_msg_proto_depIdxs = []int32{
8, // 0: GourmetGetListResp.data:type_name -> DBGourmet 10, // 0: GourmetGetListResp.data:type_name -> DBGourmet
9, // 1: GourmetCreateOrderReq.order:type_name -> OrderCook 11, // 1: GourmetCreateOrderReq.order:type_name -> OrderCook
8, // 2: GourmetCreateOrderResp.data:type_name -> DBGourmet 10, // 2: GourmetCreateOrderResp.data:type_name -> DBGourmet
8, // 3: GourmetGetRewardResp.data:type_name -> DBGourmet 10, // 3: GourmetGetRewardResp.data:type_name -> DBGourmet
8, // 4: GourmetSkillLvResp.data:type_name -> DBGourmet 10, // 4: GourmetSkillLvResp.data:type_name -> DBGourmet
5, // [5:5] is the sub-list for method output_type 12, // 5: GourmetGetRandUserResp.user:type_name -> DBUser
5, // [5:5] is the sub-list for method input_type 6, // [6:6] is the sub-list for method output_type
5, // [5:5] is the sub-list for extension type_name 6, // [6:6] is the sub-list for method input_type
5, // [5:5] is the sub-list for extension extendee 6, // [6:6] is the sub-list for extension type_name
0, // [0:5] is the sub-list for field 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() } func init() { file_gourmet_gourmet_msg_proto_init() }
@ -460,6 +566,7 @@ func file_gourmet_gourmet_msg_proto_init() {
return return
} }
file_gourmet_gourmet_db_proto_init() file_gourmet_gourmet_db_proto_init()
file_user_user_db_proto_init()
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_gourmet_gourmet_msg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { file_gourmet_gourmet_msg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GourmetGetListReq); i { switch v := v.(*GourmetGetListReq); i {
@ -557,6 +664,30 @@ func file_gourmet_gourmet_msg_proto_init() {
return nil 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{} type x struct{}
out := protoimpl.TypeBuilder{ out := protoimpl.TypeBuilder{
@ -564,7 +695,7 @@ func file_gourmet_gourmet_msg_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_gourmet_gourmet_msg_proto_rawDesc, RawDescriptor: file_gourmet_gourmet_msg_proto_rawDesc,
NumEnums: 0, NumEnums: 0,
NumMessages: 8, NumMessages: 10,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,
}, },

View File

@ -473,6 +473,8 @@ type SmithyGetRandUserReq struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
People int32 `protobuf:"varint,1,opt,name=people,proto3" json:"people"` //人数
} }
func (x *SmithyGetRandUserReq) Reset() { func (x *SmithyGetRandUserReq) Reset() {
@ -507,12 +509,19 @@ func (*SmithyGetRandUserReq) Descriptor() ([]byte, []int) {
return file_smithy_smithy_msg_proto_rawDescGZIP(), []int{10} 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 { type SmithyGetRandUserResp struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields 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() { func (x *SmithyGetRandUserResp) Reset() {
@ -547,7 +556,7 @@ func (*SmithyGetRandUserResp) Descriptor() ([]byte, []int) {
return file_smithy_smithy_msg_proto_rawDescGZIP(), []int{11} return file_smithy_smithy_msg_proto_rawDescGZIP(), []int{11}
} }
func (x *SmithyGetRandUserResp) GetUser() []string { func (x *SmithyGetRandUserResp) GetUser() []*DBUser {
if x != nil { if x != nil {
return x.User 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, 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, 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, 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, 0x6f, 0x1a, 0x12, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x64, 0x62, 0x2e,
0x73, 0x74, 0x52, 0x65, 0x71, 0x22, 0x32, 0x0a, 0x11, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x47, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x12, 0x0a, 0x10, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x47,
0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x04, 0x64, 0x61, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x22, 0x32, 0x0a, 0x11, 0x53, 0x6d, 0x69,
0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x44, 0x42, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d,
0x74, 0x68, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x39, 0x0a, 0x14, 0x53, 0x6d, 0x69, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x44,
0x74, 0x68, 0x79, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x42, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x39, 0x0a,
0x71, 0x12, 0x21, 0x0a, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x14, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x64,
0x32, 0x0b, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x43, 0x6c, 0x61, 0x6e, 0x67, 0x52, 0x05, 0x6f, 0x65, 0x72, 0x52, 0x65, 0x71, 0x12, 0x21, 0x0a, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x01,
0x72, 0x64, 0x65, 0x72, 0x22, 0x36, 0x0a, 0x15, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x43, 0x72, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x43, 0x6c, 0x61, 0x6e,
0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 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, 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, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x32, 0x0a, 0x14,
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, 0x44, 0x65, 0x73, 0x6b, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x4c, 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, 0x76, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65,
0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x44, 0x42, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x52, 0x04, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x64, 0x65, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65,
0x64, 0x61, 0x74, 0x61, 0x22, 0x17, 0x0a, 0x15, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x53, 0x74, 0x22, 0x36, 0x0a, 0x15, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x44, 0x65, 0x73, 0x6b, 0x53, 0x6b,
0x6f, 0x76, 0x65, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x4c, 0x76, 0x52, 0x65, 0x71, 0x22, 0x37, 0x0a, 0x69, 0x6c, 0x6c, 0x4c, 0x76, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x04, 0x64, 0x61, 0x74,
0x16, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x53, 0x74, 0x6f, 0x76, 0x65, 0x53, 0x6b, 0x69, 0x6c, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x44, 0x42, 0x53, 0x6d, 0x69, 0x74,
0x6c, 0x4c, 0x76, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x68, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x17, 0x0a, 0x15, 0x53, 0x6d, 0x69, 0x74,
0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x44, 0x42, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x68, 0x79, 0x53, 0x74, 0x6f, 0x76, 0x65, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x4c, 0x76, 0x52, 0x65,
0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x16, 0x0a, 0x14, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x71, 0x22, 0x37, 0x0a, 0x16, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x53, 0x74, 0x6f, 0x76, 0x65,
0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x64, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x22, 0x2b, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x4c, 0x76, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x04, 0x64,
0x0a, 0x15, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x64, 0x55, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x44, 0x42, 0x53, 0x6d,
0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x69, 0x74, 0x68, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x2e, 0x0a, 0x14, 0x53, 0x6d,
0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x69, 0x74, 0x68, 0x79, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x64, 0x55, 0x73, 0x65, 0x72, 0x52,
0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 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 ( var (
@ -624,6 +636,7 @@ var file_smithy_smithy_msg_proto_goTypes = []interface{}{
(*SmithyGetRandUserResp)(nil), // 11: SmithyGetRandUserResp (*SmithyGetRandUserResp)(nil), // 11: SmithyGetRandUserResp
(*DBSmithy)(nil), // 12: DBSmithy (*DBSmithy)(nil), // 12: DBSmithy
(*OrderClang)(nil), // 13: OrderClang (*OrderClang)(nil), // 13: OrderClang
(*DBUser)(nil), // 14: DBUser
} }
var file_smithy_smithy_msg_proto_depIdxs = []int32{ var file_smithy_smithy_msg_proto_depIdxs = []int32{
12, // 0: SmithyGetListResp.data:type_name -> DBSmithy 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, // 3: SmithyGetRewardResp.data:type_name -> DBSmithy
12, // 4: SmithyDeskSkillLvResp.data:type_name -> DBSmithy 12, // 4: SmithyDeskSkillLvResp.data:type_name -> DBSmithy
12, // 5: SmithyStoveSkillLvResp.data:type_name -> DBSmithy 12, // 5: SmithyStoveSkillLvResp.data:type_name -> DBSmithy
6, // [6:6] is the sub-list for method output_type 14, // 6: SmithyGetRandUserResp.user:type_name -> DBUser
6, // [6:6] is the sub-list for method input_type 7, // [7:7] is the sub-list for method output_type
6, // [6:6] is the sub-list for extension type_name 7, // [7:7] is the sub-list for method input_type
6, // [6:6] is the sub-list for extension extendee 7, // [7:7] is the sub-list for extension type_name
0, // [0:6] is the sub-list for field 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() } func init() { file_smithy_smithy_msg_proto_init() }
@ -645,6 +659,7 @@ func file_smithy_smithy_msg_proto_init() {
return return
} }
file_smithy_smithy_db_proto_init() file_smithy_smithy_db_proto_init()
file_user_user_db_proto_init()
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_smithy_smithy_msg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { file_smithy_smithy_msg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SmithyGetListReq); i { switch v := v.(*SmithyGetListReq); i {