feat sn 改成 int64
This commit is contained in:
@@ -32,13 +32,13 @@ var (
|
||||
// ServiceProvider 服务提供者
|
||||
type ServiceProvider struct {
|
||||
Target string
|
||||
SID string
|
||||
SID int64
|
||||
Addr string
|
||||
}
|
||||
|
||||
// InstanceProvider 副本提供者
|
||||
type InstanceProvider struct {
|
||||
InstanceID int // 副本ID
|
||||
UniqueNo string // 副本唯一编号
|
||||
SID string
|
||||
UniqueNo int64 // 副本唯一编号
|
||||
SID int64
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"git.hlsq.asia/mmorpg/service-common/db/etcd"
|
||||
"git.hlsq.asia/mmorpg/service-common/discover/common"
|
||||
"git.hlsq.asia/mmorpg/service-common/log"
|
||||
"git.hlsq.asia/mmorpg/service-common/utils"
|
||||
clientv3 "go.etcd.io/etcd/client/v3"
|
||||
"sync"
|
||||
)
|
||||
@@ -12,8 +13,8 @@ import (
|
||||
// 大量读少量写的情况下,读写锁比同步Map更高效
|
||||
var (
|
||||
instanceMU = sync.RWMutex{}
|
||||
instanceM = make(map[string]string) // [uniqueNo]sid
|
||||
instanceLeaseM = make(map[string]clientv3.LeaseID) // [uniqueNo]
|
||||
instanceM = make(map[int64]int64) // [uniqueNo]sid
|
||||
instanceLeaseM = make(map[int64]clientv3.LeaseID) // [uniqueNo]
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -22,7 +23,7 @@ func init() {
|
||||
}
|
||||
|
||||
// FindInstanceByUniqueNo 根据唯一标识查询副本
|
||||
func FindInstanceByUniqueNo(uniqueNO string) (sid string) {
|
||||
func FindInstanceByUniqueNo(uniqueNO int64) (sid int64) {
|
||||
instanceMU.RLock()
|
||||
defer instanceMU.RUnlock()
|
||||
if c, ok := instanceM[uniqueNO]; ok {
|
||||
@@ -32,7 +33,7 @@ func FindInstanceByUniqueNo(uniqueNO string) (sid string) {
|
||||
}
|
||||
|
||||
// RegisterInstance 注册副本
|
||||
func RegisterInstance(sid string, instanceID int32, uniqueNo string, ttl int64) error {
|
||||
func RegisterInstance(sid int64, instanceID int32, uniqueNo int64, ttl int64) error {
|
||||
serverMU.Lock()
|
||||
defer serverMU.Unlock()
|
||||
leaseID, err := common.NewLeaseAndKeepAlive(ttl)
|
||||
@@ -40,7 +41,7 @@ func RegisterInstance(sid string, instanceID int32, uniqueNo string, ttl int64)
|
||||
return err
|
||||
}
|
||||
key := fmt.Sprintf("%v/%v/%v", common.KeyDiscoverInstance, instanceID, uniqueNo)
|
||||
_, err = etcd.GetClient().Put(key, sid, clientv3.WithLease(leaseID))
|
||||
_, err = etcd.GetClient().Put(key, utils.Int64ToString(sid), clientv3.WithLease(leaseID))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -49,7 +50,7 @@ func RegisterInstance(sid string, instanceID int32, uniqueNo string, ttl int64)
|
||||
}
|
||||
|
||||
// UnRegisterInstance 解注册副本
|
||||
func UnRegisterInstance(uniqueNo string) {
|
||||
func UnRegisterInstance(uniqueNo int64) {
|
||||
serverMU.Lock()
|
||||
defer serverMU.Unlock()
|
||||
if leaseID, ok := instanceLeaseM[uniqueNo]; ok {
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"git.hlsq.asia/mmorpg/service-common/db/etcd"
|
||||
"git.hlsq.asia/mmorpg/service-common/discover/common"
|
||||
"git.hlsq.asia/mmorpg/service-common/log"
|
||||
"git.hlsq.asia/mmorpg/service-common/utils"
|
||||
"go.etcd.io/etcd/api/v3/mvccpb"
|
||||
clientv3 "go.etcd.io/etcd/client/v3"
|
||||
"strconv"
|
||||
@@ -89,13 +90,13 @@ func onServerChange(t mvccpb.Event_EventType, key, value string) {
|
||||
case clientv3.EventTypePut:
|
||||
onCBByType(common.ListenerTypeNewServer, &common.ServiceProvider{
|
||||
Target: common.KeyDiscoverService + "/" + split[2],
|
||||
SID: split[3],
|
||||
SID: utils.StringToInt64(split[3]),
|
||||
Addr: value,
|
||||
})
|
||||
case clientv3.EventTypeDelete:
|
||||
onCBByType(common.ListenerTypeCloseServer, &common.ServiceProvider{
|
||||
Target: common.KeyDiscoverService + "/" + split[2],
|
||||
SID: split[3],
|
||||
SID: utils.StringToInt64(split[3]),
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -111,14 +112,14 @@ func onInstanceChange(t mvccpb.Event_EventType, key, value string, preKv *mvccpb
|
||||
case clientv3.EventTypePut:
|
||||
onCBByType(common.ListenerTypeNewInstance, &common.InstanceProvider{
|
||||
InstanceID: instanceID,
|
||||
UniqueNo: split[3],
|
||||
SID: value,
|
||||
UniqueNo: utils.StringToInt64(split[3]),
|
||||
SID: utils.StringToInt64(value),
|
||||
})
|
||||
case clientv3.EventTypeDelete:
|
||||
onCBByType(common.ListenerTypeCloseInstance, &common.InstanceProvider{
|
||||
InstanceID: instanceID,
|
||||
UniqueNo: split[3],
|
||||
SID: string(preKv.Value),
|
||||
UniqueNo: utils.StringToInt64(split[3]),
|
||||
SID: utils.StringToInt64(string(preKv.Value)),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
var (
|
||||
serverMU = sync.RWMutex{}
|
||||
conn = make(map[string]*grpc_conn.GrpcConnectionMgr)
|
||||
serverLeaseM = make(map[string]clientv3.LeaseID)
|
||||
serverLeaseM = make(map[int64]clientv3.LeaseID)
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -24,7 +24,7 @@ func init() {
|
||||
}
|
||||
|
||||
// FindServer 根据SID或随机查找服务
|
||||
func FindServer(target string, sid ...string) (*grpc.ClientConn, error) {
|
||||
func FindServer(target string, sid ...int64) (*grpc.ClientConn, error) {
|
||||
serverMU.RLock()
|
||||
defer serverMU.RUnlock()
|
||||
if v, ok := conn[target]; ok {
|
||||
@@ -33,17 +33,17 @@ func FindServer(target string, sid ...string) (*grpc.ClientConn, error) {
|
||||
return nil, fmt.Errorf("cannot find server")
|
||||
}
|
||||
|
||||
func FindServerAll(target string) map[string]*grpc.ClientConn {
|
||||
func FindServerAll(target string) map[int64]*grpc.ClientConn {
|
||||
serverMU.RLock()
|
||||
defer serverMU.RUnlock()
|
||||
if v, ok := conn[target]; ok {
|
||||
return v.LoadAll()
|
||||
}
|
||||
return make(map[string]*grpc.ClientConn)
|
||||
return make(map[int64]*grpc.ClientConn)
|
||||
}
|
||||
|
||||
// RegisterGrpcServer 注册服务提供者
|
||||
func RegisterGrpcServer(target string, sid string, addr string, ttl int64) error {
|
||||
func RegisterGrpcServer(target string, sid int64, addr string, ttl int64) error {
|
||||
serverMU.Lock()
|
||||
defer serverMU.Unlock()
|
||||
leaseID, err := common.NewLeaseAndKeepAlive(ttl)
|
||||
@@ -59,7 +59,7 @@ func RegisterGrpcServer(target string, sid string, addr string, ttl int64) error
|
||||
}
|
||||
|
||||
// UnRegisterGrpcServer 解注册服务提供者
|
||||
func UnRegisterGrpcServer(sid string) {
|
||||
func UnRegisterGrpcServer(sid int64) {
|
||||
serverMU.Lock()
|
||||
defer serverMU.Unlock()
|
||||
if leaseID, ok := serverLeaseM[sid]; ok {
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"git.hlsq.asia/mmorpg/service-common/proto/rs/grpc_pb"
|
||||
)
|
||||
|
||||
func GatewayNewClient(sid ...string) (grpc_pb.GatewayClient, error) {
|
||||
func GatewayNewClient(sid ...int64) (grpc_pb.GatewayClient, error) {
|
||||
c, err := discover.FindServer(common.KeyDiscoverGateway, sid...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -14,8 +14,8 @@ func GatewayNewClient(sid ...string) (grpc_pb.GatewayClient, error) {
|
||||
return grpc_pb.NewGatewayClient(c), nil
|
||||
}
|
||||
|
||||
func GatewayNewBroadcastClient() map[string]grpc_pb.GatewayClient {
|
||||
clientM := make(map[string]grpc_pb.GatewayClient)
|
||||
func GatewayNewBroadcastClient() map[int64]grpc_pb.GatewayClient {
|
||||
clientM := make(map[int64]grpc_pb.GatewayClient)
|
||||
connM := discover.FindServerAll(common.KeyDiscoverGateway)
|
||||
for sid, conn := range connM {
|
||||
clientM[sid] = grpc_pb.NewGatewayClient(conn)
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"git.hlsq.asia/mmorpg/service-common/proto/rs/grpc_pb"
|
||||
)
|
||||
|
||||
func QgdzsNewClient(sid ...string) (grpc_pb.QgdzsClient, error) {
|
||||
func QgdzsNewClient(sid ...int64) (grpc_pb.QgdzsClient, error) {
|
||||
c, err := discover.FindServer(common.KeyDiscoverQgdzs, sid...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"git.hlsq.asia/mmorpg/service-common/proto/rs/grpc_pb"
|
||||
)
|
||||
|
||||
func SceneNewClient(sid ...string) (grpc_pb.SceneClient, error) {
|
||||
func SceneNewClient(sid ...int64) (grpc_pb.SceneClient, error) {
|
||||
c, err := discover.FindServer(common.KeyDiscoverScene, sid...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -23,8 +23,8 @@ func SceneNewClientLB() (grpc_pb.SceneClient, error) {
|
||||
return grpc_pb.NewSceneClient(c), nil
|
||||
}
|
||||
|
||||
func SceneNewBroadcastClient() map[string]grpc_pb.SceneClient {
|
||||
clientM := make(map[string]grpc_pb.SceneClient)
|
||||
func SceneNewBroadcastClient() map[int64]grpc_pb.SceneClient {
|
||||
clientM := make(map[int64]grpc_pb.SceneClient)
|
||||
connM := discover.FindServerAll(common.KeyDiscoverScene)
|
||||
for sid, conn := range connM {
|
||||
clientM[sid] = grpc_pb.NewSceneClient(conn)
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"git.hlsq.asia/mmorpg/service-common/proto/rs/grpc_pb"
|
||||
)
|
||||
|
||||
func UserNewClient(sid ...string) (grpc_pb.UserClient, error) {
|
||||
func UserNewClient(sid ...int64) (grpc_pb.UserClient, error) {
|
||||
c, err := discover.FindServer(common.KeyDiscoverUser, sid...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -2,10 +2,10 @@ package grpc_client
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"git.hlsq.asia/mmorpg/service-common/log"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"strconv"
|
||||
"sync"
|
||||
)
|
||||
|
||||
@@ -22,7 +22,7 @@ type gatewayStream struct {
|
||||
stream grpc.ClientStream
|
||||
}
|
||||
|
||||
func findGatewayBySID(sid string, fun GatewayFun) (*gatewayStream, error) {
|
||||
func findGatewayBySID(sid int64, fun GatewayFun) (*gatewayStream, error) {
|
||||
key := gatewayKey(sid, fun)
|
||||
|
||||
if v, ok := gatewayServer.Load(key); ok {
|
||||
@@ -53,7 +53,7 @@ func findGatewayBySID(sid string, fun GatewayFun) (*gatewayStream, error) {
|
||||
return ss, nil
|
||||
}
|
||||
|
||||
func SendMessageToGateway(sid string, fun GatewayFun, msg proto.Message, re ...bool) error {
|
||||
func SendMessageToGateway(sid int64, fun GatewayFun, msg proto.Message, re ...bool) error {
|
||||
ss, err := findGatewayBySID(sid, fun)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -78,6 +78,6 @@ func SendMessageToGateway(sid string, fun GatewayFun, msg proto.Message, re ...b
|
||||
return nil
|
||||
}
|
||||
|
||||
func gatewayKey(sid string, fun GatewayFun) string {
|
||||
return sid + "-" + strconv.Itoa(int(fun))
|
||||
func gatewayKey(sid int64, fun GatewayFun) string {
|
||||
return fmt.Sprintf("%v-%v", sid, fun)
|
||||
}
|
||||
|
||||
@@ -2,10 +2,10 @@ package grpc_client
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"git.hlsq.asia/mmorpg/service-common/log"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"strconv"
|
||||
"sync"
|
||||
)
|
||||
|
||||
@@ -22,7 +22,7 @@ type sceneStream struct {
|
||||
stream grpc.ClientStream
|
||||
}
|
||||
|
||||
func findSceneBySID(sid string, fun SceneFun) (*sceneStream, error) {
|
||||
func findSceneBySID(sid int64, fun SceneFun) (*sceneStream, error) {
|
||||
key := sceneKey(sid, fun)
|
||||
|
||||
if v, ok := sceneServer.Load(key); ok {
|
||||
@@ -53,7 +53,7 @@ func findSceneBySID(sid string, fun SceneFun) (*sceneStream, error) {
|
||||
return ss, nil
|
||||
}
|
||||
|
||||
func SendMessageToScene(sid string, fun SceneFun, msg proto.Message, re ...bool) error {
|
||||
func SendMessageToScene(sid int64, fun SceneFun, msg proto.Message, re ...bool) error {
|
||||
ss, err := findSceneBySID(sid, fun)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -78,6 +78,6 @@ func SendMessageToScene(sid string, fun SceneFun, msg proto.Message, re ...bool)
|
||||
return nil
|
||||
}
|
||||
|
||||
func sceneKey(sid string, fun SceneFun) string {
|
||||
return sid + "-" + strconv.Itoa(int(fun))
|
||||
func sceneKey(sid int64, fun SceneFun) string {
|
||||
return fmt.Sprintf("%v-%v", sid, fun)
|
||||
}
|
||||
|
||||
@@ -10,11 +10,11 @@ import (
|
||||
)
|
||||
|
||||
type GrpcConnection struct {
|
||||
sid string
|
||||
sid int64
|
||||
conn *grpc.ClientConn
|
||||
}
|
||||
|
||||
func NewGrpcConnection(sid string, address string) (*GrpcConnection, error) {
|
||||
func NewGrpcConnection(sid int64, address string) (*GrpcConnection, error) {
|
||||
p := &GrpcConnection{
|
||||
sid: sid,
|
||||
}
|
||||
|
||||
@@ -8,18 +8,18 @@ import (
|
||||
)
|
||||
|
||||
type GrpcConnectionMgr struct {
|
||||
poolM map[string]*GrpcConnection
|
||||
poolM map[int64]*GrpcConnection
|
||||
poolS []*GrpcConnection
|
||||
}
|
||||
|
||||
func NewGrpcConnectionMgr() *GrpcConnectionMgr {
|
||||
return &GrpcConnectionMgr{
|
||||
poolM: make(map[string]*GrpcConnection),
|
||||
poolM: make(map[int64]*GrpcConnection),
|
||||
poolS: make([]*GrpcConnection, 0),
|
||||
}
|
||||
}
|
||||
|
||||
func (p *GrpcConnectionMgr) Store(sid string, addr string) {
|
||||
func (p *GrpcConnectionMgr) Store(sid int64, addr string) {
|
||||
pool, err := NewGrpcConnection(sid, addr)
|
||||
if err != nil {
|
||||
log.Errorf("create grpc err: %v, sid: %v, addr: %v", err, sid, addr)
|
||||
@@ -29,7 +29,7 @@ func (p *GrpcConnectionMgr) Store(sid string, addr string) {
|
||||
p.poolS = append(p.poolS, pool)
|
||||
}
|
||||
|
||||
func (p *GrpcConnectionMgr) Delete(sid string) int {
|
||||
func (p *GrpcConnectionMgr) Delete(sid int64) int {
|
||||
delete(p.poolM, sid)
|
||||
for i, pool := range p.poolS {
|
||||
if pool.sid == sid {
|
||||
@@ -40,9 +40,9 @@ func (p *GrpcConnectionMgr) Delete(sid string) int {
|
||||
return len(p.poolS)
|
||||
}
|
||||
|
||||
func (p *GrpcConnectionMgr) Load(sid ...string) (*grpc.ClientConn, error) {
|
||||
func (p *GrpcConnectionMgr) Load(sid ...int64) (*grpc.ClientConn, error) {
|
||||
var pool *GrpcConnection
|
||||
if len(sid) > 0 && sid[0] != "" {
|
||||
if len(sid) > 0 && sid[0] != 0 {
|
||||
pool = p.poolM[sid[0]]
|
||||
} else {
|
||||
pool = p.poolS[rand.Intn(len(p.poolS))]
|
||||
@@ -53,8 +53,8 @@ func (p *GrpcConnectionMgr) Load(sid ...string) (*grpc.ClientConn, error) {
|
||||
return pool.GetConnection(), nil
|
||||
}
|
||||
|
||||
func (p *GrpcConnectionMgr) LoadAll() map[string]*grpc.ClientConn {
|
||||
sidM := make(map[string]*grpc.ClientConn)
|
||||
func (p *GrpcConnectionMgr) LoadAll() map[int64]*grpc.ClientConn {
|
||||
sidM := make(map[int64]*grpc.ClientConn)
|
||||
for sid, pool := range p.poolM {
|
||||
sidM[sid] = pool.GetConnection()
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ type IService interface {
|
||||
type Base struct {
|
||||
Target string
|
||||
ServiceName string
|
||||
SID string
|
||||
SID int64
|
||||
Serve *grpc.Server
|
||||
Cfg *config.GrpcConfig
|
||||
OnCustomGrpcServerOption func() []grpc.ServerOption
|
||||
@@ -39,7 +39,7 @@ type Base struct {
|
||||
func (s *Base) Init(ready *sync.WaitGroup) {
|
||||
s.wg = &sync.WaitGroup{}
|
||||
s.wg.Add(1)
|
||||
s.SID = utils.SnowflakeInstance().Generate().String()
|
||||
s.SID = utils.SnowflakeInstance().Generate().Int64()
|
||||
go func() {
|
||||
defer s.wg.Done()
|
||||
defer s.OnClose()
|
||||
|
||||
@@ -26,7 +26,7 @@ type ToClientReq struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
USN string `protobuf:"bytes,1,opt,name=USN,proto3" json:"USN,omitempty"`
|
||||
USN int64 `protobuf:"varint,1,opt,name=USN,proto3" json:"USN,omitempty"`
|
||||
MessageID int32 `protobuf:"varint,2,opt,name=MessageID,proto3" json:"MessageID,omitempty"`
|
||||
Payload []byte `protobuf:"bytes,3,opt,name=Payload,proto3" json:"Payload,omitempty"`
|
||||
}
|
||||
@@ -63,11 +63,11 @@ func (*ToClientReq) Descriptor() ([]byte, []int) {
|
||||
return file_service_gateway_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *ToClientReq) GetUSN() string {
|
||||
func (x *ToClientReq) GetUSN() int64 {
|
||||
if x != nil {
|
||||
return x.USN
|
||||
}
|
||||
return ""
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ToClientReq) GetMessageID() int32 {
|
||||
@@ -127,7 +127,7 @@ type KickUserReq struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
USN string `protobuf:"bytes,1,opt,name=USN,proto3" json:"USN,omitempty"`
|
||||
USN int64 `protobuf:"varint,1,opt,name=USN,proto3" json:"USN,omitempty"`
|
||||
}
|
||||
|
||||
func (x *KickUserReq) Reset() {
|
||||
@@ -162,11 +162,11 @@ func (*KickUserReq) Descriptor() ([]byte, []int) {
|
||||
return file_service_gateway_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *KickUserReq) GetUSN() string {
|
||||
func (x *KickUserReq) GetUSN() int64 {
|
||||
if x != nil {
|
||||
return x.USN
|
||||
}
|
||||
return ""
|
||||
return 0
|
||||
}
|
||||
|
||||
type KickUserResp struct {
|
||||
@@ -214,13 +214,13 @@ var file_service_gateway_proto_rawDesc = []byte{
|
||||
0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x72, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d,
|
||||
0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x57, 0x0a, 0x0b, 0x54, 0x6f, 0x43, 0x6c,
|
||||
0x69, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x55, 0x53, 0x4e, 0x12, 0x1c, 0x0a, 0x09, 0x4d, 0x65, 0x73,
|
||||
0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x55, 0x53, 0x4e, 0x12, 0x1c, 0x0a, 0x09, 0x4d, 0x65, 0x73,
|
||||
0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x4d, 0x65,
|
||||
0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f,
|
||||
0x61, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61,
|
||||
0x64, 0x22, 0x0e, 0x0a, 0x0c, 0x54, 0x6f, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73,
|
||||
0x70, 0x22, 0x1f, 0x0a, 0x0b, 0x4b, 0x69, 0x63, 0x6b, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71,
|
||||
0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x55,
|
||||
0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x55,
|
||||
0x53, 0x4e, 0x22, 0x0e, 0x0a, 0x0c, 0x4b, 0x69, 0x63, 0x6b, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65,
|
||||
0x73, 0x70, 0x32, 0x61, 0x0a, 0x07, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x2b, 0x0a,
|
||||
0x08, 0x54, 0x6f, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x0c, 0x2e, 0x54, 0x6f, 0x43, 0x6c,
|
||||
|
||||
@@ -152,7 +152,7 @@ type RandomGetQuestionResp struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Sn string `protobuf:"bytes,1,opt,name=Sn,json=sn,proto3" json:"Sn,omitempty"` // 题目唯一标识
|
||||
Sn int64 `protobuf:"varint,1,opt,name=Sn,json=sn,proto3" json:"Sn,omitempty"` // 题目唯一标识
|
||||
Question string `protobuf:"bytes,2,opt,name=Question,json=question,proto3" json:"Question,omitempty"` // 题干
|
||||
Options []string `protobuf:"bytes,3,rep,name=Options,json=options,proto3" json:"Options,omitempty"` // 选项
|
||||
Category string `protobuf:"bytes,4,opt,name=Category,json=category,proto3" json:"Category,omitempty"` // 题目类型
|
||||
@@ -191,11 +191,11 @@ func (*RandomGetQuestionResp) Descriptor() ([]byte, []int) {
|
||||
return file_service_qgdzs_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *RandomGetQuestionResp) GetSn() string {
|
||||
func (x *RandomGetQuestionResp) GetSn() int64 {
|
||||
if x != nil {
|
||||
return x.Sn
|
||||
}
|
||||
return ""
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *RandomGetQuestionResp) GetQuestion() string {
|
||||
@@ -232,8 +232,8 @@ type RandomAnswerQuestionReq struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
USN string `protobuf:"bytes,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"`
|
||||
Sn string `protobuf:"bytes,2,opt,name=Sn,json=sn,proto3" json:"Sn,omitempty"` // 题目唯一标识
|
||||
USN int64 `protobuf:"varint,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"`
|
||||
Sn int64 `protobuf:"varint,2,opt,name=Sn,json=sn,proto3" json:"Sn,omitempty"` // 题目唯一标识
|
||||
Answer string `protobuf:"bytes,3,opt,name=Answer,json=answer,proto3" json:"Answer,omitempty"` // 答案
|
||||
}
|
||||
|
||||
@@ -269,18 +269,18 @@ func (*RandomAnswerQuestionReq) Descriptor() ([]byte, []int) {
|
||||
return file_service_qgdzs_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *RandomAnswerQuestionReq) GetUSN() string {
|
||||
func (x *RandomAnswerQuestionReq) GetUSN() int64 {
|
||||
if x != nil {
|
||||
return x.USN
|
||||
}
|
||||
return ""
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *RandomAnswerQuestionReq) GetSn() string {
|
||||
func (x *RandomAnswerQuestionReq) GetSn() int64 {
|
||||
if x != nil {
|
||||
return x.Sn
|
||||
}
|
||||
return ""
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *RandomAnswerQuestionReq) GetAnswer() string {
|
||||
@@ -436,7 +436,7 @@ type GetAllCategoryItem struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Sn string `protobuf:"bytes,1,opt,name=Sn,json=sn,proto3" json:"Sn,omitempty"` // 唯一标识
|
||||
Sn int64 `protobuf:"varint,1,opt,name=Sn,json=sn,proto3" json:"Sn,omitempty"` // 唯一标识
|
||||
Category string `protobuf:"bytes,2,opt,name=Category,json=category,proto3" json:"Category,omitempty"` // 类目
|
||||
}
|
||||
|
||||
@@ -472,11 +472,11 @@ func (*GetAllCategoryItem) Descriptor() ([]byte, []int) {
|
||||
return file_service_qgdzs_proto_rawDescGZIP(), []int{8}
|
||||
}
|
||||
|
||||
func (x *GetAllCategoryItem) GetSn() string {
|
||||
func (x *GetAllCategoryItem) GetSn() int64 {
|
||||
if x != nil {
|
||||
return x.Sn
|
||||
}
|
||||
return ""
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *GetAllCategoryItem) GetCategory() string {
|
||||
@@ -492,7 +492,7 @@ type CategoryGetQuestionReq struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
CategorySn string `protobuf:"bytes,1,opt,name=CategorySn,json=category_sn,proto3" json:"CategorySn,omitempty"` // 类目唯一标识
|
||||
CategorySn int64 `protobuf:"varint,1,opt,name=CategorySn,json=category_sn,proto3" json:"CategorySn,omitempty"` // 类目唯一标识
|
||||
}
|
||||
|
||||
func (x *CategoryGetQuestionReq) Reset() {
|
||||
@@ -527,11 +527,11 @@ func (*CategoryGetQuestionReq) Descriptor() ([]byte, []int) {
|
||||
return file_service_qgdzs_proto_rawDescGZIP(), []int{9}
|
||||
}
|
||||
|
||||
func (x *CategoryGetQuestionReq) GetCategorySn() string {
|
||||
func (x *CategoryGetQuestionReq) GetCategorySn() int64 {
|
||||
if x != nil {
|
||||
return x.CategorySn
|
||||
}
|
||||
return ""
|
||||
return 0
|
||||
}
|
||||
|
||||
type CategoryGetQuestionResp struct {
|
||||
@@ -539,7 +539,7 @@ type CategoryGetQuestionResp struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Sn string `protobuf:"bytes,1,opt,name=Sn,json=sn,proto3" json:"Sn,omitempty"` // 题目唯一标识
|
||||
Sn int64 `protobuf:"varint,1,opt,name=Sn,json=sn,proto3" json:"Sn,omitempty"` // 题目唯一标识
|
||||
Question string `protobuf:"bytes,2,opt,name=Question,json=question,proto3" json:"Question,omitempty"` // 题干
|
||||
Options []string `protobuf:"bytes,3,rep,name=Options,json=options,proto3" json:"Options,omitempty"` // 选项
|
||||
Category string `protobuf:"bytes,4,opt,name=Category,json=category,proto3" json:"Category,omitempty"` // 题目类型
|
||||
@@ -578,11 +578,11 @@ func (*CategoryGetQuestionResp) Descriptor() ([]byte, []int) {
|
||||
return file_service_qgdzs_proto_rawDescGZIP(), []int{10}
|
||||
}
|
||||
|
||||
func (x *CategoryGetQuestionResp) GetSn() string {
|
||||
func (x *CategoryGetQuestionResp) GetSn() int64 {
|
||||
if x != nil {
|
||||
return x.Sn
|
||||
}
|
||||
return ""
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *CategoryGetQuestionResp) GetQuestion() string {
|
||||
@@ -619,8 +619,8 @@ type CategoryAnswerQuestionReq struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
USN string `protobuf:"bytes,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"`
|
||||
Sn string `protobuf:"bytes,2,opt,name=Sn,json=sn,proto3" json:"Sn,omitempty"` // 题目唯一标识
|
||||
USN int64 `protobuf:"varint,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"`
|
||||
Sn int64 `protobuf:"varint,2,opt,name=Sn,json=sn,proto3" json:"Sn,omitempty"` // 题目唯一标识
|
||||
Answer string `protobuf:"bytes,3,opt,name=Answer,json=answer,proto3" json:"Answer,omitempty"` // 答案
|
||||
}
|
||||
|
||||
@@ -656,18 +656,18 @@ func (*CategoryAnswerQuestionReq) Descriptor() ([]byte, []int) {
|
||||
return file_service_qgdzs_proto_rawDescGZIP(), []int{11}
|
||||
}
|
||||
|
||||
func (x *CategoryAnswerQuestionReq) GetUSN() string {
|
||||
func (x *CategoryAnswerQuestionReq) GetUSN() int64 {
|
||||
if x != nil {
|
||||
return x.USN
|
||||
}
|
||||
return ""
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *CategoryAnswerQuestionReq) GetSn() string {
|
||||
func (x *CategoryAnswerQuestionReq) GetSn() int64 {
|
||||
if x != nil {
|
||||
return x.Sn
|
||||
}
|
||||
return ""
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *CategoryAnswerQuestionReq) GetAnswer() string {
|
||||
@@ -776,7 +776,7 @@ type QuicklyGetQuestionResp struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Sn string `protobuf:"bytes,1,opt,name=Sn,json=sn,proto3" json:"Sn,omitempty"` // 题目唯一标识
|
||||
Sn int64 `protobuf:"varint,1,opt,name=Sn,json=sn,proto3" json:"Sn,omitempty"` // 题目唯一标识
|
||||
Question string `protobuf:"bytes,2,opt,name=Question,json=question,proto3" json:"Question,omitempty"` // 题干
|
||||
Options []string `protobuf:"bytes,3,rep,name=Options,json=options,proto3" json:"Options,omitempty"` // 选项
|
||||
Category string `protobuf:"bytes,4,opt,name=Category,json=category,proto3" json:"Category,omitempty"` // 题目类型
|
||||
@@ -815,11 +815,11 @@ func (*QuicklyGetQuestionResp) Descriptor() ([]byte, []int) {
|
||||
return file_service_qgdzs_proto_rawDescGZIP(), []int{14}
|
||||
}
|
||||
|
||||
func (x *QuicklyGetQuestionResp) GetSn() string {
|
||||
func (x *QuicklyGetQuestionResp) GetSn() int64 {
|
||||
if x != nil {
|
||||
return x.Sn
|
||||
}
|
||||
return ""
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *QuicklyGetQuestionResp) GetQuestion() string {
|
||||
@@ -856,8 +856,8 @@ type QuicklyAnswerQuestionReq struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
USN string `protobuf:"bytes,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"`
|
||||
Sn string `protobuf:"bytes,2,opt,name=Sn,json=sn,proto3" json:"Sn,omitempty"` // 题目唯一标识
|
||||
USN int64 `protobuf:"varint,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"`
|
||||
Sn int64 `protobuf:"varint,2,opt,name=Sn,json=sn,proto3" json:"Sn,omitempty"` // 题目唯一标识
|
||||
Answer string `protobuf:"bytes,3,opt,name=Answer,json=answer,proto3" json:"Answer,omitempty"` // 答案
|
||||
}
|
||||
|
||||
@@ -893,18 +893,18 @@ func (*QuicklyAnswerQuestionReq) Descriptor() ([]byte, []int) {
|
||||
return file_service_qgdzs_proto_rawDescGZIP(), []int{15}
|
||||
}
|
||||
|
||||
func (x *QuicklyAnswerQuestionReq) GetUSN() string {
|
||||
func (x *QuicklyAnswerQuestionReq) GetUSN() int64 {
|
||||
if x != nil {
|
||||
return x.USN
|
||||
}
|
||||
return ""
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *QuicklyAnswerQuestionReq) GetSn() string {
|
||||
func (x *QuicklyAnswerQuestionReq) GetSn() int64 {
|
||||
if x != nil {
|
||||
return x.Sn
|
||||
}
|
||||
return ""
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *QuicklyAnswerQuestionReq) GetAnswer() string {
|
||||
@@ -975,7 +975,7 @@ type GetRecordReq struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
USN string `protobuf:"bytes,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"`
|
||||
USN int64 `protobuf:"varint,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"`
|
||||
Page int32 `protobuf:"varint,2,opt,name=Page,json=page,proto3" json:"Page,omitempty"`
|
||||
PageSize int32 `protobuf:"varint,3,opt,name=PageSize,json=page_size,proto3" json:"PageSize,omitempty"`
|
||||
}
|
||||
@@ -1012,11 +1012,11 @@ func (*GetRecordReq) Descriptor() ([]byte, []int) {
|
||||
return file_service_qgdzs_proto_rawDescGZIP(), []int{17}
|
||||
}
|
||||
|
||||
func (x *GetRecordReq) GetUSN() string {
|
||||
func (x *GetRecordReq) GetUSN() int64 {
|
||||
if x != nil {
|
||||
return x.USN
|
||||
}
|
||||
return ""
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *GetRecordReq) GetPage() int32 {
|
||||
@@ -1093,7 +1093,7 @@ type GetRecordItem struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
QuestionSn string `protobuf:"bytes,1,opt,name=QuestionSn,json=question_sn,proto3" json:"QuestionSn,omitempty"` // 题目唯一标识
|
||||
QuestionSn int64 `protobuf:"varint,1,opt,name=QuestionSn,json=question_sn,proto3" json:"QuestionSn,omitempty"` // 题目唯一标识
|
||||
Question string `protobuf:"bytes,2,opt,name=Question,json=question,proto3" json:"Question,omitempty"` // 题干
|
||||
Difficulty int32 `protobuf:"varint,3,opt,name=Difficulty,json=difficulty,proto3" json:"Difficulty,omitempty"` // 难度
|
||||
Category string `protobuf:"bytes,4,opt,name=Category,json=category,proto3" json:"Category,omitempty"` // 题目类型
|
||||
@@ -1134,11 +1134,11 @@ func (*GetRecordItem) Descriptor() ([]byte, []int) {
|
||||
return file_service_qgdzs_proto_rawDescGZIP(), []int{19}
|
||||
}
|
||||
|
||||
func (x *GetRecordItem) GetQuestionSn() string {
|
||||
func (x *GetRecordItem) GetQuestionSn() int64 {
|
||||
if x != nil {
|
||||
return x.QuestionSn
|
||||
}
|
||||
return ""
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *GetRecordItem) GetQuestion() string {
|
||||
@@ -1189,7 +1189,7 @@ type GetQuestionInfoReq struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
QuestionSn string `protobuf:"bytes,1,opt,name=QuestionSn,json=question_sn,proto3" json:"QuestionSn,omitempty"` // 题目唯一标识
|
||||
QuestionSn int64 `protobuf:"varint,1,opt,name=QuestionSn,json=question_sn,proto3" json:"QuestionSn,omitempty"` // 题目唯一标识
|
||||
}
|
||||
|
||||
func (x *GetQuestionInfoReq) Reset() {
|
||||
@@ -1224,11 +1224,11 @@ func (*GetQuestionInfoReq) Descriptor() ([]byte, []int) {
|
||||
return file_service_qgdzs_proto_rawDescGZIP(), []int{20}
|
||||
}
|
||||
|
||||
func (x *GetQuestionInfoReq) GetQuestionSn() string {
|
||||
func (x *GetQuestionInfoReq) GetQuestionSn() int64 {
|
||||
if x != nil {
|
||||
return x.QuestionSn
|
||||
}
|
||||
return ""
|
||||
return 0
|
||||
}
|
||||
|
||||
type GetQuestionInfoResp struct {
|
||||
@@ -1325,7 +1325,7 @@ var file_service_qgdzs_proto_rawDesc = []byte{
|
||||
0x65, 0x74, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x22, 0x99, 0x01,
|
||||
0x0a, 0x15, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x47, 0x65, 0x74, 0x51, 0x75, 0x65, 0x73, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x53, 0x6e, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x02, 0x73, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x51, 0x75, 0x65, 0x73, 0x74,
|
||||
0x01, 0x28, 0x03, 0x52, 0x02, 0x73, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x51, 0x75, 0x65, 0x73, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03,
|
||||
0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1a, 0x0a,
|
||||
@@ -1335,8 +1335,8 @@ var file_service_qgdzs_proto_rawDesc = []byte{
|
||||
0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x22, 0x53, 0x0a, 0x17, 0x52, 0x61, 0x6e,
|
||||
0x64, 0x6f, 0x6d, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x03, 0x75, 0x73, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x53, 0x6e, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x02, 0x73, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72,
|
||||
0x03, 0x52, 0x03, 0x75, 0x73, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x53, 0x6e, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x03, 0x52, 0x02, 0x73, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72,
|
||||
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x22, 0x54,
|
||||
0x0a, 0x18, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x51, 0x75,
|
||||
0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x6e,
|
||||
@@ -1351,15 +1351,15 @@ var file_service_qgdzs_proto_rawDesc = []byte{
|
||||
0x67, 0x6f, 0x72, 0x79, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x0a, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f,
|
||||
0x72, 0x69, 0x65, 0x73, 0x22, 0x40, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x43, 0x61,
|
||||
0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x53, 0x6e,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x73, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x43, 0x61,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x73, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x43, 0x61,
|
||||
0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x61,
|
||||
0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x22, 0x39, 0x0a, 0x16, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f,
|
||||
0x72, 0x79, 0x47, 0x65, 0x74, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71,
|
||||
0x12, 0x1f, 0x0a, 0x0a, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x53, 0x6e, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x5f, 0x73,
|
||||
0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x5f, 0x73,
|
||||
0x6e, 0x22, 0x9b, 0x01, 0x0a, 0x17, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x47, 0x65,
|
||||
0x74, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x0e, 0x0a,
|
||||
0x02, 0x53, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x73, 0x6e, 0x12, 0x1a, 0x0a,
|
||||
0x02, 0x53, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x73, 0x6e, 0x12, 0x1a, 0x0a,
|
||||
0x08, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x08, 0x71, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x4f, 0x70, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69,
|
||||
@@ -1369,8 +1369,8 @@ var file_service_qgdzs_proto_rawDesc = []byte{
|
||||
0x01, 0x28, 0x05, 0x52, 0x0a, 0x64, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x22,
|
||||
0x55, 0x0a, 0x19, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x41, 0x6e, 0x73, 0x77, 0x65,
|
||||
0x72, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03,
|
||||
0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x73, 0x6e, 0x12, 0x0e,
|
||||
0x0a, 0x02, 0x53, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x73, 0x6e, 0x12, 0x16,
|
||||
0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x75, 0x73, 0x6e, 0x12, 0x0e,
|
||||
0x0a, 0x02, 0x53, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x73, 0x6e, 0x12, 0x16,
|
||||
0x0a, 0x06, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06,
|
||||
0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x22, 0x56, 0x0a, 0x1a, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f,
|
||||
0x72, 0x79, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e,
|
||||
@@ -1381,7 +1381,7 @@ var file_service_qgdzs_proto_rawDesc = []byte{
|
||||
0x0a, 0x15, 0x51, 0x75, 0x69, 0x63, 0x6b, 0x6c, 0x79, 0x47, 0x65, 0x74, 0x51, 0x75, 0x65, 0x73,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x22, 0x9a, 0x01, 0x0a, 0x16, 0x51, 0x75, 0x69, 0x63,
|
||||
0x6b, 0x6c, 0x79, 0x47, 0x65, 0x74, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65,
|
||||
0x73, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x53, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02,
|
||||
0x73, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x53, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02,
|
||||
0x73, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x71, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18,
|
||||
0x0a, 0x07, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52,
|
||||
@@ -1391,8 +1391,8 @@ var file_service_qgdzs_proto_rawDesc = []byte{
|
||||
0x74, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x64, 0x69, 0x66, 0x66, 0x69, 0x63,
|
||||
0x75, 0x6c, 0x74, 0x79, 0x22, 0x54, 0x0a, 0x18, 0x51, 0x75, 0x69, 0x63, 0x6b, 0x6c, 0x79, 0x41,
|
||||
0x6e, 0x73, 0x77, 0x65, 0x72, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71,
|
||||
0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75,
|
||||
0x73, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x53, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02,
|
||||
0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x75,
|
||||
0x73, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x53, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02,
|
||||
0x73, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x06, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x22, 0x55, 0x0a, 0x19, 0x51, 0x75,
|
||||
0x69, 0x63, 0x6b, 0x6c, 0x79, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x51, 0x75, 0x65, 0x73, 0x74,
|
||||
@@ -1401,7 +1401,7 @@ var file_service_qgdzs_proto_rawDesc = []byte{
|
||||
0x20, 0x0a, 0x0b, 0x45, 0x78, 0x70, 0x6c, 0x61, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x65, 0x78, 0x70, 0x6c, 0x61, 0x6e, 0x61, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x22, 0x51, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65,
|
||||
0x71, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03,
|
||||
0x71, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03,
|
||||
0x75, 0x73, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x50, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x1b, 0x0a, 0x08, 0x50, 0x61, 0x67, 0x65, 0x53,
|
||||
0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f,
|
||||
@@ -1412,7 +1412,7 @@ var file_service_qgdzs_proto_rawDesc = []byte{
|
||||
0x65, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x07, 0x72, 0x65,
|
||||
0x63, 0x6f, 0x72, 0x64, 0x73, 0x22, 0xea, 0x01, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x52, 0x65, 0x63,
|
||||
0x6f, 0x72, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x1f, 0x0a, 0x0a, 0x51, 0x75, 0x65, 0x73, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x53, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x71, 0x75, 0x65,
|
||||
0x69, 0x6f, 0x6e, 0x53, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x51, 0x75, 0x65, 0x73,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c,
|
||||
@@ -1427,7 +1427,7 @@ var file_service_qgdzs_proto_rawDesc = []byte{
|
||||
0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69,
|
||||
0x6d, 0x65, 0x22, 0x35, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x12, 0x1f, 0x0a, 0x0a, 0x51, 0x75, 0x65, 0x73,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x53, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x71, 0x75,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x53, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x71, 0x75,
|
||||
0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x6e, 0x22, 0xa9, 0x01, 0x0a, 0x13, 0x47, 0x65,
|
||||
0x74, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73,
|
||||
0x70, 0x12, 0x1a, 0x0a, 0x08, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20,
|
||||
|
||||
@@ -26,8 +26,8 @@ type EnterReq struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
USN string `protobuf:"bytes,1,opt,name=USN,proto3" json:"USN,omitempty"` // 用户ID
|
||||
GatewaySID string `protobuf:"bytes,2,opt,name=GatewaySID,proto3" json:"GatewaySID,omitempty"` // 网关服务ID
|
||||
USN int64 `protobuf:"varint,1,opt,name=USN,proto3" json:"USN,omitempty"` // 用户ID
|
||||
GatewaySID int64 `protobuf:"varint,2,opt,name=GatewaySID,proto3" json:"GatewaySID,omitempty"` // 网关服务ID
|
||||
InstanceID int32 `protobuf:"varint,3,opt,name=InstanceID,proto3" json:"InstanceID,omitempty"` // 副本ID
|
||||
}
|
||||
|
||||
@@ -63,18 +63,18 @@ func (*EnterReq) Descriptor() ([]byte, []int) {
|
||||
return file_service_scene_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *EnterReq) GetUSN() string {
|
||||
func (x *EnterReq) GetUSN() int64 {
|
||||
if x != nil {
|
||||
return x.USN
|
||||
}
|
||||
return ""
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *EnterReq) GetGatewaySID() string {
|
||||
func (x *EnterReq) GetGatewaySID() int64 {
|
||||
if x != nil {
|
||||
return x.GatewaySID
|
||||
}
|
||||
return ""
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *EnterReq) GetInstanceID() int32 {
|
||||
@@ -89,8 +89,8 @@ type EnterResp struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
SceneSID string `protobuf:"bytes,1,opt,name=SceneSID,proto3" json:"SceneSID,omitempty"` // 场景服务ID
|
||||
UniqueNo string `protobuf:"bytes,2,opt,name=UniqueNo,proto3" json:"UniqueNo,omitempty"` // 副本唯一编号
|
||||
SceneSID int64 `protobuf:"varint,1,opt,name=SceneSID,proto3" json:"SceneSID,omitempty"` // 场景服务ID
|
||||
UniqueNo int64 `protobuf:"varint,2,opt,name=UniqueNo,proto3" json:"UniqueNo,omitempty"` // 副本唯一编号
|
||||
MessageID int32 `protobuf:"varint,3,opt,name=MessageID,proto3" json:"MessageID,omitempty"` // 发送给客户端的消息ID
|
||||
Payload []byte `protobuf:"bytes,4,opt,name=Payload,proto3" json:"Payload,omitempty"` // 消息负载
|
||||
}
|
||||
@@ -127,18 +127,18 @@ func (*EnterResp) Descriptor() ([]byte, []int) {
|
||||
return file_service_scene_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *EnterResp) GetSceneSID() string {
|
||||
func (x *EnterResp) GetSceneSID() int64 {
|
||||
if x != nil {
|
||||
return x.SceneSID
|
||||
}
|
||||
return ""
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *EnterResp) GetUniqueNo() string {
|
||||
func (x *EnterResp) GetUniqueNo() int64 {
|
||||
if x != nil {
|
||||
return x.UniqueNo
|
||||
}
|
||||
return ""
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *EnterResp) GetMessageID() int32 {
|
||||
@@ -160,8 +160,8 @@ type LeaveReq struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
USN string `protobuf:"bytes,1,opt,name=USN,proto3" json:"USN,omitempty"` // 用户ID
|
||||
UniqueNo string `protobuf:"bytes,2,opt,name=UniqueNo,proto3" json:"UniqueNo,omitempty"` // 副本唯一编号
|
||||
USN int64 `protobuf:"varint,1,opt,name=USN,proto3" json:"USN,omitempty"` // 用户ID
|
||||
UniqueNo int64 `protobuf:"varint,2,opt,name=UniqueNo,proto3" json:"UniqueNo,omitempty"` // 副本唯一编号
|
||||
}
|
||||
|
||||
func (x *LeaveReq) Reset() {
|
||||
@@ -196,18 +196,18 @@ func (*LeaveReq) Descriptor() ([]byte, []int) {
|
||||
return file_service_scene_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *LeaveReq) GetUSN() string {
|
||||
func (x *LeaveReq) GetUSN() int64 {
|
||||
if x != nil {
|
||||
return x.USN
|
||||
}
|
||||
return ""
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *LeaveReq) GetUniqueNo() string {
|
||||
func (x *LeaveReq) GetUniqueNo() int64 {
|
||||
if x != nil {
|
||||
return x.UniqueNo
|
||||
}
|
||||
return ""
|
||||
return 0
|
||||
}
|
||||
|
||||
type LeaveResp struct {
|
||||
@@ -253,8 +253,8 @@ type ActionReq struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
UniqueNo string `protobuf:"bytes,1,opt,name=UniqueNo,proto3" json:"UniqueNo,omitempty"` // 副本唯一编号
|
||||
USN string `protobuf:"bytes,2,opt,name=USN,proto3" json:"USN,omitempty"` // 用户ID
|
||||
UniqueNo int64 `protobuf:"varint,1,opt,name=UniqueNo,proto3" json:"UniqueNo,omitempty"` // 副本唯一编号
|
||||
USN int64 `protobuf:"varint,2,opt,name=USN,proto3" json:"USN,omitempty"` // 用户ID
|
||||
Action int32 `protobuf:"varint,3,opt,name=Action,proto3" json:"Action,omitempty"` // 指令ID
|
||||
DirX int32 `protobuf:"zigzag32,4,opt,name=DirX,proto3" json:"DirX,omitempty"` // 移动-X方向(×1000 缩放)
|
||||
DirY int32 `protobuf:"zigzag32,5,opt,name=DirY,proto3" json:"DirY,omitempty"` // 移动-Y方向(×1000 缩放)
|
||||
@@ -293,18 +293,18 @@ func (*ActionReq) Descriptor() ([]byte, []int) {
|
||||
return file_service_scene_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *ActionReq) GetUniqueNo() string {
|
||||
func (x *ActionReq) GetUniqueNo() int64 {
|
||||
if x != nil {
|
||||
return x.UniqueNo
|
||||
}
|
||||
return ""
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ActionReq) GetUSN() string {
|
||||
func (x *ActionReq) GetUSN() int64 {
|
||||
if x != nil {
|
||||
return x.USN
|
||||
}
|
||||
return ""
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ActionReq) GetAction() int32 {
|
||||
@@ -379,27 +379,27 @@ var file_service_scene_proto_rawDesc = []byte{
|
||||
0x0a, 0x13, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x73, 0x63, 0x65, 0x6e, 0x65, 0x2e,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x72, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
|
||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x5c, 0x0a, 0x08, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x52,
|
||||
0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52,
|
||||
0x03, 0x55, 0x53, 0x4e, 0x12, 0x1e, 0x0a, 0x0a, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x53,
|
||||
0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61,
|
||||
0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61,
|
||||
0x79, 0x53, 0x49, 0x44, 0x12, 0x1e, 0x0a, 0x0a, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65,
|
||||
0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e,
|
||||
0x63, 0x65, 0x49, 0x44, 0x22, 0x7b, 0x0a, 0x09, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73,
|
||||
0x70, 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x63, 0x65, 0x6e, 0x65, 0x53, 0x49, 0x44, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x08, 0x53, 0x63, 0x65, 0x6e, 0x65, 0x53, 0x49, 0x44, 0x12, 0x1a, 0x0a,
|
||||
0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x4e, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x01, 0x28, 0x03, 0x52, 0x08, 0x53, 0x63, 0x65, 0x6e, 0x65, 0x53, 0x49, 0x44, 0x12, 0x1a, 0x0a,
|
||||
0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x4e, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52,
|
||||
0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x4e, 0x6f, 0x12, 0x1c, 0x0a, 0x09, 0x4d, 0x65, 0x73,
|
||||
0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x4d, 0x65,
|
||||
0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f,
|
||||
0x61, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61,
|
||||
0x64, 0x22, 0x38, 0x0a, 0x08, 0x4c, 0x65, 0x61, 0x76, 0x65, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a,
|
||||
0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x55, 0x53, 0x4e, 0x12,
|
||||
0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x55, 0x53, 0x4e, 0x12,
|
||||
0x1a, 0x0a, 0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x4e, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x4e, 0x6f, 0x22, 0x0b, 0x0a, 0x09, 0x4c,
|
||||
0x03, 0x52, 0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x4e, 0x6f, 0x22, 0x0b, 0x0a, 0x09, 0x4c,
|
||||
0x65, 0x61, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x22, 0x93, 0x01, 0x0a, 0x09, 0x41, 0x63, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65,
|
||||
0x4e, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65,
|
||||
0x4e, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x4e, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65,
|
||||
0x4e, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52,
|
||||
0x03, 0x55, 0x53, 0x4e, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03,
|
||||
0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04,
|
||||
0x44, 0x69, 0x72, 0x58, 0x18, 0x04, 0x20, 0x01, 0x28, 0x11, 0x52, 0x04, 0x44, 0x69, 0x72, 0x58,
|
||||
|
||||
@@ -83,7 +83,7 @@ type PhoneLoginResp struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
USN string `protobuf:"bytes,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"` // 用户ID
|
||||
USN int64 `protobuf:"varint,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"` // 用户ID
|
||||
Name string `protobuf:"bytes,2,opt,name=Name,json=name,proto3" json:"Name,omitempty"` // 用户名
|
||||
}
|
||||
|
||||
@@ -119,11 +119,11 @@ func (*PhoneLoginResp) Descriptor() ([]byte, []int) {
|
||||
return file_service_user_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *PhoneLoginResp) GetUSN() string {
|
||||
func (x *PhoneLoginResp) GetUSN() int64 {
|
||||
if x != nil {
|
||||
return x.USN
|
||||
}
|
||||
return ""
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *PhoneLoginResp) GetName() string {
|
||||
@@ -186,7 +186,7 @@ type WxMiniLoginResp struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
USN string `protobuf:"bytes,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"` // 用户ID
|
||||
USN int64 `protobuf:"varint,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"` // 用户ID
|
||||
Name string `protobuf:"bytes,2,opt,name=Name,json=name,proto3" json:"Name,omitempty"` // 用户名
|
||||
}
|
||||
|
||||
@@ -222,11 +222,11 @@ func (*WxMiniLoginResp) Descriptor() ([]byte, []int) {
|
||||
return file_service_user_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *WxMiniLoginResp) GetUSN() string {
|
||||
func (x *WxMiniLoginResp) GetUSN() int64 {
|
||||
if x != nil {
|
||||
return x.USN
|
||||
}
|
||||
return ""
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *WxMiniLoginResp) GetName() string {
|
||||
@@ -242,7 +242,7 @@ type GetUserInfoReq struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
USN string `protobuf:"bytes,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"`
|
||||
USN int64 `protobuf:"varint,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"`
|
||||
}
|
||||
|
||||
func (x *GetUserInfoReq) Reset() {
|
||||
@@ -277,11 +277,11 @@ func (*GetUserInfoReq) Descriptor() ([]byte, []int) {
|
||||
return file_service_user_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *GetUserInfoReq) GetUSN() string {
|
||||
func (x *GetUserInfoReq) GetUSN() int64 {
|
||||
if x != nil {
|
||||
return x.USN
|
||||
}
|
||||
return ""
|
||||
return 0
|
||||
}
|
||||
|
||||
type GetUserInfoResp struct {
|
||||
@@ -289,7 +289,7 @@ type GetUserInfoResp struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
USN string `protobuf:"bytes,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"`
|
||||
USN int64 `protobuf:"varint,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"`
|
||||
Name string `protobuf:"bytes,2,opt,name=Name,json=name,proto3" json:"Name,omitempty"`
|
||||
}
|
||||
|
||||
@@ -325,11 +325,11 @@ func (*GetUserInfoResp) Descriptor() ([]byte, []int) {
|
||||
return file_service_user_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *GetUserInfoResp) GetUSN() string {
|
||||
func (x *GetUserInfoResp) GetUSN() int64 {
|
||||
if x != nil {
|
||||
return x.USN
|
||||
}
|
||||
return ""
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *GetUserInfoResp) GetName() string {
|
||||
@@ -351,19 +351,19 @@ var file_service_user_proto_rawDesc = []byte{
|
||||
0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x6f,
|
||||
0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x36,
|
||||
0x0a, 0x0e, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70,
|
||||
0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75,
|
||||
0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x75,
|
||||
0x73, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x24, 0x0a, 0x0e, 0x57, 0x78, 0x4d, 0x69, 0x6e, 0x69,
|
||||
0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x37, 0x0a, 0x0f,
|
||||
0x57, 0x78, 0x4d, 0x69, 0x6e, 0x69, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12,
|
||||
0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x73,
|
||||
0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x75, 0x73,
|
||||
0x6e, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x22, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72,
|
||||
0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x73, 0x6e, 0x22, 0x37, 0x0a, 0x0f, 0x47, 0x65, 0x74,
|
||||
0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x75, 0x73, 0x6e, 0x22, 0x37, 0x0a, 0x0f, 0x47, 0x65, 0x74,
|
||||
0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03,
|
||||
0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x73, 0x6e, 0x12, 0x12,
|
||||
0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x75, 0x73, 0x6e, 0x12, 0x12,
|
||||
0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61,
|
||||
0x6d, 0x65, 0x32, 0xb9, 0x01, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x2f, 0x0a, 0x0a, 0x50,
|
||||
0x68, 0x6f, 0x6e, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x0e, 0x2e, 0x50, 0x68, 0x6f, 0x6e,
|
||||
|
||||
@@ -259,7 +259,7 @@ type PositionInfo struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
USN string `protobuf:"bytes,1,opt,name=USN,proto3" json:"USN,omitempty"`
|
||||
USN int64 `protobuf:"varint,1,opt,name=USN,proto3" json:"USN,omitempty"`
|
||||
X int32 `protobuf:"zigzag32,2,opt,name=X,proto3" json:"X,omitempty"`
|
||||
Y int32 `protobuf:"zigzag32,3,opt,name=Y,proto3" json:"Y,omitempty"`
|
||||
}
|
||||
@@ -296,11 +296,11 @@ func (*PositionInfo) Descriptor() ([]byte, []int) {
|
||||
return file_action_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *PositionInfo) GetUSN() string {
|
||||
func (x *PositionInfo) GetUSN() int64 {
|
||||
if x != nil {
|
||||
return x.USN
|
||||
}
|
||||
return ""
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *PositionInfo) GetX() int32 {
|
||||
@@ -388,7 +388,7 @@ var file_action_proto_rawDesc = []byte{
|
||||
0x12, 0x18, 0x0a, 0x07, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x49, 0x44, 0x18, 0x06, 0x20, 0x01, 0x28,
|
||||
0x05, 0x52, 0x07, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x49, 0x44, 0x22, 0x3c, 0x0a, 0x0c, 0x50, 0x6f,
|
||||
0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53,
|
||||
0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x55, 0x53, 0x4e, 0x12, 0x0c, 0x0a, 0x01,
|
||||
0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x55, 0x53, 0x4e, 0x12, 0x0c, 0x0a, 0x01,
|
||||
0x58, 0x18, 0x02, 0x20, 0x01, 0x28, 0x11, 0x52, 0x01, 0x58, 0x12, 0x0c, 0x0a, 0x01, 0x59, 0x18,
|
||||
0x03, 0x20, 0x01, 0x28, 0x11, 0x52, 0x01, 0x59, 0x22, 0x31, 0x0a, 0x0c, 0x53, 0x32, 0x43, 0x5f,
|
||||
0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x0a, 0x04, 0x49, 0x6e, 0x66, 0x6f,
|
||||
|
||||
10
utils/jwt.go
10
utils/jwt.go
@@ -9,11 +9,11 @@ import (
|
||||
)
|
||||
|
||||
type Claims struct {
|
||||
USN string `json:"usn"`
|
||||
USN int64 `json:"usn"`
|
||||
jwt.RegisteredClaims
|
||||
}
|
||||
|
||||
func GenToken(usn string, secret string, expires time.Duration) (string, error) {
|
||||
func GenToken(usn int64, secret string, expires time.Duration) (string, error) {
|
||||
token := jwt.NewWithClaims(jwt.SigningMethodHS256, Claims{
|
||||
USN: usn,
|
||||
RegisteredClaims: jwt.RegisteredClaims{
|
||||
@@ -40,13 +40,13 @@ func ParseToken(tokenString string, secret string) (*Claims, error) {
|
||||
return claims, nil
|
||||
}
|
||||
|
||||
func ShouldBindUsn(ctx context.Context, usn *string) bool {
|
||||
func ShouldBindUsn(ctx context.Context, usn *int64) bool {
|
||||
if md, ok := metadata.FromIncomingContext(ctx); ok {
|
||||
usnArr := md.Get("X-Usn")
|
||||
if len(usnArr) == 0 || usnArr[0] == "" {
|
||||
return false
|
||||
}
|
||||
*usn = usnArr[0]
|
||||
*usn = StringToInt64(usnArr[0])
|
||||
}
|
||||
return *usn != ""
|
||||
return *usn != 0
|
||||
}
|
||||
|
||||
@@ -21,3 +21,8 @@ func StringToInt64(s string) int64 {
|
||||
}
|
||||
return i
|
||||
}
|
||||
|
||||
// Int64ToString converts int64 to string
|
||||
func Int64ToString(i int64) string {
|
||||
return strconv.FormatInt(i, 10)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user