feat: user logout
CI / changes (push) Successful in 1m30s
CI / ad (push) Successful in 0s
CI / admin (push) Successful in 0s
CI / aiserver (push) Successful in 0s
CI / analysis (push) Successful in 35s
CI / bff (push) Successful in 19s
CI / chore (push) Successful in 1s
CI / equipment (push) Successful in 0s
CI / express (push) Successful in 0s
CI / factory (push) Successful in 0s
CI / message (push) Successful in 0s
CI / order (push) Successful in 0s
CI / payment (push) Successful in 0s
CI / percutaneous (push) Successful in 1s
CI / product (push) Successful in 0s
CI / record (push) Successful in 1s
CI / sale (push) Successful in 0s
CI / store (push) Successful in 0s
CI / support (push) Successful in 0s
CI / task (push) Successful in 0s
CI / user (push) Successful in 24s
CI / water (push) Successful in 0s
CI / wecom (push) Successful in 0s
CI / ws (push) Successful in 0s
CI / changes (push) Successful in 1m30s
CI / ad (push) Successful in 0s
CI / admin (push) Successful in 0s
CI / aiserver (push) Successful in 0s
CI / analysis (push) Successful in 35s
CI / bff (push) Successful in 19s
CI / chore (push) Successful in 1s
CI / equipment (push) Successful in 0s
CI / express (push) Successful in 0s
CI / factory (push) Successful in 0s
CI / message (push) Successful in 0s
CI / order (push) Successful in 0s
CI / payment (push) Successful in 0s
CI / percutaneous (push) Successful in 1s
CI / product (push) Successful in 0s
CI / record (push) Successful in 1s
CI / sale (push) Successful in 0s
CI / store (push) Successful in 0s
CI / support (push) Successful in 0s
CI / task (push) Successful in 0s
CI / user (push) Successful in 24s
CI / water (push) Successful in 0s
CI / wecom (push) Successful in 0s
CI / ws (push) Successful in 0s
This commit is contained in:
+121
-80
@@ -2179,6 +2179,42 @@ func (*InfoReq) Descriptor() ([]byte, []int) {
|
|||||||
return file_user_user_proto_rawDescGZIP(), []int{34}
|
return file_user_user_proto_rawDescGZIP(), []int{34}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type LogoutReq struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *LogoutReq) Reset() {
|
||||||
|
*x = LogoutReq{}
|
||||||
|
mi := &file_user_user_proto_msgTypes[35]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *LogoutReq) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*LogoutReq) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *LogoutReq) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_user_user_proto_msgTypes[35]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use LogoutReq.ProtoReflect.Descriptor instead.
|
||||||
|
func (*LogoutReq) Descriptor() ([]byte, []int) {
|
||||||
|
return file_user_user_proto_rawDescGZIP(), []int{35}
|
||||||
|
}
|
||||||
|
|
||||||
type UpdateReq struct {
|
type UpdateReq struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
@@ -2193,7 +2229,7 @@ type UpdateReq struct {
|
|||||||
|
|
||||||
func (x *UpdateReq) Reset() {
|
func (x *UpdateReq) Reset() {
|
||||||
*x = UpdateReq{}
|
*x = UpdateReq{}
|
||||||
mi := &file_user_user_proto_msgTypes[35]
|
mi := &file_user_user_proto_msgTypes[36]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@@ -2205,7 +2241,7 @@ func (x *UpdateReq) String() string {
|
|||||||
func (*UpdateReq) ProtoMessage() {}
|
func (*UpdateReq) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *UpdateReq) ProtoReflect() protoreflect.Message {
|
func (x *UpdateReq) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_user_user_proto_msgTypes[35]
|
mi := &file_user_user_proto_msgTypes[36]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@@ -2218,7 +2254,7 @@ func (x *UpdateReq) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use UpdateReq.ProtoReflect.Descriptor instead.
|
// Deprecated: Use UpdateReq.ProtoReflect.Descriptor instead.
|
||||||
func (*UpdateReq) Descriptor() ([]byte, []int) {
|
func (*UpdateReq) Descriptor() ([]byte, []int) {
|
||||||
return file_user_user_proto_rawDescGZIP(), []int{35}
|
return file_user_user_proto_rawDescGZIP(), []int{36}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *UpdateReq) GetName() string {
|
func (x *UpdateReq) GetName() string {
|
||||||
@@ -2273,7 +2309,7 @@ type PasswordReq struct {
|
|||||||
|
|
||||||
func (x *PasswordReq) Reset() {
|
func (x *PasswordReq) Reset() {
|
||||||
*x = PasswordReq{}
|
*x = PasswordReq{}
|
||||||
mi := &file_user_user_proto_msgTypes[36]
|
mi := &file_user_user_proto_msgTypes[37]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@@ -2285,7 +2321,7 @@ func (x *PasswordReq) String() string {
|
|||||||
func (*PasswordReq) ProtoMessage() {}
|
func (*PasswordReq) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *PasswordReq) ProtoReflect() protoreflect.Message {
|
func (x *PasswordReq) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_user_user_proto_msgTypes[36]
|
mi := &file_user_user_proto_msgTypes[37]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@@ -2298,7 +2334,7 @@ func (x *PasswordReq) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use PasswordReq.ProtoReflect.Descriptor instead.
|
// Deprecated: Use PasswordReq.ProtoReflect.Descriptor instead.
|
||||||
func (*PasswordReq) Descriptor() ([]byte, []int) {
|
func (*PasswordReq) Descriptor() ([]byte, []int) {
|
||||||
return file_user_user_proto_rawDescGZIP(), []int{36}
|
return file_user_user_proto_rawDescGZIP(), []int{37}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *PasswordReq) GetPassword() string {
|
func (x *PasswordReq) GetPassword() string {
|
||||||
@@ -2326,7 +2362,7 @@ type ClientReq struct {
|
|||||||
|
|
||||||
func (x *ClientReq) Reset() {
|
func (x *ClientReq) Reset() {
|
||||||
*x = ClientReq{}
|
*x = ClientReq{}
|
||||||
mi := &file_user_user_proto_msgTypes[37]
|
mi := &file_user_user_proto_msgTypes[38]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@@ -2338,7 +2374,7 @@ func (x *ClientReq) String() string {
|
|||||||
func (*ClientReq) ProtoMessage() {}
|
func (*ClientReq) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *ClientReq) ProtoReflect() protoreflect.Message {
|
func (x *ClientReq) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_user_user_proto_msgTypes[37]
|
mi := &file_user_user_proto_msgTypes[38]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@@ -2351,7 +2387,7 @@ func (x *ClientReq) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use ClientReq.ProtoReflect.Descriptor instead.
|
// Deprecated: Use ClientReq.ProtoReflect.Descriptor instead.
|
||||||
func (*ClientReq) Descriptor() ([]byte, []int) {
|
func (*ClientReq) Descriptor() ([]byte, []int) {
|
||||||
return file_user_user_proto_rawDescGZIP(), []int{37}
|
return file_user_user_proto_rawDescGZIP(), []int{38}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ClientReq) GetName() string {
|
func (x *ClientReq) GetName() string {
|
||||||
@@ -2384,7 +2420,7 @@ type GenerateQrcodeReq struct {
|
|||||||
|
|
||||||
func (x *GenerateQrcodeReq) Reset() {
|
func (x *GenerateQrcodeReq) Reset() {
|
||||||
*x = GenerateQrcodeReq{}
|
*x = GenerateQrcodeReq{}
|
||||||
mi := &file_user_user_proto_msgTypes[38]
|
mi := &file_user_user_proto_msgTypes[39]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@@ -2396,7 +2432,7 @@ func (x *GenerateQrcodeReq) String() string {
|
|||||||
func (*GenerateQrcodeReq) ProtoMessage() {}
|
func (*GenerateQrcodeReq) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *GenerateQrcodeReq) ProtoReflect() protoreflect.Message {
|
func (x *GenerateQrcodeReq) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_user_user_proto_msgTypes[38]
|
mi := &file_user_user_proto_msgTypes[39]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@@ -2409,7 +2445,7 @@ func (x *GenerateQrcodeReq) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use GenerateQrcodeReq.ProtoReflect.Descriptor instead.
|
// Deprecated: Use GenerateQrcodeReq.ProtoReflect.Descriptor instead.
|
||||||
func (*GenerateQrcodeReq) Descriptor() ([]byte, []int) {
|
func (*GenerateQrcodeReq) Descriptor() ([]byte, []int) {
|
||||||
return file_user_user_proto_rawDescGZIP(), []int{38}
|
return file_user_user_proto_rawDescGZIP(), []int{39}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GenerateQrcodeReq) GetClientCode() string {
|
func (x *GenerateQrcodeReq) GetClientCode() string {
|
||||||
@@ -2428,7 +2464,7 @@ type QrcodeScanReq struct {
|
|||||||
|
|
||||||
func (x *QrcodeScanReq) Reset() {
|
func (x *QrcodeScanReq) Reset() {
|
||||||
*x = QrcodeScanReq{}
|
*x = QrcodeScanReq{}
|
||||||
mi := &file_user_user_proto_msgTypes[39]
|
mi := &file_user_user_proto_msgTypes[40]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@@ -2440,7 +2476,7 @@ func (x *QrcodeScanReq) String() string {
|
|||||||
func (*QrcodeScanReq) ProtoMessage() {}
|
func (*QrcodeScanReq) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *QrcodeScanReq) ProtoReflect() protoreflect.Message {
|
func (x *QrcodeScanReq) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_user_user_proto_msgTypes[39]
|
mi := &file_user_user_proto_msgTypes[40]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@@ -2453,7 +2489,7 @@ func (x *QrcodeScanReq) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use QrcodeScanReq.ProtoReflect.Descriptor instead.
|
// Deprecated: Use QrcodeScanReq.ProtoReflect.Descriptor instead.
|
||||||
func (*QrcodeScanReq) Descriptor() ([]byte, []int) {
|
func (*QrcodeScanReq) Descriptor() ([]byte, []int) {
|
||||||
return file_user_user_proto_rawDescGZIP(), []int{39}
|
return file_user_user_proto_rawDescGZIP(), []int{40}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *QrcodeScanReq) GetSessionId() string {
|
func (x *QrcodeScanReq) GetSessionId() string {
|
||||||
@@ -2473,7 +2509,7 @@ type QrcodeLoginReq struct {
|
|||||||
|
|
||||||
func (x *QrcodeLoginReq) Reset() {
|
func (x *QrcodeLoginReq) Reset() {
|
||||||
*x = QrcodeLoginReq{}
|
*x = QrcodeLoginReq{}
|
||||||
mi := &file_user_user_proto_msgTypes[40]
|
mi := &file_user_user_proto_msgTypes[41]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@@ -2485,7 +2521,7 @@ func (x *QrcodeLoginReq) String() string {
|
|||||||
func (*QrcodeLoginReq) ProtoMessage() {}
|
func (*QrcodeLoginReq) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *QrcodeLoginReq) ProtoReflect() protoreflect.Message {
|
func (x *QrcodeLoginReq) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_user_user_proto_msgTypes[40]
|
mi := &file_user_user_proto_msgTypes[41]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@@ -2498,7 +2534,7 @@ func (x *QrcodeLoginReq) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use QrcodeLoginReq.ProtoReflect.Descriptor instead.
|
// Deprecated: Use QrcodeLoginReq.ProtoReflect.Descriptor instead.
|
||||||
func (*QrcodeLoginReq) Descriptor() ([]byte, []int) {
|
func (*QrcodeLoginReq) Descriptor() ([]byte, []int) {
|
||||||
return file_user_user_proto_rawDescGZIP(), []int{40}
|
return file_user_user_proto_rawDescGZIP(), []int{41}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *QrcodeLoginReq) GetSessionId() string {
|
func (x *QrcodeLoginReq) GetSessionId() string {
|
||||||
@@ -2685,7 +2721,8 @@ const file_user_user_proto_rawDesc = "" +
|
|||||||
"\n" +
|
"\n" +
|
||||||
"new_mobile\x18\x02 \x01(\tR\tnewMobile\x12\x19\n" +
|
"new_mobile\x18\x02 \x01(\tR\tnewMobile\x12\x19\n" +
|
||||||
"\bsms_code\x18\x03 \x01(\tR\asmsCode\"\t\n" +
|
"\bsms_code\x18\x03 \x01(\tR\asmsCode\"\t\n" +
|
||||||
"\aInfoReq\"\xa0\x01\n" +
|
"\aInfoReq\"\v\n" +
|
||||||
|
"\tLogoutReq\"\xa0\x01\n" +
|
||||||
"\tUpdateReq\x12\x12\n" +
|
"\tUpdateReq\x12\x12\n" +
|
||||||
"\x04name\x18\x01 \x01(\tR\x04name\x12\x16\n" +
|
"\x04name\x18\x01 \x01(\tR\x04name\x12\x16\n" +
|
||||||
"\x06avatar\x18\x02 \x01(\tR\x06avatar\x12\x16\n" +
|
"\x06avatar\x18\x02 \x01(\tR\x06avatar\x12\x16\n" +
|
||||||
@@ -2709,9 +2746,10 @@ const file_user_user_proto_rawDesc = "" +
|
|||||||
"\x0eQrcodeLoginReq\x12\x1d\n" +
|
"\x0eQrcodeLoginReq\x12\x1d\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"session_id\x18\x01 \x01(\tR\tsessionId\x12\x12\n" +
|
"session_id\x18\x01 \x01(\tR\tsessionId\x12\x12\n" +
|
||||||
"\x04type\x18\x02 \x01(\x05R\x04type2\xa0\x10\n" +
|
"\x04type\x18\x02 \x01(\x05R\x04type2\xeb\x10\n" +
|
||||||
"\x04User\x12F\n" +
|
"\x04User\x12F\n" +
|
||||||
"\x05Login\x12\x0e.user.LoginReq\x1a\x0e.user.Response\"\x1d\x82\xd3\xe4\x93\x02\x17:\x01*\"\x12/api/v3/user/login\x12b\n" +
|
"\x05Login\x12\x0e.user.LoginReq\x1a\x0e.user.Response\"\x1d\x82\xd3\xe4\x93\x02\x17:\x01*\"\x12/api/v3/user/login\x12I\n" +
|
||||||
|
"\x06Logout\x12\x0f.user.LogoutReq\x1a\x0e.user.Response\"\x1e\x82\xd3\xe4\x93\x02\x18:\x01*\"\x13/api/v3/user/logout\x12b\n" +
|
||||||
"\x0eGenerateQrcode\x12\x17.user.GenerateQrcodeReq\x1a\x0e.user.Response\"'\x82\xd3\xe4\x93\x02!:\x01*\"\x1c/api/v3/user/qrcode/generate\x12V\n" +
|
"\x0eGenerateQrcode\x12\x17.user.GenerateQrcodeReq\x1a\x0e.user.Response\"'\x82\xd3\xe4\x93\x02!:\x01*\"\x1c/api/v3/user/qrcode/generate\x12V\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"QrcodeScan\x12\x13.user.QrcodeScanReq\x1a\x0e.user.Response\"#\x82\xd3\xe4\x93\x02\x1d:\x01*\"\x18/api/v3/user/qrcode/scan\x12Y\n" +
|
"QrcodeScan\x12\x13.user.QrcodeScanReq\x1a\x0e.user.Response\"#\x82\xd3\xe4\x93\x02\x1d:\x01*\"\x18/api/v3/user/qrcode/scan\x12Y\n" +
|
||||||
@@ -2752,7 +2790,7 @@ func file_user_user_proto_rawDescGZIP() []byte {
|
|||||||
return file_user_user_proto_rawDescData
|
return file_user_user_proto_rawDescData
|
||||||
}
|
}
|
||||||
|
|
||||||
var file_user_user_proto_msgTypes = make([]protoimpl.MessageInfo, 41)
|
var file_user_user_proto_msgTypes = make([]protoimpl.MessageInfo, 42)
|
||||||
var file_user_user_proto_goTypes = []any{
|
var file_user_user_proto_goTypes = []any{
|
||||||
(*Response)(nil), // 0: user.Response
|
(*Response)(nil), // 0: user.Response
|
||||||
(*LoginReq)(nil), // 1: user.LoginReq
|
(*LoginReq)(nil), // 1: user.LoginReq
|
||||||
@@ -2789,69 +2827,72 @@ var file_user_user_proto_goTypes = []any{
|
|||||||
(*BindMobileReq)(nil), // 32: user.BindMobileReq
|
(*BindMobileReq)(nil), // 32: user.BindMobileReq
|
||||||
(*RebindMobileReq)(nil), // 33: user.RebindMobileReq
|
(*RebindMobileReq)(nil), // 33: user.RebindMobileReq
|
||||||
(*InfoReq)(nil), // 34: user.InfoReq
|
(*InfoReq)(nil), // 34: user.InfoReq
|
||||||
(*UpdateReq)(nil), // 35: user.UpdateReq
|
(*LogoutReq)(nil), // 35: user.LogoutReq
|
||||||
(*PasswordReq)(nil), // 36: user.PasswordReq
|
(*UpdateReq)(nil), // 36: user.UpdateReq
|
||||||
(*ClientReq)(nil), // 37: user.ClientReq
|
(*PasswordReq)(nil), // 37: user.PasswordReq
|
||||||
(*GenerateQrcodeReq)(nil), // 38: user.GenerateQrcodeReq
|
(*ClientReq)(nil), // 38: user.ClientReq
|
||||||
(*QrcodeScanReq)(nil), // 39: user.QrcodeScanReq
|
(*GenerateQrcodeReq)(nil), // 39: user.GenerateQrcodeReq
|
||||||
(*QrcodeLoginReq)(nil), // 40: user.QrcodeLoginReq
|
(*QrcodeScanReq)(nil), // 40: user.QrcodeScanReq
|
||||||
|
(*QrcodeLoginReq)(nil), // 41: user.QrcodeLoginReq
|
||||||
}
|
}
|
||||||
var file_user_user_proto_depIdxs = []int32{
|
var file_user_user_proto_depIdxs = []int32{
|
||||||
7, // 0: user.InternalUsersByIdsData.items:type_name -> user.UserBriefItem
|
7, // 0: user.InternalUsersByIdsData.items:type_name -> user.UserBriefItem
|
||||||
14, // 1: user.InternalDeleteUserData.clients:type_name -> user.InternalDeleteUserClient
|
14, // 1: user.InternalDeleteUserData.clients:type_name -> user.InternalDeleteUserClient
|
||||||
27, // 2: user.InternalUsersByBizData.items:type_name -> user.BizUserItem
|
27, // 2: user.InternalUsersByBizData.items:type_name -> user.BizUserItem
|
||||||
1, // 3: user.User.Login:input_type -> user.LoginReq
|
1, // 3: user.User.Login:input_type -> user.LoginReq
|
||||||
38, // 4: user.User.GenerateQrcode:input_type -> user.GenerateQrcodeReq
|
35, // 4: user.User.Logout:input_type -> user.LogoutReq
|
||||||
39, // 5: user.User.QrcodeScan:input_type -> user.QrcodeScanReq
|
39, // 5: user.User.GenerateQrcode:input_type -> user.GenerateQrcodeReq
|
||||||
40, // 6: user.User.QrcodeLogin:input_type -> user.QrcodeLoginReq
|
40, // 6: user.User.QrcodeScan:input_type -> user.QrcodeScanReq
|
||||||
34, // 7: user.User.Info:input_type -> user.InfoReq
|
41, // 7: user.User.QrcodeLogin:input_type -> user.QrcodeLoginReq
|
||||||
35, // 8: user.User.Update:input_type -> user.UpdateReq
|
34, // 8: user.User.Info:input_type -> user.InfoReq
|
||||||
36, // 9: user.User.Password:input_type -> user.PasswordReq
|
36, // 9: user.User.Update:input_type -> user.UpdateReq
|
||||||
31, // 10: user.User.GetOpenid:input_type -> user.GetOpenidReq
|
37, // 10: user.User.Password:input_type -> user.PasswordReq
|
||||||
32, // 11: user.User.BindMobile:input_type -> user.BindMobileReq
|
31, // 11: user.User.GetOpenid:input_type -> user.GetOpenidReq
|
||||||
33, // 12: user.User.RebindMobile:input_type -> user.RebindMobileReq
|
32, // 12: user.User.BindMobile:input_type -> user.BindMobileReq
|
||||||
37, // 13: user.User.Client:input_type -> user.ClientReq
|
33, // 13: user.User.RebindMobile:input_type -> user.RebindMobileReq
|
||||||
2, // 14: user.User.UserItems:input_type -> user.UserItemsReq
|
38, // 14: user.User.Client:input_type -> user.ClientReq
|
||||||
3, // 15: user.User.UserStatus:input_type -> user.UserStatusReq
|
2, // 15: user.User.UserItems:input_type -> user.UserItemsReq
|
||||||
4, // 16: user.User.InternalCreate:input_type -> user.InternalCreateReq
|
3, // 16: user.User.UserStatus:input_type -> user.UserStatusReq
|
||||||
16, // 17: user.User.InternalCheckCreate:input_type -> user.InternalCheckCreateReq
|
4, // 17: user.User.InternalCreate:input_type -> user.InternalCreateReq
|
||||||
18, // 18: user.User.InternalCheckUpdate:input_type -> user.InternalCheckUpdateReq
|
16, // 18: user.User.InternalCheckCreate:input_type -> user.InternalCheckCreateReq
|
||||||
20, // 19: user.User.InternalUpdate:input_type -> user.InternalUpdateReq
|
18, // 19: user.User.InternalCheckUpdate:input_type -> user.InternalCheckUpdateReq
|
||||||
6, // 20: user.User.InternalUsersByIds:input_type -> user.InternalUsersByIdsReq
|
20, // 20: user.User.InternalUpdate:input_type -> user.InternalUpdateReq
|
||||||
9, // 21: user.User.InternalUpdateMobile:input_type -> user.InternalUpdateMobileReq
|
6, // 21: user.User.InternalUsersByIds:input_type -> user.InternalUsersByIdsReq
|
||||||
11, // 22: user.User.InternalRevokeBizClient:input_type -> user.InternalRevokeBizClientReq
|
9, // 22: user.User.InternalUpdateMobile:input_type -> user.InternalUpdateMobileReq
|
||||||
13, // 23: user.User.InternalDeleteUser:input_type -> user.InternalDeleteUserReq
|
11, // 23: user.User.InternalRevokeBizClient:input_type -> user.InternalRevokeBizClientReq
|
||||||
22, // 24: user.User.InternalGetUserInfo:input_type -> user.InternalGetUserInfoReq
|
13, // 24: user.User.InternalDeleteUser:input_type -> user.InternalDeleteUserReq
|
||||||
24, // 25: user.User.InternalVerifyPassword:input_type -> user.InternalVerifyPasswordReq
|
22, // 25: user.User.InternalGetUserInfo:input_type -> user.InternalGetUserInfoReq
|
||||||
26, // 26: user.User.InternalUsersByBiz:input_type -> user.InternalUsersByBizReq
|
24, // 26: user.User.InternalVerifyPassword:input_type -> user.InternalVerifyPasswordReq
|
||||||
29, // 27: user.User.InternalLoginByUserId:input_type -> user.InternalLoginByUserIdReq
|
26, // 27: user.User.InternalUsersByBiz:input_type -> user.InternalUsersByBizReq
|
||||||
0, // 28: user.User.Login:output_type -> user.Response
|
29, // 28: user.User.InternalLoginByUserId:input_type -> user.InternalLoginByUserIdReq
|
||||||
0, // 29: user.User.GenerateQrcode:output_type -> user.Response
|
0, // 29: user.User.Login:output_type -> user.Response
|
||||||
0, // 30: user.User.QrcodeScan:output_type -> user.Response
|
0, // 30: user.User.Logout:output_type -> user.Response
|
||||||
0, // 31: user.User.QrcodeLogin:output_type -> user.Response
|
0, // 31: user.User.GenerateQrcode:output_type -> user.Response
|
||||||
0, // 32: user.User.Info:output_type -> user.Response
|
0, // 32: user.User.QrcodeScan:output_type -> user.Response
|
||||||
0, // 33: user.User.Update:output_type -> user.Response
|
0, // 33: user.User.QrcodeLogin:output_type -> user.Response
|
||||||
0, // 34: user.User.Password:output_type -> user.Response
|
0, // 34: user.User.Info:output_type -> user.Response
|
||||||
0, // 35: user.User.GetOpenid:output_type -> user.Response
|
0, // 35: user.User.Update:output_type -> user.Response
|
||||||
0, // 36: user.User.BindMobile:output_type -> user.Response
|
0, // 36: user.User.Password:output_type -> user.Response
|
||||||
0, // 37: user.User.RebindMobile:output_type -> user.Response
|
0, // 37: user.User.GetOpenid:output_type -> user.Response
|
||||||
0, // 38: user.User.Client:output_type -> user.Response
|
0, // 38: user.User.BindMobile:output_type -> user.Response
|
||||||
0, // 39: user.User.UserItems:output_type -> user.Response
|
0, // 39: user.User.RebindMobile:output_type -> user.Response
|
||||||
0, // 40: user.User.UserStatus:output_type -> user.Response
|
0, // 40: user.User.Client:output_type -> user.Response
|
||||||
5, // 41: user.User.InternalCreate:output_type -> user.InternalCreateData
|
0, // 41: user.User.UserItems:output_type -> user.Response
|
||||||
17, // 42: user.User.InternalCheckCreate:output_type -> user.InternalCheckCreateData
|
0, // 42: user.User.UserStatus:output_type -> user.Response
|
||||||
19, // 43: user.User.InternalCheckUpdate:output_type -> user.InternalCheckUpdateData
|
5, // 43: user.User.InternalCreate:output_type -> user.InternalCreateData
|
||||||
21, // 44: user.User.InternalUpdate:output_type -> user.InternalUpdateData
|
17, // 44: user.User.InternalCheckCreate:output_type -> user.InternalCheckCreateData
|
||||||
8, // 45: user.User.InternalUsersByIds:output_type -> user.InternalUsersByIdsData
|
19, // 45: user.User.InternalCheckUpdate:output_type -> user.InternalCheckUpdateData
|
||||||
10, // 46: user.User.InternalUpdateMobile:output_type -> user.InternalUpdateMobileData
|
21, // 46: user.User.InternalUpdate:output_type -> user.InternalUpdateData
|
||||||
12, // 47: user.User.InternalRevokeBizClient:output_type -> user.InternalRevokeBizClientData
|
8, // 47: user.User.InternalUsersByIds:output_type -> user.InternalUsersByIdsData
|
||||||
15, // 48: user.User.InternalDeleteUser:output_type -> user.InternalDeleteUserData
|
10, // 48: user.User.InternalUpdateMobile:output_type -> user.InternalUpdateMobileData
|
||||||
23, // 49: user.User.InternalGetUserInfo:output_type -> user.InternalGetUserInfoData
|
12, // 49: user.User.InternalRevokeBizClient:output_type -> user.InternalRevokeBizClientData
|
||||||
25, // 50: user.User.InternalVerifyPassword:output_type -> user.InternalVerifyPasswordData
|
15, // 50: user.User.InternalDeleteUser:output_type -> user.InternalDeleteUserData
|
||||||
28, // 51: user.User.InternalUsersByBiz:output_type -> user.InternalUsersByBizData
|
23, // 51: user.User.InternalGetUserInfo:output_type -> user.InternalGetUserInfoData
|
||||||
30, // 52: user.User.InternalLoginByUserId:output_type -> user.InternalLoginByUserIdData
|
25, // 52: user.User.InternalVerifyPassword:output_type -> user.InternalVerifyPasswordData
|
||||||
28, // [28:53] is the sub-list for method output_type
|
28, // 53: user.User.InternalUsersByBiz:output_type -> user.InternalUsersByBizData
|
||||||
3, // [3:28] is the sub-list for method input_type
|
30, // 54: user.User.InternalLoginByUserId:output_type -> user.InternalLoginByUserIdData
|
||||||
|
29, // [29:55] is the sub-list for method output_type
|
||||||
|
3, // [3:29] is the sub-list for method input_type
|
||||||
3, // [3:3] is the sub-list for extension type_name
|
3, // [3:3] is the sub-list for extension type_name
|
||||||
3, // [3:3] is the sub-list for extension extendee
|
3, // [3:3] is the sub-list for extension extendee
|
||||||
0, // [0:3] is the sub-list for field type_name
|
0, // [0:3] is the sub-list for field type_name
|
||||||
@@ -2868,7 +2909,7 @@ func file_user_user_proto_init() {
|
|||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_user_user_proto_rawDesc), len(file_user_user_proto_rawDesc)),
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_user_user_proto_rawDesc), len(file_user_user_proto_rawDesc)),
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 41,
|
NumMessages: 42,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 1,
|
NumServices: 1,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ const _ = grpc.SupportPackageIsVersion9
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
User_Login_FullMethodName = "/user.User/Login"
|
User_Login_FullMethodName = "/user.User/Login"
|
||||||
|
User_Logout_FullMethodName = "/user.User/Logout"
|
||||||
User_GenerateQrcode_FullMethodName = "/user.User/GenerateQrcode"
|
User_GenerateQrcode_FullMethodName = "/user.User/GenerateQrcode"
|
||||||
User_QrcodeScan_FullMethodName = "/user.User/QrcodeScan"
|
User_QrcodeScan_FullMethodName = "/user.User/QrcodeScan"
|
||||||
User_QrcodeLogin_FullMethodName = "/user.User/QrcodeLogin"
|
User_QrcodeLogin_FullMethodName = "/user.User/QrcodeLogin"
|
||||||
@@ -51,6 +52,7 @@ const (
|
|||||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||||
type UserClient interface {
|
type UserClient interface {
|
||||||
Login(ctx context.Context, in *LoginReq, opts ...grpc.CallOption) (*Response, error)
|
Login(ctx context.Context, in *LoginReq, opts ...grpc.CallOption) (*Response, error)
|
||||||
|
Logout(ctx context.Context, in *LogoutReq, opts ...grpc.CallOption) (*Response, error)
|
||||||
GenerateQrcode(ctx context.Context, in *GenerateQrcodeReq, opts ...grpc.CallOption) (*Response, error)
|
GenerateQrcode(ctx context.Context, in *GenerateQrcodeReq, opts ...grpc.CallOption) (*Response, error)
|
||||||
QrcodeScan(ctx context.Context, in *QrcodeScanReq, opts ...grpc.CallOption) (*Response, error)
|
QrcodeScan(ctx context.Context, in *QrcodeScanReq, opts ...grpc.CallOption) (*Response, error)
|
||||||
QrcodeLogin(ctx context.Context, in *QrcodeLoginReq, opts ...grpc.CallOption) (*Response, error)
|
QrcodeLogin(ctx context.Context, in *QrcodeLoginReq, opts ...grpc.CallOption) (*Response, error)
|
||||||
@@ -95,6 +97,16 @@ func (c *userClient) Login(ctx context.Context, in *LoginReq, opts ...grpc.CallO
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *userClient) Logout(ctx context.Context, in *LogoutReq, opts ...grpc.CallOption) (*Response, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(Response)
|
||||||
|
err := c.cc.Invoke(ctx, User_Logout_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (c *userClient) GenerateQrcode(ctx context.Context, in *GenerateQrcodeReq, opts ...grpc.CallOption) (*Response, error) {
|
func (c *userClient) GenerateQrcode(ctx context.Context, in *GenerateQrcodeReq, opts ...grpc.CallOption) (*Response, error) {
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
out := new(Response)
|
out := new(Response)
|
||||||
@@ -340,6 +352,7 @@ func (c *userClient) InternalLoginByUserId(ctx context.Context, in *InternalLogi
|
|||||||
// for forward compatibility.
|
// for forward compatibility.
|
||||||
type UserServer interface {
|
type UserServer interface {
|
||||||
Login(context.Context, *LoginReq) (*Response, error)
|
Login(context.Context, *LoginReq) (*Response, error)
|
||||||
|
Logout(context.Context, *LogoutReq) (*Response, error)
|
||||||
GenerateQrcode(context.Context, *GenerateQrcodeReq) (*Response, error)
|
GenerateQrcode(context.Context, *GenerateQrcodeReq) (*Response, error)
|
||||||
QrcodeScan(context.Context, *QrcodeScanReq) (*Response, error)
|
QrcodeScan(context.Context, *QrcodeScanReq) (*Response, error)
|
||||||
QrcodeLogin(context.Context, *QrcodeLoginReq) (*Response, error)
|
QrcodeLogin(context.Context, *QrcodeLoginReq) (*Response, error)
|
||||||
@@ -377,6 +390,9 @@ type UnimplementedUserServer struct{}
|
|||||||
func (UnimplementedUserServer) Login(context.Context, *LoginReq) (*Response, error) {
|
func (UnimplementedUserServer) Login(context.Context, *LoginReq) (*Response, error) {
|
||||||
return nil, status.Error(codes.Unimplemented, "method Login not implemented")
|
return nil, status.Error(codes.Unimplemented, "method Login not implemented")
|
||||||
}
|
}
|
||||||
|
func (UnimplementedUserServer) Logout(context.Context, *LogoutReq) (*Response, error) {
|
||||||
|
return nil, status.Error(codes.Unimplemented, "method Logout not implemented")
|
||||||
|
}
|
||||||
func (UnimplementedUserServer) GenerateQrcode(context.Context, *GenerateQrcodeReq) (*Response, error) {
|
func (UnimplementedUserServer) GenerateQrcode(context.Context, *GenerateQrcodeReq) (*Response, error) {
|
||||||
return nil, status.Error(codes.Unimplemented, "method GenerateQrcode not implemented")
|
return nil, status.Error(codes.Unimplemented, "method GenerateQrcode not implemented")
|
||||||
}
|
}
|
||||||
@@ -488,6 +504,24 @@ func _User_Login_Handler(srv interface{}, ctx context.Context, dec func(interfac
|
|||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _User_Logout_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(LogoutReq)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(UserServer).Logout(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: User_Logout_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(UserServer).Logout(ctx, req.(*LogoutReq))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
func _User_GenerateQrcode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
func _User_GenerateQrcode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
in := new(GenerateQrcodeReq)
|
in := new(GenerateQrcodeReq)
|
||||||
if err := dec(in); err != nil {
|
if err := dec(in); err != nil {
|
||||||
@@ -931,6 +965,10 @@ var User_ServiceDesc = grpc.ServiceDesc{
|
|||||||
MethodName: "Login",
|
MethodName: "Login",
|
||||||
Handler: _User_Login_Handler,
|
Handler: _User_Login_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "Logout",
|
||||||
|
Handler: _User_Logout_Handler,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
MethodName: "GenerateQrcode",
|
MethodName: "GenerateQrcode",
|
||||||
Handler: _User_GenerateQrcode_Handler,
|
Handler: _User_GenerateQrcode_Handler,
|
||||||
|
|||||||
Binary file not shown.
@@ -12,6 +12,12 @@ service User {
|
|||||||
body: "*"
|
body: "*"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
rpc Logout(LogoutReq) returns (Response) {
|
||||||
|
option (google.api.http) = {
|
||||||
|
post: "/api/v3/user/logout"
|
||||||
|
body: "*"
|
||||||
|
};
|
||||||
|
}
|
||||||
rpc GenerateQrcode(GenerateQrcodeReq) returns (Response) {
|
rpc GenerateQrcode(GenerateQrcodeReq) returns (Response) {
|
||||||
option (google.api.http) = {
|
option (google.api.http) = {
|
||||||
post: "/api/v3/user/qrcode/generate"
|
post: "/api/v3/user/qrcode/generate"
|
||||||
@@ -316,6 +322,8 @@ message RebindMobileReq {
|
|||||||
|
|
||||||
message InfoReq {}
|
message InfoReq {}
|
||||||
|
|
||||||
|
message LogoutReq {}
|
||||||
|
|
||||||
message UpdateReq {
|
message UpdateReq {
|
||||||
string name = 1;
|
string name = 1;
|
||||||
string avatar = 2;
|
string avatar = 2;
|
||||||
|
|||||||
@@ -67,9 +67,6 @@ func (l *UserStatusLogic) syncRegisteredFromUser(bizId, userId int64, isRegister
|
|||||||
if isRegistered != uint8(utils.StatusFail) {
|
if isRegistered != uint8(utils.StatusFail) {
|
||||||
return isRegistered
|
return isRegistered
|
||||||
}
|
}
|
||||||
if userId < utils.NumberOne || l.svcCtx.UserSvcName == utils.StringEmpty {
|
|
||||||
return isRegistered
|
|
||||||
}
|
|
||||||
|
|
||||||
cli, err := svc.GetRpcClient(l.svcCtx.UserSvcName)
|
cli, err := svc.GetRpcClient(l.svcCtx.UserSvcName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -0,0 +1,87 @@
|
|||||||
|
package logic
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"lone-services/pkg/redis"
|
||||||
|
"lone-services/pkg/utils"
|
||||||
|
user "lone-services/rpc/user/pb"
|
||||||
|
"lone-services/services/user/internal/dao"
|
||||||
|
"lone-services/services/user/internal/svc"
|
||||||
|
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
)
|
||||||
|
|
||||||
|
type LogoutLogic struct {
|
||||||
|
ctx context.Context
|
||||||
|
svcCtx *svc.ServiceContext
|
||||||
|
logx.Logger
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewLogoutLogic(ctx context.Context, svcCtx *svc.ServiceContext) *LogoutLogic {
|
||||||
|
return &LogoutLogic{
|
||||||
|
ctx: ctx,
|
||||||
|
svcCtx: svcCtx,
|
||||||
|
Logger: logx.WithContext(ctx),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *LogoutLogic) Logout(in *user.LogoutReq) (*user.Response, error) {
|
||||||
|
loginUser := utils.GetUserFromCtx(l.ctx)
|
||||||
|
if loginUser.ID < utils.NumberOne {
|
||||||
|
return failResponse(utils.ErrorNoLoginInfo), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
loginType, typeErr := resolveLoginCacheType(loginUser)
|
||||||
|
if typeErr != nil {
|
||||||
|
l.Errorf("logout resolve login type: %v", typeErr)
|
||||||
|
return failResponse(utils.Fail), nil
|
||||||
|
}
|
||||||
|
if loginType == utils.StringEmpty {
|
||||||
|
return outResponse(utils.ErrorParams, "无法识别登录类型"), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
redisKeysKey := utils.GetLoginKeysKey(loginType, strconv.FormatInt(loginUser.ID, utils.NumberTen))
|
||||||
|
oldAuth, oldErr := redis.Client.Get(l.ctx, redisKeysKey).Result()
|
||||||
|
if oldErr != nil {
|
||||||
|
return failResponse(utils.ErrorNoLoginInfo), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var loginInfo utils.LoginRedis
|
||||||
|
if err := jsoniter.Unmarshal([]byte(oldAuth), &loginInfo); err != nil {
|
||||||
|
return failResponse(utils.ErrorNoLoginInfo), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(loginInfo.Token) > utils.NumberOne {
|
||||||
|
_ = redis.Client.Del(l.ctx, utils.GetLoginKey(loginType, loginInfo.Token)).Err()
|
||||||
|
}
|
||||||
|
if len(loginInfo.Refresh) > utils.NumberOne {
|
||||||
|
_ = redis.Client.Del(l.ctx, utils.GetLoginRefreshKey(loginType, loginInfo.Refresh)).Err()
|
||||||
|
}
|
||||||
|
_ = redis.Client.Del(l.ctx, redisKeysKey).Err()
|
||||||
|
|
||||||
|
return okResponse(utils.NumberOne), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func resolveLoginCacheType(loginUser utils.UserInfo) (string, error) {
|
||||||
|
if loginUser.ClientCode != utils.StringEmpty {
|
||||||
|
client, err := loadEnabledClient(loginUser.ClientCode)
|
||||||
|
if err != nil {
|
||||||
|
return utils.StringEmpty, err
|
||||||
|
}
|
||||||
|
return loginCacheType(client), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
switch loginUser.Type {
|
||||||
|
case dao.TypeSale:
|
||||||
|
return utils.LoginTypeSale, nil
|
||||||
|
case dao.TypeStore:
|
||||||
|
return utils.LoginTypeStore, nil
|
||||||
|
case dao.TypeUser:
|
||||||
|
return utils.LoginTypeUser, nil
|
||||||
|
default:
|
||||||
|
return utils.StringEmpty, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -28,6 +28,11 @@ func (s *UserServer) Login(ctx context.Context, in *user.LoginReq) (*user.Respon
|
|||||||
return l.Login(in)
|
return l.Login(in)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *UserServer) Logout(ctx context.Context, in *user.LogoutReq) (*user.Response, error) {
|
||||||
|
l := logic.NewLogoutLogic(ctx, s.svcCtx)
|
||||||
|
return l.Logout(in)
|
||||||
|
}
|
||||||
|
|
||||||
func (s *UserServer) GenerateQrcode(ctx context.Context, in *user.GenerateQrcodeReq) (*user.Response, error) {
|
func (s *UserServer) GenerateQrcode(ctx context.Context, in *user.GenerateQrcodeReq) (*user.Response, error) {
|
||||||
l := logic.NewGenerateQrcodeLogic(ctx, s.svcCtx)
|
l := logic.NewGenerateQrcodeLogic(ctx, s.svcCtx)
|
||||||
return l.GenerateQrcode(in)
|
return l.GenerateQrcode(in)
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ type (
|
|||||||
InternalVerifyPasswordData = user.InternalVerifyPasswordData
|
InternalVerifyPasswordData = user.InternalVerifyPasswordData
|
||||||
InternalVerifyPasswordReq = user.InternalVerifyPasswordReq
|
InternalVerifyPasswordReq = user.InternalVerifyPasswordReq
|
||||||
LoginReq = user.LoginReq
|
LoginReq = user.LoginReq
|
||||||
|
LogoutReq = user.LogoutReq
|
||||||
PasswordReq = user.PasswordReq
|
PasswordReq = user.PasswordReq
|
||||||
QrcodeLoginReq = user.QrcodeLoginReq
|
QrcodeLoginReq = user.QrcodeLoginReq
|
||||||
QrcodeScanReq = user.QrcodeScanReq
|
QrcodeScanReq = user.QrcodeScanReq
|
||||||
@@ -58,6 +59,7 @@ type (
|
|||||||
|
|
||||||
User interface {
|
User interface {
|
||||||
Login(ctx context.Context, in *LoginReq, opts ...grpc.CallOption) (*Response, error)
|
Login(ctx context.Context, in *LoginReq, opts ...grpc.CallOption) (*Response, error)
|
||||||
|
Logout(ctx context.Context, in *LogoutReq, opts ...grpc.CallOption) (*Response, error)
|
||||||
GenerateQrcode(ctx context.Context, in *GenerateQrcodeReq, opts ...grpc.CallOption) (*Response, error)
|
GenerateQrcode(ctx context.Context, in *GenerateQrcodeReq, opts ...grpc.CallOption) (*Response, error)
|
||||||
QrcodeScan(ctx context.Context, in *QrcodeScanReq, opts ...grpc.CallOption) (*Response, error)
|
QrcodeScan(ctx context.Context, in *QrcodeScanReq, opts ...grpc.CallOption) (*Response, error)
|
||||||
QrcodeLogin(ctx context.Context, in *QrcodeLoginReq, opts ...grpc.CallOption) (*Response, error)
|
QrcodeLogin(ctx context.Context, in *QrcodeLoginReq, opts ...grpc.CallOption) (*Response, error)
|
||||||
@@ -100,6 +102,11 @@ func (m *defaultUser) Login(ctx context.Context, in *LoginReq, opts ...grpc.Call
|
|||||||
return client.Login(ctx, in, opts...)
|
return client.Login(ctx, in, opts...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *defaultUser) Logout(ctx context.Context, in *LogoutReq, opts ...grpc.CallOption) (*Response, error) {
|
||||||
|
client := user.NewUserClient(m.cli.Conn())
|
||||||
|
return client.Logout(ctx, in, opts...)
|
||||||
|
}
|
||||||
|
|
||||||
func (m *defaultUser) GenerateQrcode(ctx context.Context, in *GenerateQrcodeReq, opts ...grpc.CallOption) (*Response, error) {
|
func (m *defaultUser) GenerateQrcode(ctx context.Context, in *GenerateQrcodeReq, opts ...grpc.CallOption) (*Response, error) {
|
||||||
client := user.NewUserClient(m.cli.Conn())
|
client := user.NewUserClient(m.cli.Conn())
|
||||||
return client.GenerateQrcode(ctx, in, opts...)
|
return client.GenerateQrcode(ctx, in, opts...)
|
||||||
|
|||||||
Reference in New Issue
Block a user