diff --git a/deploy/apisix/lua/auth.lua b/deploy/apisix/lua/auth.lua index 5f228f5..6120dab 100644 --- a/deploy/apisix/lua/auth.lua +++ b/deploy/apisix/lua/auth.lua @@ -91,7 +91,7 @@ function _M.access(conf, ctx) end local res, err = red:get(redis_key) - + core.log.error("AUTH_DEBUG host=", redis_host, " port=", redis_port, " password=", redis_password, diff --git a/rpc/analysis/analysis.proto b/rpc/analysis/analysis.proto index 3c28997..ae81044 100644 --- a/rpc/analysis/analysis.proto +++ b/rpc/analysis/analysis.proto @@ -151,6 +151,7 @@ service Analysis { } service AnalysisUser { + rpc FaceBind(FaceBindReq) returns (Response) { option (google.api.http) = { post: "/api/v2/analysis/face/bind" @@ -370,6 +371,7 @@ message AgreementInfoReq { int32 type = 1; } +// UserDeleteReq.id 为 user 服务 users 表主键(平台用户 ID),不是 analysis.users.id。 message UserDeleteReq { int64 id = 1; } diff --git a/rpc/analysis/pb/analysis.pb.go b/rpc/analysis/pb/analysis.pb.go index 05c5ddd..9433227 100644 --- a/rpc/analysis/pb/analysis.pb.go +++ b/rpc/analysis/pb/analysis.pb.go @@ -422,6 +422,7 @@ func (x *AgreementInfoReq) GetType() int32 { return 0 } +// UserDeleteReq.id 为 user 服务 users 表主键(平台用户 ID),不是 analysis.users.id。 type UserDeleteReq struct { state protoimpl.MessageState `protogen:"open.v1"` Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` diff --git a/rpc/analysis/pb/analysis_grpc.pb.go b/rpc/analysis/pb/analysis_grpc.pb.go index eb962d0..4f6a0ad 100644 --- a/rpc/analysis/pb/analysis_grpc.pb.go +++ b/rpc/analysis/pb/analysis_grpc.pb.go @@ -938,6 +938,7 @@ const ( type AnalysisUserClient interface { FaceBind(ctx context.Context, in *FaceBindReq, opts ...grpc.CallOption) (*Response, error) UserImprove(ctx context.Context, in *UserImproveReq, opts ...grpc.CallOption) (*Response, error) + // UserDelete 按平台 users.id 级联删除:analysis.users、人脸向量、以及 user 侧关联表。 UserDelete(ctx context.Context, in *UserDeleteReq, opts ...grpc.CallOption) (*Response, error) UserAuth(ctx context.Context, in *UserAuthReq, opts ...grpc.CallOption) (*Response, error) UserAuthList(ctx context.Context, in *UserAuthListReq, opts ...grpc.CallOption) (*Response, error) @@ -1073,6 +1074,7 @@ func (c *analysisUserClient) UserStatus(ctx context.Context, in *UserStatusReq, type AnalysisUserServer interface { FaceBind(context.Context, *FaceBindReq) (*Response, error) UserImprove(context.Context, *UserImproveReq) (*Response, error) + // UserDelete 按平台 users.id 级联删除:analysis.users、人脸向量、以及 user 侧关联表。 UserDelete(context.Context, *UserDeleteReq) (*Response, error) UserAuth(context.Context, *UserAuthReq) (*Response, error) UserAuthList(context.Context, *UserAuthListReq) (*Response, error) diff --git a/rpc/user/pb/user.pb.go b/rpc/user/pb/user.pb.go index a4971ca..0a787ab 100644 --- a/rpc/user/pb/user.pb.go +++ b/rpc/user/pb/user.pb.go @@ -834,6 +834,154 @@ func (x *InternalRevokeBizClientData) GetRevoked() bool { return false } +type InternalDeleteUserReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId int64 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *InternalDeleteUserReq) Reset() { + *x = InternalDeleteUserReq{} + mi := &file_user_user_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *InternalDeleteUserReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InternalDeleteUserReq) ProtoMessage() {} + +func (x *InternalDeleteUserReq) ProtoReflect() protoreflect.Message { + mi := &file_user_user_proto_msgTypes[13] + 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 InternalDeleteUserReq.ProtoReflect.Descriptor instead. +func (*InternalDeleteUserReq) Descriptor() ([]byte, []int) { + return file_user_user_proto_rawDescGZIP(), []int{13} +} + +func (x *InternalDeleteUserReq) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +type InternalDeleteUserClient struct { + state protoimpl.MessageState `protogen:"open.v1"` + ClientCode string `protobuf:"bytes,1,opt,name=client_code,json=clientCode,proto3" json:"client_code,omitempty"` + BizId int64 `protobuf:"varint,2,opt,name=biz_id,json=bizId,proto3" json:"biz_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *InternalDeleteUserClient) Reset() { + *x = InternalDeleteUserClient{} + mi := &file_user_user_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *InternalDeleteUserClient) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InternalDeleteUserClient) ProtoMessage() {} + +func (x *InternalDeleteUserClient) ProtoReflect() protoreflect.Message { + mi := &file_user_user_proto_msgTypes[14] + 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 InternalDeleteUserClient.ProtoReflect.Descriptor instead. +func (*InternalDeleteUserClient) Descriptor() ([]byte, []int) { + return file_user_user_proto_rawDescGZIP(), []int{14} +} + +func (x *InternalDeleteUserClient) GetClientCode() string { + if x != nil { + return x.ClientCode + } + return "" +} + +func (x *InternalDeleteUserClient) GetBizId() int64 { + if x != nil { + return x.BizId + } + return 0 +} + +type InternalDeleteUserData struct { + state protoimpl.MessageState `protogen:"open.v1"` + Ok bool `protobuf:"varint,1,opt,name=ok,proto3" json:"ok,omitempty"` + Clients []*InternalDeleteUserClient `protobuf:"bytes,2,rep,name=clients,proto3" json:"clients,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *InternalDeleteUserData) Reset() { + *x = InternalDeleteUserData{} + mi := &file_user_user_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *InternalDeleteUserData) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InternalDeleteUserData) ProtoMessage() {} + +func (x *InternalDeleteUserData) ProtoReflect() protoreflect.Message { + mi := &file_user_user_proto_msgTypes[15] + 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 InternalDeleteUserData.ProtoReflect.Descriptor instead. +func (*InternalDeleteUserData) Descriptor() ([]byte, []int) { + return file_user_user_proto_rawDescGZIP(), []int{15} +} + +func (x *InternalDeleteUserData) GetOk() bool { + if x != nil { + return x.Ok + } + return false +} + +func (x *InternalDeleteUserData) GetClients() []*InternalDeleteUserClient { + if x != nil { + return x.Clients + } + return nil +} + type InternalCheckCreateReq struct { state protoimpl.MessageState `protogen:"open.v1"` Mobile string `protobuf:"bytes,1,opt,name=mobile,proto3" json:"mobile,omitempty"` @@ -843,7 +991,7 @@ type InternalCheckCreateReq struct { func (x *InternalCheckCreateReq) Reset() { *x = InternalCheckCreateReq{} - mi := &file_user_user_proto_msgTypes[13] + mi := &file_user_user_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -855,7 +1003,7 @@ func (x *InternalCheckCreateReq) String() string { func (*InternalCheckCreateReq) ProtoMessage() {} func (x *InternalCheckCreateReq) ProtoReflect() protoreflect.Message { - mi := &file_user_user_proto_msgTypes[13] + mi := &file_user_user_proto_msgTypes[16] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -868,7 +1016,7 @@ func (x *InternalCheckCreateReq) ProtoReflect() protoreflect.Message { // Deprecated: Use InternalCheckCreateReq.ProtoReflect.Descriptor instead. func (*InternalCheckCreateReq) Descriptor() ([]byte, []int) { - return file_user_user_proto_rawDescGZIP(), []int{13} + return file_user_user_proto_rawDescGZIP(), []int{16} } func (x *InternalCheckCreateReq) GetMobile() string { @@ -887,7 +1035,7 @@ type InternalCheckCreateData struct { func (x *InternalCheckCreateData) Reset() { *x = InternalCheckCreateData{} - mi := &file_user_user_proto_msgTypes[14] + mi := &file_user_user_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -899,7 +1047,7 @@ func (x *InternalCheckCreateData) String() string { func (*InternalCheckCreateData) ProtoMessage() {} func (x *InternalCheckCreateData) ProtoReflect() protoreflect.Message { - mi := &file_user_user_proto_msgTypes[14] + mi := &file_user_user_proto_msgTypes[17] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -912,7 +1060,7 @@ func (x *InternalCheckCreateData) ProtoReflect() protoreflect.Message { // Deprecated: Use InternalCheckCreateData.ProtoReflect.Descriptor instead. func (*InternalCheckCreateData) Descriptor() ([]byte, []int) { - return file_user_user_proto_rawDescGZIP(), []int{14} + return file_user_user_proto_rawDescGZIP(), []int{17} } func (x *InternalCheckCreateData) GetResult() bool { @@ -933,7 +1081,7 @@ type InternalCheckUpdateReq struct { func (x *InternalCheckUpdateReq) Reset() { *x = InternalCheckUpdateReq{} - mi := &file_user_user_proto_msgTypes[15] + mi := &file_user_user_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -945,7 +1093,7 @@ func (x *InternalCheckUpdateReq) String() string { func (*InternalCheckUpdateReq) ProtoMessage() {} func (x *InternalCheckUpdateReq) ProtoReflect() protoreflect.Message { - mi := &file_user_user_proto_msgTypes[15] + mi := &file_user_user_proto_msgTypes[18] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -958,7 +1106,7 @@ func (x *InternalCheckUpdateReq) ProtoReflect() protoreflect.Message { // Deprecated: Use InternalCheckUpdateReq.ProtoReflect.Descriptor instead. func (*InternalCheckUpdateReq) Descriptor() ([]byte, []int) { - return file_user_user_proto_rawDescGZIP(), []int{15} + return file_user_user_proto_rawDescGZIP(), []int{18} } func (x *InternalCheckUpdateReq) GetBizId() int64 { @@ -991,7 +1139,7 @@ type InternalCheckUpdateData struct { func (x *InternalCheckUpdateData) Reset() { *x = InternalCheckUpdateData{} - mi := &file_user_user_proto_msgTypes[16] + mi := &file_user_user_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1003,7 +1151,7 @@ func (x *InternalCheckUpdateData) String() string { func (*InternalCheckUpdateData) ProtoMessage() {} func (x *InternalCheckUpdateData) ProtoReflect() protoreflect.Message { - mi := &file_user_user_proto_msgTypes[16] + mi := &file_user_user_proto_msgTypes[19] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1016,7 +1164,7 @@ func (x *InternalCheckUpdateData) ProtoReflect() protoreflect.Message { // Deprecated: Use InternalCheckUpdateData.ProtoReflect.Descriptor instead. func (*InternalCheckUpdateData) Descriptor() ([]byte, []int) { - return file_user_user_proto_rawDescGZIP(), []int{16} + return file_user_user_proto_rawDescGZIP(), []int{19} } func (x *InternalCheckUpdateData) GetResult() bool { @@ -1045,7 +1193,7 @@ type InternalUpdateReq struct { func (x *InternalUpdateReq) Reset() { *x = InternalUpdateReq{} - mi := &file_user_user_proto_msgTypes[17] + mi := &file_user_user_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1057,7 +1205,7 @@ func (x *InternalUpdateReq) String() string { func (*InternalUpdateReq) ProtoMessage() {} func (x *InternalUpdateReq) ProtoReflect() protoreflect.Message { - mi := &file_user_user_proto_msgTypes[17] + mi := &file_user_user_proto_msgTypes[20] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1070,7 +1218,7 @@ func (x *InternalUpdateReq) ProtoReflect() protoreflect.Message { // Deprecated: Use InternalUpdateReq.ProtoReflect.Descriptor instead. func (*InternalUpdateReq) Descriptor() ([]byte, []int) { - return file_user_user_proto_rawDescGZIP(), []int{17} + return file_user_user_proto_rawDescGZIP(), []int{20} } func (x *InternalUpdateReq) GetMobile() string { @@ -1161,7 +1309,7 @@ type InternalUpdateData struct { func (x *InternalUpdateData) Reset() { *x = InternalUpdateData{} - mi := &file_user_user_proto_msgTypes[18] + mi := &file_user_user_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1173,7 +1321,7 @@ func (x *InternalUpdateData) String() string { func (*InternalUpdateData) ProtoMessage() {} func (x *InternalUpdateData) ProtoReflect() protoreflect.Message { - mi := &file_user_user_proto_msgTypes[18] + mi := &file_user_user_proto_msgTypes[21] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1186,7 +1334,7 @@ func (x *InternalUpdateData) ProtoReflect() protoreflect.Message { // Deprecated: Use InternalUpdateData.ProtoReflect.Descriptor instead. func (*InternalUpdateData) Descriptor() ([]byte, []int) { - return file_user_user_proto_rawDescGZIP(), []int{18} + return file_user_user_proto_rawDescGZIP(), []int{21} } func (x *InternalUpdateData) GetUserId() int64 { @@ -1221,7 +1369,7 @@ type InternalGetUserInfoReq struct { func (x *InternalGetUserInfoReq) Reset() { *x = InternalGetUserInfoReq{} - mi := &file_user_user_proto_msgTypes[19] + mi := &file_user_user_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1233,7 +1381,7 @@ func (x *InternalGetUserInfoReq) String() string { func (*InternalGetUserInfoReq) ProtoMessage() {} func (x *InternalGetUserInfoReq) ProtoReflect() protoreflect.Message { - mi := &file_user_user_proto_msgTypes[19] + mi := &file_user_user_proto_msgTypes[22] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1246,7 +1394,7 @@ func (x *InternalGetUserInfoReq) ProtoReflect() protoreflect.Message { // Deprecated: Use InternalGetUserInfoReq.ProtoReflect.Descriptor instead. func (*InternalGetUserInfoReq) Descriptor() ([]byte, []int) { - return file_user_user_proto_rawDescGZIP(), []int{19} + return file_user_user_proto_rawDescGZIP(), []int{22} } func (x *InternalGetUserInfoReq) GetUserId() int64 { @@ -1287,7 +1435,7 @@ type InternalGetUserInfoData struct { func (x *InternalGetUserInfoData) Reset() { *x = InternalGetUserInfoData{} - mi := &file_user_user_proto_msgTypes[20] + mi := &file_user_user_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1299,7 +1447,7 @@ func (x *InternalGetUserInfoData) String() string { func (*InternalGetUserInfoData) ProtoMessage() {} func (x *InternalGetUserInfoData) ProtoReflect() protoreflect.Message { - mi := &file_user_user_proto_msgTypes[20] + mi := &file_user_user_proto_msgTypes[23] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1312,7 +1460,7 @@ func (x *InternalGetUserInfoData) ProtoReflect() protoreflect.Message { // Deprecated: Use InternalGetUserInfoData.ProtoReflect.Descriptor instead. func (*InternalGetUserInfoData) Descriptor() ([]byte, []int) { - return file_user_user_proto_rawDescGZIP(), []int{20} + return file_user_user_proto_rawDescGZIP(), []int{23} } func (x *InternalGetUserInfoData) GetId() int64 { @@ -1390,7 +1538,7 @@ type InternalVerifyPasswordReq struct { func (x *InternalVerifyPasswordReq) Reset() { *x = InternalVerifyPasswordReq{} - mi := &file_user_user_proto_msgTypes[21] + mi := &file_user_user_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1402,7 +1550,7 @@ func (x *InternalVerifyPasswordReq) String() string { func (*InternalVerifyPasswordReq) ProtoMessage() {} func (x *InternalVerifyPasswordReq) ProtoReflect() protoreflect.Message { - mi := &file_user_user_proto_msgTypes[21] + mi := &file_user_user_proto_msgTypes[24] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1415,7 +1563,7 @@ func (x *InternalVerifyPasswordReq) ProtoReflect() protoreflect.Message { // Deprecated: Use InternalVerifyPasswordReq.ProtoReflect.Descriptor instead. func (*InternalVerifyPasswordReq) Descriptor() ([]byte, []int) { - return file_user_user_proto_rawDescGZIP(), []int{21} + return file_user_user_proto_rawDescGZIP(), []int{24} } func (x *InternalVerifyPasswordReq) GetUsername() string { @@ -1456,7 +1604,7 @@ type InternalVerifyPasswordData struct { func (x *InternalVerifyPasswordData) Reset() { *x = InternalVerifyPasswordData{} - mi := &file_user_user_proto_msgTypes[22] + mi := &file_user_user_proto_msgTypes[25] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1468,7 +1616,7 @@ func (x *InternalVerifyPasswordData) String() string { func (*InternalVerifyPasswordData) ProtoMessage() {} func (x *InternalVerifyPasswordData) ProtoReflect() protoreflect.Message { - mi := &file_user_user_proto_msgTypes[22] + mi := &file_user_user_proto_msgTypes[25] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1481,7 +1629,7 @@ func (x *InternalVerifyPasswordData) ProtoReflect() protoreflect.Message { // Deprecated: Use InternalVerifyPasswordData.ProtoReflect.Descriptor instead. func (*InternalVerifyPasswordData) Descriptor() ([]byte, []int) { - return file_user_user_proto_rawDescGZIP(), []int{22} + return file_user_user_proto_rawDescGZIP(), []int{25} } func (x *InternalVerifyPasswordData) GetUserId() int64 { @@ -1512,7 +1660,7 @@ type InternalUsersByBizReq struct { func (x *InternalUsersByBizReq) Reset() { *x = InternalUsersByBizReq{} - mi := &file_user_user_proto_msgTypes[23] + mi := &file_user_user_proto_msgTypes[26] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1524,7 +1672,7 @@ func (x *InternalUsersByBizReq) String() string { func (*InternalUsersByBizReq) ProtoMessage() {} func (x *InternalUsersByBizReq) ProtoReflect() protoreflect.Message { - mi := &file_user_user_proto_msgTypes[23] + mi := &file_user_user_proto_msgTypes[26] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1537,7 +1685,7 @@ func (x *InternalUsersByBizReq) ProtoReflect() protoreflect.Message { // Deprecated: Use InternalUsersByBizReq.ProtoReflect.Descriptor instead. func (*InternalUsersByBizReq) Descriptor() ([]byte, []int) { - return file_user_user_proto_rawDescGZIP(), []int{23} + return file_user_user_proto_rawDescGZIP(), []int{26} } func (x *InternalUsersByBizReq) GetClientCode() string { @@ -1598,7 +1746,7 @@ type BizUserItem struct { func (x *BizUserItem) Reset() { *x = BizUserItem{} - mi := &file_user_user_proto_msgTypes[24] + mi := &file_user_user_proto_msgTypes[27] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1610,7 +1758,7 @@ func (x *BizUserItem) String() string { func (*BizUserItem) ProtoMessage() {} func (x *BizUserItem) ProtoReflect() protoreflect.Message { - mi := &file_user_user_proto_msgTypes[24] + mi := &file_user_user_proto_msgTypes[27] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1623,7 +1771,7 @@ func (x *BizUserItem) ProtoReflect() protoreflect.Message { // Deprecated: Use BizUserItem.ProtoReflect.Descriptor instead. func (*BizUserItem) Descriptor() ([]byte, []int) { - return file_user_user_proto_rawDescGZIP(), []int{24} + return file_user_user_proto_rawDescGZIP(), []int{27} } func (x *BizUserItem) GetBizId() int64 { @@ -1691,7 +1839,7 @@ type InternalUsersByBizData struct { func (x *InternalUsersByBizData) Reset() { *x = InternalUsersByBizData{} - mi := &file_user_user_proto_msgTypes[25] + mi := &file_user_user_proto_msgTypes[28] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1703,7 +1851,7 @@ func (x *InternalUsersByBizData) String() string { func (*InternalUsersByBizData) ProtoMessage() {} func (x *InternalUsersByBizData) ProtoReflect() protoreflect.Message { - mi := &file_user_user_proto_msgTypes[25] + mi := &file_user_user_proto_msgTypes[28] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1716,7 +1864,7 @@ func (x *InternalUsersByBizData) ProtoReflect() protoreflect.Message { // Deprecated: Use InternalUsersByBizData.ProtoReflect.Descriptor instead. func (*InternalUsersByBizData) Descriptor() ([]byte, []int) { - return file_user_user_proto_rawDescGZIP(), []int{25} + return file_user_user_proto_rawDescGZIP(), []int{28} } func (x *InternalUsersByBizData) GetItems() []*BizUserItem { @@ -1736,7 +1884,7 @@ type InternalLoginByUserIdReq struct { func (x *InternalLoginByUserIdReq) Reset() { *x = InternalLoginByUserIdReq{} - mi := &file_user_user_proto_msgTypes[26] + mi := &file_user_user_proto_msgTypes[29] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1748,7 +1896,7 @@ func (x *InternalLoginByUserIdReq) String() string { func (*InternalLoginByUserIdReq) ProtoMessage() {} func (x *InternalLoginByUserIdReq) ProtoReflect() protoreflect.Message { - mi := &file_user_user_proto_msgTypes[26] + mi := &file_user_user_proto_msgTypes[29] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1761,7 +1909,7 @@ func (x *InternalLoginByUserIdReq) ProtoReflect() protoreflect.Message { // Deprecated: Use InternalLoginByUserIdReq.ProtoReflect.Descriptor instead. func (*InternalLoginByUserIdReq) Descriptor() ([]byte, []int) { - return file_user_user_proto_rawDescGZIP(), []int{26} + return file_user_user_proto_rawDescGZIP(), []int{29} } func (x *InternalLoginByUserIdReq) GetUserId() int64 { @@ -1789,7 +1937,7 @@ type InternalLoginByUserIdData struct { func (x *InternalLoginByUserIdData) Reset() { *x = InternalLoginByUserIdData{} - mi := &file_user_user_proto_msgTypes[27] + mi := &file_user_user_proto_msgTypes[30] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1801,7 +1949,7 @@ func (x *InternalLoginByUserIdData) String() string { func (*InternalLoginByUserIdData) ProtoMessage() {} func (x *InternalLoginByUserIdData) ProtoReflect() protoreflect.Message { - mi := &file_user_user_proto_msgTypes[27] + mi := &file_user_user_proto_msgTypes[30] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1814,7 +1962,7 @@ func (x *InternalLoginByUserIdData) ProtoReflect() protoreflect.Message { // Deprecated: Use InternalLoginByUserIdData.ProtoReflect.Descriptor instead. func (*InternalLoginByUserIdData) Descriptor() ([]byte, []int) { - return file_user_user_proto_rawDescGZIP(), []int{27} + return file_user_user_proto_rawDescGZIP(), []int{30} } func (x *InternalLoginByUserIdData) GetAccessToken() string { @@ -1847,7 +1995,7 @@ type GetOpenidReq struct { func (x *GetOpenidReq) Reset() { *x = GetOpenidReq{} - mi := &file_user_user_proto_msgTypes[28] + mi := &file_user_user_proto_msgTypes[31] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1859,7 +2007,7 @@ func (x *GetOpenidReq) String() string { func (*GetOpenidReq) ProtoMessage() {} func (x *GetOpenidReq) ProtoReflect() protoreflect.Message { - mi := &file_user_user_proto_msgTypes[28] + mi := &file_user_user_proto_msgTypes[31] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1872,7 +2020,7 @@ func (x *GetOpenidReq) ProtoReflect() protoreflect.Message { // Deprecated: Use GetOpenidReq.ProtoReflect.Descriptor instead. func (*GetOpenidReq) Descriptor() ([]byte, []int) { - return file_user_user_proto_rawDescGZIP(), []int{28} + return file_user_user_proto_rawDescGZIP(), []int{31} } func (x *GetOpenidReq) GetCode() string { @@ -1891,7 +2039,7 @@ type BindMobileReq struct { func (x *BindMobileReq) Reset() { *x = BindMobileReq{} - mi := &file_user_user_proto_msgTypes[29] + mi := &file_user_user_proto_msgTypes[32] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1903,7 +2051,7 @@ func (x *BindMobileReq) String() string { func (*BindMobileReq) ProtoMessage() {} func (x *BindMobileReq) ProtoReflect() protoreflect.Message { - mi := &file_user_user_proto_msgTypes[29] + mi := &file_user_user_proto_msgTypes[32] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1916,7 +2064,7 @@ func (x *BindMobileReq) ProtoReflect() protoreflect.Message { // Deprecated: Use BindMobileReq.ProtoReflect.Descriptor instead. func (*BindMobileReq) Descriptor() ([]byte, []int) { - return file_user_user_proto_rawDescGZIP(), []int{29} + return file_user_user_proto_rawDescGZIP(), []int{32} } func (x *BindMobileReq) GetCode() string { @@ -1937,7 +2085,7 @@ type RebindMobileReq struct { func (x *RebindMobileReq) Reset() { *x = RebindMobileReq{} - mi := &file_user_user_proto_msgTypes[30] + mi := &file_user_user_proto_msgTypes[33] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1949,7 +2097,7 @@ func (x *RebindMobileReq) String() string { func (*RebindMobileReq) ProtoMessage() {} func (x *RebindMobileReq) ProtoReflect() protoreflect.Message { - mi := &file_user_user_proto_msgTypes[30] + mi := &file_user_user_proto_msgTypes[33] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1962,7 +2110,7 @@ func (x *RebindMobileReq) ProtoReflect() protoreflect.Message { // Deprecated: Use RebindMobileReq.ProtoReflect.Descriptor instead. func (*RebindMobileReq) Descriptor() ([]byte, []int) { - return file_user_user_proto_rawDescGZIP(), []int{30} + return file_user_user_proto_rawDescGZIP(), []int{33} } func (x *RebindMobileReq) GetOldMobile() string { @@ -1994,7 +2142,7 @@ type InfoReq struct { func (x *InfoReq) Reset() { *x = InfoReq{} - mi := &file_user_user_proto_msgTypes[31] + mi := &file_user_user_proto_msgTypes[34] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2006,7 +2154,7 @@ func (x *InfoReq) String() string { func (*InfoReq) ProtoMessage() {} func (x *InfoReq) ProtoReflect() protoreflect.Message { - mi := &file_user_user_proto_msgTypes[31] + mi := &file_user_user_proto_msgTypes[34] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2019,7 +2167,7 @@ func (x *InfoReq) ProtoReflect() protoreflect.Message { // Deprecated: Use InfoReq.ProtoReflect.Descriptor instead. func (*InfoReq) Descriptor() ([]byte, []int) { - return file_user_user_proto_rawDescGZIP(), []int{31} + return file_user_user_proto_rawDescGZIP(), []int{34} } type UpdateReq struct { @@ -2036,7 +2184,7 @@ type UpdateReq struct { func (x *UpdateReq) Reset() { *x = UpdateReq{} - mi := &file_user_user_proto_msgTypes[32] + mi := &file_user_user_proto_msgTypes[35] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2048,7 +2196,7 @@ func (x *UpdateReq) String() string { func (*UpdateReq) ProtoMessage() {} func (x *UpdateReq) ProtoReflect() protoreflect.Message { - mi := &file_user_user_proto_msgTypes[32] + mi := &file_user_user_proto_msgTypes[35] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2061,7 +2209,7 @@ func (x *UpdateReq) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdateReq.ProtoReflect.Descriptor instead. func (*UpdateReq) Descriptor() ([]byte, []int) { - return file_user_user_proto_rawDescGZIP(), []int{32} + return file_user_user_proto_rawDescGZIP(), []int{35} } func (x *UpdateReq) GetName() string { @@ -2116,7 +2264,7 @@ type PasswordReq struct { func (x *PasswordReq) Reset() { *x = PasswordReq{} - mi := &file_user_user_proto_msgTypes[33] + mi := &file_user_user_proto_msgTypes[36] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2128,7 +2276,7 @@ func (x *PasswordReq) String() string { func (*PasswordReq) ProtoMessage() {} func (x *PasswordReq) ProtoReflect() protoreflect.Message { - mi := &file_user_user_proto_msgTypes[33] + mi := &file_user_user_proto_msgTypes[36] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2141,7 +2289,7 @@ func (x *PasswordReq) ProtoReflect() protoreflect.Message { // Deprecated: Use PasswordReq.ProtoReflect.Descriptor instead. func (*PasswordReq) Descriptor() ([]byte, []int) { - return file_user_user_proto_rawDescGZIP(), []int{33} + return file_user_user_proto_rawDescGZIP(), []int{36} } func (x *PasswordReq) GetPassword() string { @@ -2169,7 +2317,7 @@ type ClientReq struct { func (x *ClientReq) Reset() { *x = ClientReq{} - mi := &file_user_user_proto_msgTypes[34] + mi := &file_user_user_proto_msgTypes[37] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2181,7 +2329,7 @@ func (x *ClientReq) String() string { func (*ClientReq) ProtoMessage() {} func (x *ClientReq) ProtoReflect() protoreflect.Message { - mi := &file_user_user_proto_msgTypes[34] + mi := &file_user_user_proto_msgTypes[37] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2194,7 +2342,7 @@ func (x *ClientReq) ProtoReflect() protoreflect.Message { // Deprecated: Use ClientReq.ProtoReflect.Descriptor instead. func (*ClientReq) Descriptor() ([]byte, []int) { - return file_user_user_proto_rawDescGZIP(), []int{34} + return file_user_user_proto_rawDescGZIP(), []int{37} } func (x *ClientReq) GetName() string { @@ -2227,7 +2375,7 @@ type GenerateQrcodeReq struct { func (x *GenerateQrcodeReq) Reset() { *x = GenerateQrcodeReq{} - mi := &file_user_user_proto_msgTypes[35] + mi := &file_user_user_proto_msgTypes[38] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2239,7 +2387,7 @@ func (x *GenerateQrcodeReq) String() string { func (*GenerateQrcodeReq) ProtoMessage() {} func (x *GenerateQrcodeReq) ProtoReflect() protoreflect.Message { - mi := &file_user_user_proto_msgTypes[35] + mi := &file_user_user_proto_msgTypes[38] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2252,7 +2400,7 @@ func (x *GenerateQrcodeReq) ProtoReflect() protoreflect.Message { // Deprecated: Use GenerateQrcodeReq.ProtoReflect.Descriptor instead. func (*GenerateQrcodeReq) Descriptor() ([]byte, []int) { - return file_user_user_proto_rawDescGZIP(), []int{35} + return file_user_user_proto_rawDescGZIP(), []int{38} } func (x *GenerateQrcodeReq) GetClientCode() string { @@ -2271,7 +2419,7 @@ type QrcodeScanReq struct { func (x *QrcodeScanReq) Reset() { *x = QrcodeScanReq{} - mi := &file_user_user_proto_msgTypes[36] + mi := &file_user_user_proto_msgTypes[39] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2283,7 +2431,7 @@ func (x *QrcodeScanReq) String() string { func (*QrcodeScanReq) ProtoMessage() {} func (x *QrcodeScanReq) ProtoReflect() protoreflect.Message { - mi := &file_user_user_proto_msgTypes[36] + mi := &file_user_user_proto_msgTypes[39] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2296,7 +2444,7 @@ func (x *QrcodeScanReq) ProtoReflect() protoreflect.Message { // Deprecated: Use QrcodeScanReq.ProtoReflect.Descriptor instead. func (*QrcodeScanReq) Descriptor() ([]byte, []int) { - return file_user_user_proto_rawDescGZIP(), []int{36} + return file_user_user_proto_rawDescGZIP(), []int{39} } func (x *QrcodeScanReq) GetSessionId() string { @@ -2316,7 +2464,7 @@ type QrcodeLoginReq struct { func (x *QrcodeLoginReq) Reset() { *x = QrcodeLoginReq{} - mi := &file_user_user_proto_msgTypes[37] + mi := &file_user_user_proto_msgTypes[40] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2328,7 +2476,7 @@ func (x *QrcodeLoginReq) String() string { func (*QrcodeLoginReq) ProtoMessage() {} func (x *QrcodeLoginReq) ProtoReflect() protoreflect.Message { - mi := &file_user_user_proto_msgTypes[37] + mi := &file_user_user_proto_msgTypes[40] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2341,7 +2489,7 @@ func (x *QrcodeLoginReq) ProtoReflect() protoreflect.Message { // Deprecated: Use QrcodeLoginReq.ProtoReflect.Descriptor instead. func (*QrcodeLoginReq) Descriptor() ([]byte, []int) { - return file_user_user_proto_rawDescGZIP(), []int{37} + return file_user_user_proto_rawDescGZIP(), []int{40} } func (x *QrcodeLoginReq) GetSessionId() string { @@ -2426,6 +2574,15 @@ const file_user_user_proto_rawDesc = "" + "clientCode\"7\n" + "\x1bInternalRevokeBizClientData\x12\x18\n" + "\arevoked\x18\x01 \x01(\bR\arevoked\"0\n" + + "\x15InternalDeleteUserReq\x12\x17\n" + + "\auser_id\x18\x01 \x01(\x03R\x06userId\"R\n" + + "\x18InternalDeleteUserClient\x12\x1f\n" + + "\vclient_code\x18\x01 \x01(\tR\n" + + "clientCode\x12\x15\n" + + "\x06biz_id\x18\x02 \x01(\x03R\x05bizId\"b\n" + + "\x16InternalDeleteUserData\x12\x0e\n" + + "\x02ok\x18\x01 \x01(\bR\x02ok\x128\n" + + "\aclients\x18\x02 \x03(\v2\x1e.user.InternalDeleteUserClientR\aclients\"0\n" + "\x16InternalCheckCreateReq\x12\x16\n" + "\x06mobile\x18\x01 \x01(\tR\x06mobile\"1\n" + "\x17InternalCheckCreateData\x12\x16\n" + @@ -2542,7 +2699,7 @@ const file_user_user_proto_rawDesc = "" + "\x0eQrcodeLoginReq\x12\x1d\n" + "\n" + "session_id\x18\x01 \x01(\tR\tsessionId\x12\x12\n" + - "\x04type\x18\x02 \x01(\x05R\x04type2\xcf\x0f\n" + + "\x04type\x18\x02 \x01(\x05R\x04type2\xa0\x10\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" + "\x0eGenerateQrcode\x12\x17.user.GenerateQrcodeReq\x1a\x0e.user.Response\"'\x82\xd3\xe4\x93\x02!:\x01*\"\x1c/api/v3/user/qrcode/generate\x12V\n" + @@ -2566,7 +2723,8 @@ const file_user_user_proto_rawDesc = "" + "\x0eInternalUpdate\x12\x17.user.InternalUpdateReq\x1a\x18.user.InternalUpdateData\x12O\n" + "\x12InternalUsersByIds\x12\x1b.user.InternalUsersByIdsReq\x1a\x1c.user.InternalUsersByIdsData\x12U\n" + "\x14InternalUpdateMobile\x12\x1d.user.InternalUpdateMobileReq\x1a\x1e.user.InternalUpdateMobileData\x12^\n" + - "\x17InternalRevokeBizClient\x12 .user.InternalRevokeBizClientReq\x1a!.user.InternalRevokeBizClientData\x12R\n" + + "\x17InternalRevokeBizClient\x12 .user.InternalRevokeBizClientReq\x1a!.user.InternalRevokeBizClientData\x12O\n" + + "\x12InternalDeleteUser\x12\x1b.user.InternalDeleteUserReq\x1a\x1c.user.InternalDeleteUserData\x12R\n" + "\x13InternalGetUserInfo\x12\x1c.user.InternalGetUserInfoReq\x1a\x1d.user.InternalGetUserInfoData\x12[\n" + "\x16InternalVerifyPassword\x12\x1f.user.InternalVerifyPasswordReq\x1a .user.InternalVerifyPasswordData\x12O\n" + "\x12InternalUsersByBiz\x12\x1b.user.InternalUsersByBizReq\x1a\x1c.user.InternalUsersByBizData\x12X\n" + @@ -2584,7 +2742,7 @@ func file_user_user_proto_rawDescGZIP() []byte { return file_user_user_proto_rawDescData } -var file_user_user_proto_msgTypes = make([]protoimpl.MessageInfo, 38) +var file_user_user_proto_msgTypes = make([]protoimpl.MessageInfo, 41) var file_user_user_proto_goTypes = []any{ (*Response)(nil), // 0: user.Response (*LoginReq)(nil), // 1: user.LoginReq @@ -2599,88 +2757,94 @@ var file_user_user_proto_goTypes = []any{ (*InternalUpdateMobileData)(nil), // 10: user.InternalUpdateMobileData (*InternalRevokeBizClientReq)(nil), // 11: user.InternalRevokeBizClientReq (*InternalRevokeBizClientData)(nil), // 12: user.InternalRevokeBizClientData - (*InternalCheckCreateReq)(nil), // 13: user.InternalCheckCreateReq - (*InternalCheckCreateData)(nil), // 14: user.InternalCheckCreateData - (*InternalCheckUpdateReq)(nil), // 15: user.InternalCheckUpdateReq - (*InternalCheckUpdateData)(nil), // 16: user.InternalCheckUpdateData - (*InternalUpdateReq)(nil), // 17: user.InternalUpdateReq - (*InternalUpdateData)(nil), // 18: user.InternalUpdateData - (*InternalGetUserInfoReq)(nil), // 19: user.InternalGetUserInfoReq - (*InternalGetUserInfoData)(nil), // 20: user.InternalGetUserInfoData - (*InternalVerifyPasswordReq)(nil), // 21: user.InternalVerifyPasswordReq - (*InternalVerifyPasswordData)(nil), // 22: user.InternalVerifyPasswordData - (*InternalUsersByBizReq)(nil), // 23: user.InternalUsersByBizReq - (*BizUserItem)(nil), // 24: user.BizUserItem - (*InternalUsersByBizData)(nil), // 25: user.InternalUsersByBizData - (*InternalLoginByUserIdReq)(nil), // 26: user.InternalLoginByUserIdReq - (*InternalLoginByUserIdData)(nil), // 27: user.InternalLoginByUserIdData - (*GetOpenidReq)(nil), // 28: user.GetOpenidReq - (*BindMobileReq)(nil), // 29: user.BindMobileReq - (*RebindMobileReq)(nil), // 30: user.RebindMobileReq - (*InfoReq)(nil), // 31: user.InfoReq - (*UpdateReq)(nil), // 32: user.UpdateReq - (*PasswordReq)(nil), // 33: user.PasswordReq - (*ClientReq)(nil), // 34: user.ClientReq - (*GenerateQrcodeReq)(nil), // 35: user.GenerateQrcodeReq - (*QrcodeScanReq)(nil), // 36: user.QrcodeScanReq - (*QrcodeLoginReq)(nil), // 37: user.QrcodeLoginReq + (*InternalDeleteUserReq)(nil), // 13: user.InternalDeleteUserReq + (*InternalDeleteUserClient)(nil), // 14: user.InternalDeleteUserClient + (*InternalDeleteUserData)(nil), // 15: user.InternalDeleteUserData + (*InternalCheckCreateReq)(nil), // 16: user.InternalCheckCreateReq + (*InternalCheckCreateData)(nil), // 17: user.InternalCheckCreateData + (*InternalCheckUpdateReq)(nil), // 18: user.InternalCheckUpdateReq + (*InternalCheckUpdateData)(nil), // 19: user.InternalCheckUpdateData + (*InternalUpdateReq)(nil), // 20: user.InternalUpdateReq + (*InternalUpdateData)(nil), // 21: user.InternalUpdateData + (*InternalGetUserInfoReq)(nil), // 22: user.InternalGetUserInfoReq + (*InternalGetUserInfoData)(nil), // 23: user.InternalGetUserInfoData + (*InternalVerifyPasswordReq)(nil), // 24: user.InternalVerifyPasswordReq + (*InternalVerifyPasswordData)(nil), // 25: user.InternalVerifyPasswordData + (*InternalUsersByBizReq)(nil), // 26: user.InternalUsersByBizReq + (*BizUserItem)(nil), // 27: user.BizUserItem + (*InternalUsersByBizData)(nil), // 28: user.InternalUsersByBizData + (*InternalLoginByUserIdReq)(nil), // 29: user.InternalLoginByUserIdReq + (*InternalLoginByUserIdData)(nil), // 30: user.InternalLoginByUserIdData + (*GetOpenidReq)(nil), // 31: user.GetOpenidReq + (*BindMobileReq)(nil), // 32: user.BindMobileReq + (*RebindMobileReq)(nil), // 33: user.RebindMobileReq + (*InfoReq)(nil), // 34: user.InfoReq + (*UpdateReq)(nil), // 35: user.UpdateReq + (*PasswordReq)(nil), // 36: user.PasswordReq + (*ClientReq)(nil), // 37: user.ClientReq + (*GenerateQrcodeReq)(nil), // 38: user.GenerateQrcodeReq + (*QrcodeScanReq)(nil), // 39: user.QrcodeScanReq + (*QrcodeLoginReq)(nil), // 40: user.QrcodeLoginReq } var file_user_user_proto_depIdxs = []int32{ 7, // 0: user.InternalUsersByIdsData.items:type_name -> user.UserBriefItem - 24, // 1: user.InternalUsersByBizData.items:type_name -> user.BizUserItem - 1, // 2: user.User.Login:input_type -> user.LoginReq - 35, // 3: user.User.GenerateQrcode:input_type -> user.GenerateQrcodeReq - 36, // 4: user.User.QrcodeScan:input_type -> user.QrcodeScanReq - 37, // 5: user.User.QrcodeLogin:input_type -> user.QrcodeLoginReq - 31, // 6: user.User.Info:input_type -> user.InfoReq - 32, // 7: user.User.Update:input_type -> user.UpdateReq - 33, // 8: user.User.Password:input_type -> user.PasswordReq - 28, // 9: user.User.GetOpenid:input_type -> user.GetOpenidReq - 29, // 10: user.User.BindMobile:input_type -> user.BindMobileReq - 30, // 11: user.User.RebindMobile:input_type -> user.RebindMobileReq - 34, // 12: user.User.Client:input_type -> user.ClientReq - 2, // 13: user.User.UserItems:input_type -> user.UserItemsReq - 3, // 14: user.User.UserStatus:input_type -> user.UserStatusReq - 4, // 15: user.User.InternalCreate:input_type -> user.InternalCreateReq - 13, // 16: user.User.InternalCheckCreate:input_type -> user.InternalCheckCreateReq - 15, // 17: user.User.InternalCheckUpdate:input_type -> user.InternalCheckUpdateReq - 17, // 18: user.User.InternalUpdate:input_type -> user.InternalUpdateReq - 6, // 19: user.User.InternalUsersByIds:input_type -> user.InternalUsersByIdsReq - 9, // 20: user.User.InternalUpdateMobile:input_type -> user.InternalUpdateMobileReq - 11, // 21: user.User.InternalRevokeBizClient:input_type -> user.InternalRevokeBizClientReq - 19, // 22: user.User.InternalGetUserInfo:input_type -> user.InternalGetUserInfoReq - 21, // 23: user.User.InternalVerifyPassword:input_type -> user.InternalVerifyPasswordReq - 23, // 24: user.User.InternalUsersByBiz:input_type -> user.InternalUsersByBizReq - 26, // 25: user.User.InternalLoginByUserId:input_type -> user.InternalLoginByUserIdReq - 0, // 26: user.User.Login:output_type -> user.Response - 0, // 27: user.User.GenerateQrcode:output_type -> user.Response - 0, // 28: user.User.QrcodeScan:output_type -> user.Response - 0, // 29: user.User.QrcodeLogin:output_type -> user.Response - 0, // 30: user.User.Info:output_type -> user.Response - 0, // 31: user.User.Update:output_type -> user.Response - 0, // 32: user.User.Password:output_type -> user.Response - 0, // 33: user.User.GetOpenid:output_type -> user.Response - 0, // 34: user.User.BindMobile:output_type -> user.Response - 0, // 35: user.User.RebindMobile:output_type -> user.Response - 0, // 36: user.User.Client:output_type -> user.Response - 0, // 37: user.User.UserItems:output_type -> user.Response - 0, // 38: user.User.UserStatus:output_type -> user.Response - 5, // 39: user.User.InternalCreate:output_type -> user.InternalCreateData - 14, // 40: user.User.InternalCheckCreate:output_type -> user.InternalCheckCreateData - 16, // 41: user.User.InternalCheckUpdate:output_type -> user.InternalCheckUpdateData - 18, // 42: user.User.InternalUpdate:output_type -> user.InternalUpdateData - 8, // 43: user.User.InternalUsersByIds:output_type -> user.InternalUsersByIdsData - 10, // 44: user.User.InternalUpdateMobile:output_type -> user.InternalUpdateMobileData - 12, // 45: user.User.InternalRevokeBizClient:output_type -> user.InternalRevokeBizClientData - 20, // 46: user.User.InternalGetUserInfo:output_type -> user.InternalGetUserInfoData - 22, // 47: user.User.InternalVerifyPassword:output_type -> user.InternalVerifyPasswordData - 25, // 48: user.User.InternalUsersByBiz:output_type -> user.InternalUsersByBizData - 27, // 49: user.User.InternalLoginByUserId:output_type -> user.InternalLoginByUserIdData - 26, // [26:50] is the sub-list for method output_type - 2, // [2:26] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name + 14, // 1: user.InternalDeleteUserData.clients:type_name -> user.InternalDeleteUserClient + 27, // 2: user.InternalUsersByBizData.items:type_name -> user.BizUserItem + 1, // 3: user.User.Login:input_type -> user.LoginReq + 38, // 4: user.User.GenerateQrcode:input_type -> user.GenerateQrcodeReq + 39, // 5: user.User.QrcodeScan:input_type -> user.QrcodeScanReq + 40, // 6: user.User.QrcodeLogin:input_type -> user.QrcodeLoginReq + 34, // 7: user.User.Info:input_type -> user.InfoReq + 35, // 8: user.User.Update:input_type -> user.UpdateReq + 36, // 9: user.User.Password:input_type -> user.PasswordReq + 31, // 10: user.User.GetOpenid:input_type -> user.GetOpenidReq + 32, // 11: user.User.BindMobile:input_type -> user.BindMobileReq + 33, // 12: user.User.RebindMobile:input_type -> user.RebindMobileReq + 37, // 13: user.User.Client:input_type -> user.ClientReq + 2, // 14: user.User.UserItems:input_type -> user.UserItemsReq + 3, // 15: user.User.UserStatus:input_type -> user.UserStatusReq + 4, // 16: user.User.InternalCreate:input_type -> user.InternalCreateReq + 16, // 17: user.User.InternalCheckCreate:input_type -> user.InternalCheckCreateReq + 18, // 18: user.User.InternalCheckUpdate:input_type -> user.InternalCheckUpdateReq + 20, // 19: user.User.InternalUpdate:input_type -> user.InternalUpdateReq + 6, // 20: user.User.InternalUsersByIds:input_type -> user.InternalUsersByIdsReq + 9, // 21: user.User.InternalUpdateMobile:input_type -> user.InternalUpdateMobileReq + 11, // 22: user.User.InternalRevokeBizClient:input_type -> user.InternalRevokeBizClientReq + 13, // 23: user.User.InternalDeleteUser:input_type -> user.InternalDeleteUserReq + 22, // 24: user.User.InternalGetUserInfo:input_type -> user.InternalGetUserInfoReq + 24, // 25: user.User.InternalVerifyPassword:input_type -> user.InternalVerifyPasswordReq + 26, // 26: user.User.InternalUsersByBiz:input_type -> user.InternalUsersByBizReq + 29, // 27: user.User.InternalLoginByUserId:input_type -> user.InternalLoginByUserIdReq + 0, // 28: user.User.Login:output_type -> user.Response + 0, // 29: user.User.GenerateQrcode:output_type -> user.Response + 0, // 30: user.User.QrcodeScan:output_type -> user.Response + 0, // 31: user.User.QrcodeLogin:output_type -> user.Response + 0, // 32: user.User.Info:output_type -> user.Response + 0, // 33: user.User.Update:output_type -> user.Response + 0, // 34: user.User.Password:output_type -> user.Response + 0, // 35: user.User.GetOpenid:output_type -> user.Response + 0, // 36: user.User.BindMobile:output_type -> user.Response + 0, // 37: user.User.RebindMobile:output_type -> user.Response + 0, // 38: user.User.Client:output_type -> user.Response + 0, // 39: user.User.UserItems:output_type -> user.Response + 0, // 40: user.User.UserStatus:output_type -> user.Response + 5, // 41: user.User.InternalCreate:output_type -> user.InternalCreateData + 17, // 42: user.User.InternalCheckCreate:output_type -> user.InternalCheckCreateData + 19, // 43: user.User.InternalCheckUpdate:output_type -> user.InternalCheckUpdateData + 21, // 44: user.User.InternalUpdate:output_type -> user.InternalUpdateData + 8, // 45: user.User.InternalUsersByIds:output_type -> user.InternalUsersByIdsData + 10, // 46: user.User.InternalUpdateMobile:output_type -> user.InternalUpdateMobileData + 12, // 47: user.User.InternalRevokeBizClient:output_type -> user.InternalRevokeBizClientData + 15, // 48: user.User.InternalDeleteUser:output_type -> user.InternalDeleteUserData + 23, // 49: user.User.InternalGetUserInfo:output_type -> user.InternalGetUserInfoData + 25, // 50: user.User.InternalVerifyPassword:output_type -> user.InternalVerifyPasswordData + 28, // 51: user.User.InternalUsersByBiz:output_type -> user.InternalUsersByBizData + 30, // 52: user.User.InternalLoginByUserId:output_type -> user.InternalLoginByUserIdData + 28, // [28:53] is the sub-list for method output_type + 3, // [3:28] 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 extendee + 0, // [0:3] is the sub-list for field type_name } func init() { file_user_user_proto_init() } @@ -2694,7 +2858,7 @@ func file_user_user_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_user_user_proto_rawDesc), len(file_user_user_proto_rawDesc)), NumEnums: 0, - NumMessages: 38, + NumMessages: 41, NumExtensions: 0, NumServices: 1, }, diff --git a/rpc/user/pb/user_grpc.pb.go b/rpc/user/pb/user_grpc.pb.go index 9dd65ff..a135544 100644 --- a/rpc/user/pb/user_grpc.pb.go +++ b/rpc/user/pb/user_grpc.pb.go @@ -39,6 +39,7 @@ const ( User_InternalUsersByIds_FullMethodName = "/user.User/InternalUsersByIds" User_InternalUpdateMobile_FullMethodName = "/user.User/InternalUpdateMobile" User_InternalRevokeBizClient_FullMethodName = "/user.User/InternalRevokeBizClient" + User_InternalDeleteUser_FullMethodName = "/user.User/InternalDeleteUser" User_InternalGetUserInfo_FullMethodName = "/user.User/InternalGetUserInfo" User_InternalVerifyPassword_FullMethodName = "/user.User/InternalVerifyPassword" User_InternalUsersByBiz_FullMethodName = "/user.User/InternalUsersByBiz" @@ -69,6 +70,7 @@ type UserClient interface { InternalUsersByIds(ctx context.Context, in *InternalUsersByIdsReq, opts ...grpc.CallOption) (*InternalUsersByIdsData, error) InternalUpdateMobile(ctx context.Context, in *InternalUpdateMobileReq, opts ...grpc.CallOption) (*InternalUpdateMobileData, error) InternalRevokeBizClient(ctx context.Context, in *InternalRevokeBizClientReq, opts ...grpc.CallOption) (*InternalRevokeBizClientData, error) + InternalDeleteUser(ctx context.Context, in *InternalDeleteUserReq, opts ...grpc.CallOption) (*InternalDeleteUserData, error) InternalGetUserInfo(ctx context.Context, in *InternalGetUserInfoReq, opts ...grpc.CallOption) (*InternalGetUserInfoData, error) InternalVerifyPassword(ctx context.Context, in *InternalVerifyPasswordReq, opts ...grpc.CallOption) (*InternalVerifyPasswordData, error) InternalUsersByBiz(ctx context.Context, in *InternalUsersByBizReq, opts ...grpc.CallOption) (*InternalUsersByBizData, error) @@ -283,6 +285,16 @@ func (c *userClient) InternalRevokeBizClient(ctx context.Context, in *InternalRe return out, nil } +func (c *userClient) InternalDeleteUser(ctx context.Context, in *InternalDeleteUserReq, opts ...grpc.CallOption) (*InternalDeleteUserData, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(InternalDeleteUserData) + err := c.cc.Invoke(ctx, User_InternalDeleteUser_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *userClient) InternalGetUserInfo(ctx context.Context, in *InternalGetUserInfoReq, opts ...grpc.CallOption) (*InternalGetUserInfoData, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(InternalGetUserInfoData) @@ -347,6 +359,7 @@ type UserServer interface { InternalUsersByIds(context.Context, *InternalUsersByIdsReq) (*InternalUsersByIdsData, error) InternalUpdateMobile(context.Context, *InternalUpdateMobileReq) (*InternalUpdateMobileData, error) InternalRevokeBizClient(context.Context, *InternalRevokeBizClientReq) (*InternalRevokeBizClientData, error) + InternalDeleteUser(context.Context, *InternalDeleteUserReq) (*InternalDeleteUserData, error) InternalGetUserInfo(context.Context, *InternalGetUserInfoReq) (*InternalGetUserInfoData, error) InternalVerifyPassword(context.Context, *InternalVerifyPasswordReq) (*InternalVerifyPasswordData, error) InternalUsersByBiz(context.Context, *InternalUsersByBizReq) (*InternalUsersByBizData, error) @@ -421,6 +434,9 @@ func (UnimplementedUserServer) InternalUpdateMobile(context.Context, *InternalUp func (UnimplementedUserServer) InternalRevokeBizClient(context.Context, *InternalRevokeBizClientReq) (*InternalRevokeBizClientData, error) { return nil, status.Error(codes.Unimplemented, "method InternalRevokeBizClient not implemented") } +func (UnimplementedUserServer) InternalDeleteUser(context.Context, *InternalDeleteUserReq) (*InternalDeleteUserData, error) { + return nil, status.Error(codes.Unimplemented, "method InternalDeleteUser not implemented") +} func (UnimplementedUserServer) InternalGetUserInfo(context.Context, *InternalGetUserInfoReq) (*InternalGetUserInfoData, error) { return nil, status.Error(codes.Unimplemented, "method InternalGetUserInfo not implemented") } @@ -814,6 +830,24 @@ func _User_InternalRevokeBizClient_Handler(srv interface{}, ctx context.Context, return interceptor(ctx, in, info, handler) } +func _User_InternalDeleteUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(InternalDeleteUserReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServer).InternalDeleteUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: User_InternalDeleteUser_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServer).InternalDeleteUser(ctx, req.(*InternalDeleteUserReq)) + } + return interceptor(ctx, in, info, handler) +} + func _User_InternalGetUserInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(InternalGetUserInfoReq) if err := dec(in); err != nil { @@ -973,6 +1007,10 @@ var User_ServiceDesc = grpc.ServiceDesc{ MethodName: "InternalRevokeBizClient", Handler: _User_InternalRevokeBizClient_Handler, }, + { + MethodName: "InternalDeleteUser", + Handler: _User_InternalDeleteUser_Handler, + }, { MethodName: "InternalGetUserInfo", Handler: _User_InternalGetUserInfo_Handler, diff --git a/rpc/user/user.pb b/rpc/user/user.pb index 0e3a97d..3979b06 100644 Binary files a/rpc/user/user.pb and b/rpc/user/user.pb differ diff --git a/rpc/user/user.proto b/rpc/user/user.proto index 2619138..5a57cad 100644 --- a/rpc/user/user.proto +++ b/rpc/user/user.proto @@ -92,6 +92,7 @@ service User { rpc InternalUsersByIds(InternalUsersByIdsReq) returns (InternalUsersByIdsData); rpc InternalUpdateMobile(InternalUpdateMobileReq) returns (InternalUpdateMobileData); rpc InternalRevokeBizClient(InternalRevokeBizClientReq) returns (InternalRevokeBizClientData); + rpc InternalDeleteUser(InternalDeleteUserReq) returns (InternalDeleteUserData); rpc InternalGetUserInfo(InternalGetUserInfoReq) returns (InternalGetUserInfoData); rpc InternalVerifyPassword(InternalVerifyPasswordReq) returns (InternalVerifyPasswordData); rpc InternalUsersByBiz(InternalUsersByBizReq) returns (InternalUsersByBizData); @@ -180,6 +181,20 @@ message InternalRevokeBizClientData { bool revoked = 1; } +message InternalDeleteUserReq { + int64 user_id = 1; +} + +message InternalDeleteUserClient { + string client_code = 1; + int64 biz_id = 2; +} + +message InternalDeleteUserData { + bool ok = 1; + repeated InternalDeleteUserClient clients = 2; +} + message InternalCheckCreateReq { string mobile = 1; } diff --git a/services/analysis/client/analysisuser/analysisUser.go b/services/analysis/client/analysisuser/analysisUser.go index 5e24d43..a344ace 100644 --- a/services/analysis/client/analysisuser/analysisUser.go +++ b/services/analysis/client/analysisuser/analysisUser.go @@ -30,6 +30,7 @@ type ( AnalysisUser interface { FaceBind(ctx context.Context, in *FaceBindReq, opts ...grpc.CallOption) (*Response, error) UserImprove(ctx context.Context, in *UserImproveReq, opts ...grpc.CallOption) (*Response, error) + // UserDelete 按平台 users.id 级联删除:analysis.users、人脸向量、以及 user 侧关联表。 UserDelete(ctx context.Context, in *UserDeleteReq, opts ...grpc.CallOption) (*Response, error) UserAuth(ctx context.Context, in *UserAuthReq, opts ...grpc.CallOption) (*Response, error) UserAuthList(ctx context.Context, in *UserAuthListReq, opts ...grpc.CallOption) (*Response, error) @@ -62,6 +63,7 @@ func (m *defaultAnalysisUser) UserImprove(ctx context.Context, in *UserImproveRe return client.UserImprove(ctx, in, opts...) } +// UserDelete 按平台 users.id 级联删除:analysis.users、人脸向量、以及 user 侧关联表。 func (m *defaultAnalysisUser) UserDelete(ctx context.Context, in *UserDeleteReq, opts ...grpc.CallOption) (*Response, error) { client := analysis.NewAnalysisUserClient(m.cli.Conn()) return client.UserDelete(ctx, in, opts...) diff --git a/services/analysis/internal/face/image.go b/services/analysis/internal/face/image.go index a7d03d7..0878c2b 100644 --- a/services/analysis/internal/face/image.go +++ b/services/analysis/internal/face/image.go @@ -14,8 +14,6 @@ import ( "github.com/google/uuid" ) -// PrepareImagePath 将上传字节或已有路径解析为 insightface 可读的本地路径。 -// 返回 cleanup 用于删除临时文件(共享路径不删)。 func PrepareImagePath(file []byte, filePath string) (string, func(), error) { noop := func() {} if len(file) > utils.NumberZero { diff --git a/services/analysis/internal/face/milvus.go b/services/analysis/internal/face/milvus.go index 0334f47..4f76c93 100644 --- a/services/analysis/internal/face/milvus.go +++ b/services/analysis/internal/face/milvus.go @@ -144,6 +144,18 @@ func UpsertFace(userID int64, vector []float32) error { return err } +func DeleteFace(userID int64) error { + c := getMilvus() + if c == nil { + return errors.New("milvus client is nil") + } + if userID < utils.NumberOne { + return errors.New("invalid face delete args") + } + ctx := context.Background() + return c.Delete(ctx, collectionName, "", fmt.Sprintf("%s == %d", faceUserIDField, userID)) +} + func SearchUser(vector []float32) (int64, float32, error) { c := getMilvus() if c == nil { diff --git a/services/analysis/internal/logic/analysisuser/userDeleteLogic.go b/services/analysis/internal/logic/analysisuser/userDeleteLogic.go index 43e408a..e9b3b08 100644 --- a/services/analysis/internal/logic/analysisuser/userDeleteLogic.go +++ b/services/analysis/internal/logic/analysisuser/userDeleteLogic.go @@ -8,12 +8,17 @@ import ( "lone-services/pkg/utils" "lone-services/pkg/validate" analysis "lone-services/rpc/analysis/pb" + userpb "lone-services/rpc/user/pb" + "lone-services/services/analysis/internal/dao" + "lone-services/services/analysis/internal/face" "lone-services/services/analysis/internal/logic/common" "lone-services/services/analysis/internal/model" "lone-services/services/analysis/internal/svc" "lone-services/services/analysis/validator" "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) type UserDeleteLogic struct { @@ -36,13 +41,43 @@ func (l *UserDeleteLogic) UserDelete(in *analysis.UserDeleteReq) (*analysis.Resp return common.OutResponse(utils.ErrorParams, msg), nil } - _, err := model.UserModel{}.Init().Del(modelbase.Params{ - Eq: map[string]string{"id": strconv.FormatInt(req.Id, utils.NumberTen)}, - }, map[string]string{}) - if err != nil { - l.Errorf("user delete: %v", err) + if err := face.DeleteFace(req.Id); err != nil { + l.Errorf("user delete milvus: %v", err) return common.FailResponse(utils.Fail), nil } + if l.svcCtx.UserSvcName == utils.StringEmpty { + return common.FailResponse(utils.Fail), nil + } + cli, err := svc.GetRpcClient(l.svcCtx.UserSvcName) + if err != nil { + l.Errorf("user delete get user rpc: %v", err) + return common.FailResponse(utils.Fail), nil + } + + deleted, err := userpb.NewUserClient(cli.Conn()).InternalDeleteUser(l.ctx, &userpb.InternalDeleteUserReq{ + UserId: req.Id, + }) + if err != nil { + if st, ok := status.FromError(err); ok && st.Code() == codes.NotFound { + return common.FailResponse(utils.ErrorNotFund), nil + } + l.Errorf("user delete internal: %v", err) + return common.FailResponse(utils.Fail), nil + } + + for _, c := range deleted.GetClients() { + if c.GetClientCode() != dao.ClientCodeUserSkin || c.GetBizId() < utils.NumberOne { + continue + } + _, delErr := model.UserModel{}.Init().Del(modelbase.Params{ + Eq: map[string]string{"id": strconv.FormatInt(c.GetBizId(), utils.NumberTen)}, + }, map[string]string{}) + if delErr != nil { + l.Errorf("user delete analysis user biz_id=%d: %v", c.GetBizId(), delErr) + return common.FailResponse(utils.Fail), nil + } + } + return common.OkResponse(nil), nil } diff --git a/services/analysis/internal/logic/analysisuser/userImproveLogic.go b/services/analysis/internal/logic/analysisuser/userImproveLogic.go index c37909b..eb5417e 100644 --- a/services/analysis/internal/logic/analysisuser/userImproveLogic.go +++ b/services/analysis/internal/logic/analysisuser/userImproveLogic.go @@ -132,7 +132,7 @@ func (l *UserImproveLogic) updatePlatformUser(loginUser utils.UserInfo, bizId in if _, err = userClient.InternalUpdate(l.ctx, updateReq); err != nil { l.Errorf("improve internal update: %v", err) - return utils.Fail + return utils.ErrorDataIsExist } return utils.Ok } diff --git a/services/analysis/internal/server/analysisuser/analysisUserServer.go b/services/analysis/internal/server/analysisuser/analysisUserServer.go index 9553939..13d4850 100644 --- a/services/analysis/internal/server/analysisuser/analysisUserServer.go +++ b/services/analysis/internal/server/analysisuser/analysisUserServer.go @@ -33,6 +33,7 @@ func (s *AnalysisUserServer) UserImprove(ctx context.Context, in *analysis.UserI return l.UserImprove(in) } +// UserDelete 按平台 users.id 级联删除:analysis.users、人脸向量、以及 user 侧关联表。 func (s *AnalysisUserServer) UserDelete(ctx context.Context, in *analysis.UserDeleteReq) (*analysis.Response, error) { l := analysisuserlogic.NewUserDeleteLogic(ctx, s.svcCtx) return l.UserDelete(in) diff --git a/services/analysis/validator/user.go b/services/analysis/validator/user.go index 15ccad8..53292ae 100644 --- a/services/analysis/validator/user.go +++ b/services/analysis/validator/user.go @@ -51,13 +51,13 @@ func (p AgreementInfoValidator) GetMessage() validate.ValidatorMessages { } type UserDeleteValidator struct { - Id int64 `validate:"required,gt=0"` + Id int64 `validate:"required,gt=0"` // 平台 users.id } func (p UserDeleteValidator) GetMessage() validate.ValidatorMessages { return validate.ValidatorMessages{ - "Id.required": "id 不能为空", - "Id.gt": "id 必须大于0", + "Id.required": "用户ID不能为空", + "Id.gt": "用户ID必须大于0", } } diff --git a/services/user/internal/logic/internalDeleteUserLogic.go b/services/user/internal/logic/internalDeleteUserLogic.go new file mode 100644 index 0000000..d0301d2 --- /dev/null +++ b/services/user/internal/logic/internalDeleteUserLogic.go @@ -0,0 +1,102 @@ +package logic + +import ( + "context" + "strconv" + + "lone-services/pkg/modelbase" + "lone-services/pkg/utils" + "lone-services/pkg/validate" + user "lone-services/rpc/user/pb" + "lone-services/services/user/internal/dao" + "lone-services/services/user/internal/model" + "lone-services/services/user/internal/svc" + "lone-services/services/user/validator" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "gorm.io/gorm" +) + +type InternalDeleteUserLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewInternalDeleteUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *InternalDeleteUserLogic { + return &InternalDeleteUserLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *InternalDeleteUserLogic) InternalDeleteUser(in *user.InternalDeleteUserReq) (*user.InternalDeleteUserData, error) { + var req validator.InternalDeleteUserValidator + if msg := validate.ValidateFromProto(in, &req); msg != utils.StringEmpty { + return nil, status.Error(codes.InvalidArgument, msg) + } + + userModel := model.UserModel{}.Init() + var row dao.UserRow + if err := userModel.GetOne(modelbase.Params{ + Eq: map[string]string{"id": strconv.FormatInt(req.UserId, utils.NumberTen)}, + }, &row); err != nil { + l.Errorf("internal delete user get: %v", err) + return nil, status.Error(codes.Internal, utils.Fail.Msg) + } + if row.Id < utils.NumberOne { + return nil, status.Error(codes.NotFound, utils.ErrorNotFund.Msg) + } + + clientModel := model.UserClientModel{}.Init() + var clients []dao.UserClient + if err := clientModel.Items(modelbase.Params{ + Eq: map[string]string{"user_id": strconv.FormatInt(req.UserId, utils.NumberTen)}, + }, &clients); err != nil { + l.Errorf("internal delete user clients: %v", err) + return nil, status.Error(codes.Internal, utils.Fail.Msg) + } + + outClients := make([]*user.InternalDeleteUserClient, 0, len(clients)) + for _, c := range clients { + outClients = append(outClients, &user.InternalDeleteUserClient{ + ClientCode: c.ClientCode, + BizId: c.BizId, + }) + } + + txErr := l.svcCtx.DB.WithContext(l.ctx).Transaction(func(tx *gorm.DB) error { + credModel := model.UserCredentialModel{}.Init() + credModel.Base = credModel.Base.WithTX(tx) + if _, err := credModel.Del(modelbase.Params{ + Eq: map[string]string{"user_id": strconv.FormatInt(req.UserId, utils.NumberTen)}, + }, &dao.UserCredential{}); err != nil { + return err + } + + ucModel := model.UserClientModel{}.Init() + ucModel.Base = ucModel.Base.WithTX(tx) + if _, err := ucModel.Del(modelbase.Params{ + Eq: map[string]string{"user_id": strconv.FormatInt(req.UserId, utils.NumberTen)}, + }, &dao.UserClient{}); err != nil { + return err + } + + if err := deleteUserDetail(tx, req.UserId); err != nil { + return err + } + return deleteUser(tx, req.UserId) + }) + if txErr != nil { + l.Errorf("internal delete user tx: %v", txErr) + return nil, status.Error(codes.Internal, utils.Fail.Msg) + } + + return &user.InternalDeleteUserData{ + Ok: true, + Clients: outClients, + }, nil +} diff --git a/services/user/internal/server/userServer.go b/services/user/internal/server/userServer.go index 15ab26b..84fbb11 100644 --- a/services/user/internal/server/userServer.go +++ b/services/user/internal/server/userServer.go @@ -123,6 +123,11 @@ func (s *UserServer) InternalRevokeBizClient(ctx context.Context, in *user.Inter return l.InternalRevokeBizClient(in) } +func (s *UserServer) InternalDeleteUser(ctx context.Context, in *user.InternalDeleteUserReq) (*user.InternalDeleteUserData, error) { + l := logic.NewInternalDeleteUserLogic(ctx, s.svcCtx) + return l.InternalDeleteUser(in) +} + func (s *UserServer) InternalGetUserInfo(ctx context.Context, in *user.InternalGetUserInfoReq) (*user.InternalGetUserInfoData, error) { l := logic.NewInternalGetUserInfoLogic(ctx, s.svcCtx) return l.InternalGetUserInfo(in) diff --git a/services/user/userClient/user.go b/services/user/userClient/user.go index 674e716..e6227ac 100644 --- a/services/user/userClient/user.go +++ b/services/user/userClient/user.go @@ -26,6 +26,9 @@ type ( InternalCheckUpdateReq = user.InternalCheckUpdateReq InternalCreateData = user.InternalCreateData InternalCreateReq = user.InternalCreateReq + InternalDeleteUserClient = user.InternalDeleteUserClient + InternalDeleteUserData = user.InternalDeleteUserData + InternalDeleteUserReq = user.InternalDeleteUserReq InternalGetUserInfoData = user.InternalGetUserInfoData InternalGetUserInfoReq = user.InternalGetUserInfoReq InternalLoginByUserIdData = user.InternalLoginByUserIdData @@ -74,6 +77,7 @@ type ( InternalUsersByIds(ctx context.Context, in *InternalUsersByIdsReq, opts ...grpc.CallOption) (*InternalUsersByIdsData, error) InternalUpdateMobile(ctx context.Context, in *InternalUpdateMobileReq, opts ...grpc.CallOption) (*InternalUpdateMobileData, error) InternalRevokeBizClient(ctx context.Context, in *InternalRevokeBizClientReq, opts ...grpc.CallOption) (*InternalRevokeBizClientData, error) + InternalDeleteUser(ctx context.Context, in *InternalDeleteUserReq, opts ...grpc.CallOption) (*InternalDeleteUserData, error) InternalGetUserInfo(ctx context.Context, in *InternalGetUserInfoReq, opts ...grpc.CallOption) (*InternalGetUserInfoData, error) InternalVerifyPassword(ctx context.Context, in *InternalVerifyPasswordReq, opts ...grpc.CallOption) (*InternalVerifyPasswordData, error) InternalUsersByBiz(ctx context.Context, in *InternalUsersByBizReq, opts ...grpc.CallOption) (*InternalUsersByBizData, error) @@ -191,6 +195,11 @@ func (m *defaultUser) InternalRevokeBizClient(ctx context.Context, in *InternalR return client.InternalRevokeBizClient(ctx, in, opts...) } +func (m *defaultUser) InternalDeleteUser(ctx context.Context, in *InternalDeleteUserReq, opts ...grpc.CallOption) (*InternalDeleteUserData, error) { + client := user.NewUserClient(m.cli.Conn()) + return client.InternalDeleteUser(ctx, in, opts...) +} + func (m *defaultUser) InternalGetUserInfo(ctx context.Context, in *InternalGetUserInfoReq, opts ...grpc.CallOption) (*InternalGetUserInfoData, error) { client := user.NewUserClient(m.cli.Conn()) return client.InternalGetUserInfo(ctx, in, opts...) diff --git a/services/user/validator/user.go b/services/user/validator/user.go index 1344dc4..028f1ba 100644 --- a/services/user/validator/user.go +++ b/services/user/validator/user.go @@ -270,6 +270,17 @@ func (p InternalRevokeBizClientValidator) GetMessage() validate.ValidatorMessage } } +type InternalDeleteUserValidator struct { + UserId int64 `validate:"required,gt=0"` +} + +func (p InternalDeleteUserValidator) GetMessage() validate.ValidatorMessages { + return validate.ValidatorMessages{ + "UserId.required": "用户ID不能为空", + "UserId.gt": "用户ID必须大于0", + } +} + type InternalCheckCreateValidator struct { Mobile string `validate:"required,max=20"` }