连接微服务报错测试

This commit is contained in:
徐俊杰 2023-03-16 11:46:54 +08:00
parent 5f13ac9a05
commit 06e63b96b3
5 changed files with 909 additions and 535 deletions

View File

@ -11,6 +11,7 @@ import (
"github.com/fonchain/fonchain-artistinfo/pkg/cache" "github.com/fonchain/fonchain-artistinfo/pkg/cache"
db "github.com/fonchain/fonchain-artistinfo/pkg/db" db "github.com/fonchain/fonchain-artistinfo/pkg/db"
"github.com/fonchain/fonchain-artistinfo/pkg/m" "github.com/fonchain/fonchain-artistinfo/pkg/m"
_ "github.com/fonchain/fonchain-artistinfo/pkg/service"
) )
// export DUBBO_GO_CONFIG_PATH= PATH_TO_SAMPLES/helloworld/go-server/conf/dubbogo.yaml // export DUBBO_GO_CONFIG_PATH= PATH_TO_SAMPLES/helloworld/go-server/conf/dubbogo.yaml

File diff suppressed because it is too large Load Diff

View File

@ -26,9 +26,11 @@ service Account {
rpc Logout (DecryptJwtRequest) returns (CommonResponse) {} rpc Logout (DecryptJwtRequest) returns (CommonResponse) {}
rpc OffLine (CommonRequest) returns (CommonResponse) {} rpc OffLine (CommonRequest) returns (CommonResponse) {}
rpc OnlineLog (LoginInfosByUserIdRequest) returns (LoginLogsResponse) {}//id获取登录的信息 rpc OnlineLog (LoginInfosByUserIdRequest) returns (LoginLogsResponse) {}//id获取登录的信息
rpc OnlineLogById (OnlineLogByIdRequest) returns (LoginLog) {}//id获取登录的信息
rpc CheckPwd (CheckPwdRequest) returns (UpdateResponse) {}// rpc CheckPwd (CheckPwdRequest) returns (UpdateResponse) {}//
rpc Register (RegistRequest) returns (RequestStatus) {} rpc Register (RegistRequest) returns (RequestStatus) {}
rpc SendMsg (SendMsgRequest) returns (SendMsgStatusResponse) {} rpc SendMsg (SendMsgRequest) returns (SendMsgStatusResponse) {}
rpc SendCustomMsg (SendCustomMsgRequest) returns (SendMsgStatusResponse) {}
rpc SendMsgRegister (SendMsgRequest) returns (SendMsgStatusResponse) {} rpc SendMsgRegister (SendMsgRequest) returns (SendMsgStatusResponse) {}
rpc CheckMsg (CheckMsgRequest) returns (SendMsgStatusResponse) {} rpc CheckMsg (CheckMsgRequest) returns (SendMsgStatusResponse) {}
rpc SendNewTelNumMsg (SendNewTelNumMsgRequest) returns (SendMsgStatusResponse) {}//, rpc SendNewTelNumMsg (SendNewTelNumMsgRequest) returns (SendMsgStatusResponse) {}//,
@ -64,11 +66,18 @@ message LoginLog {
string ExpireDate = 7 [json_name = "expireDate"]; string ExpireDate = 7 [json_name = "expireDate"];
string LastDate = 8 [json_name = "lastDate"]; string LastDate = 8 [json_name = "lastDate"];
string LogoutDate = 9 [json_name = "logoutDate"]; string LogoutDate = 9 [json_name = "logoutDate"];
string CreatedAt = 10 [json_name = "createdAt"];
string Address = 11 [json_name = "address"];
}
message OnlineLogByIdRequest {
string Domain = 1 [json_name = "domain"];
uint64 ID = 2 [json_name = "ID"];
} }
message LoginInfosByUserIdRequest { message LoginInfosByUserIdRequest {
string Domain = 1 [json_name = "domain"]; string Domain = 1 [json_name = "domain"];
uint64 UserId = 2 [json_name = "userId"]; uint64 UserId = 2 [json_name = "userId"];
} }
message SendNewTelNumMsgRequest { message SendNewTelNumMsgRequest {
@ -109,6 +118,16 @@ message SendMsgRequest {
string Project = 3 [json_name = "telNum"]; string Project = 3 [json_name = "telNum"];
} }
message SendCustomMsgRequest {
string Domain = 1 [json_name = "domain",(validator.field) = {string_not_empty: true,human_error: "70001"} ];
string TelNum = 2 [json_name = "telNum",(validator.field) = {regex: "^1\\d{10}$",human_error: "70002"}];
string Project = 3 [json_name = "telNum"];
string Url = 4 [json_name = "Url"];
uint64 ID = 5 [json_name = "ID"];
uint64 MId = 6 [json_name = "mId"];
uint64 Location = 7 [json_name = "location"];
}
message CheckMsgRequest { message CheckMsgRequest {
string Domain = 1 [json_name = "domain",(validator.field) = {string_not_empty: true,human_error: "70001"} ]; string Domain = 1 [json_name = "domain",(validator.field) = {string_not_empty: true,human_error: "70001"} ];
string TelNum = 2 [json_name = "telNum",(validator.field) = {regex: "^1\\d{10}$",human_error: "70002"}]; string TelNum = 2 [json_name = "telNum",(validator.field) = {regex: "^1\\d{10}$",human_error: "70002"}];
@ -228,8 +247,9 @@ message LoginRequest {
} }
message TokenInfo { message TokenInfo {
AccountInfo AccountInfo = 1 [json_name = "accountInfo"]; AccountInfo AccountInfo = 1 [json_name = "accountInfo"];
string Token = 2 [json_name = "token"]; string Token = 2 [json_name = "token"];
bool IsSampleAddress = 3 [json_name = "isSampleAddress"];
} }
message Extend { message Extend {
@ -269,5 +289,6 @@ message AccountInfo {
repeated Department Departments = 23 [json_name = "departments"]; repeated Department Departments = 23 [json_name = "departments"];
string Ip = 24 [json_name = "ip"]; string Ip = 24 [json_name = "ip"];
string LoginDate = 25 [json_name = "loginDate"]; string LoginDate = 25 [json_name = "loginDate"];
string InvitationCode = 26 [json_name = "invitationCode"]; string InvitationCode = 26 [json_name = "invitationCode"];
uint64 NowLogId = 27 [json_name = "nowLogId"];
} }

View File

@ -33,6 +33,9 @@ func (this *LoginLogsResponse) Validate() error {
func (this *LoginLog) Validate() error { func (this *LoginLog) Validate() error {
return nil return nil
} }
func (this *OnlineLogByIdRequest) Validate() error {
return nil
}
func (this *LoginInfosByUserIdRequest) Validate() error { func (this *LoginInfosByUserIdRequest) Validate() error {
return nil return nil
} }
@ -76,6 +79,18 @@ func (this *SendMsgRequest) Validate() error {
return nil return nil
} }
var _regex_SendCustomMsgRequest_TelNum = regexp.MustCompile(`^1\d{10}$`)
func (this *SendCustomMsgRequest) Validate() error {
if this.Domain == "" {
return github_com_mwitkow_go_proto_validators.FieldError("Domain", fmt.Errorf(`70001`))
}
if !_regex_SendCustomMsgRequest_TelNum.MatchString(this.TelNum) {
return github_com_mwitkow_go_proto_validators.FieldError("TelNum", fmt.Errorf(`70002`))
}
return nil
}
var _regex_CheckMsgRequest_TelNum = regexp.MustCompile(`^1\d{10}$`) var _regex_CheckMsgRequest_TelNum = regexp.MustCompile(`^1\d{10}$`)
func (this *CheckMsgRequest) Validate() error { func (this *CheckMsgRequest) Validate() error {

View File

@ -32,9 +32,11 @@ type AccountClient interface {
Logout(ctx context.Context, in *DecryptJwtRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment) Logout(ctx context.Context, in *DecryptJwtRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
OffLine(ctx context.Context, in *CommonRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment) OffLine(ctx context.Context, in *CommonRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
OnlineLog(ctx context.Context, in *LoginInfosByUserIdRequest, opts ...grpc_go.CallOption) (*LoginLogsResponse, common.ErrorWithAttachment) OnlineLog(ctx context.Context, in *LoginInfosByUserIdRequest, opts ...grpc_go.CallOption) (*LoginLogsResponse, common.ErrorWithAttachment)
OnlineLogById(ctx context.Context, in *OnlineLogByIdRequest, opts ...grpc_go.CallOption) (*LoginLog, common.ErrorWithAttachment)
CheckPwd(ctx context.Context, in *CheckPwdRequest, opts ...grpc_go.CallOption) (*UpdateResponse, common.ErrorWithAttachment) CheckPwd(ctx context.Context, in *CheckPwdRequest, opts ...grpc_go.CallOption) (*UpdateResponse, common.ErrorWithAttachment)
Register(ctx context.Context, in *RegistRequest, opts ...grpc_go.CallOption) (*RequestStatus, common.ErrorWithAttachment) Register(ctx context.Context, in *RegistRequest, opts ...grpc_go.CallOption) (*RequestStatus, common.ErrorWithAttachment)
SendMsg(ctx context.Context, in *SendMsgRequest, opts ...grpc_go.CallOption) (*SendMsgStatusResponse, common.ErrorWithAttachment) SendMsg(ctx context.Context, in *SendMsgRequest, opts ...grpc_go.CallOption) (*SendMsgStatusResponse, common.ErrorWithAttachment)
SendCustomMsg(ctx context.Context, in *SendCustomMsgRequest, opts ...grpc_go.CallOption) (*SendMsgStatusResponse, common.ErrorWithAttachment)
SendMsgRegister(ctx context.Context, in *SendMsgRequest, opts ...grpc_go.CallOption) (*SendMsgStatusResponse, common.ErrorWithAttachment) SendMsgRegister(ctx context.Context, in *SendMsgRequest, opts ...grpc_go.CallOption) (*SendMsgStatusResponse, common.ErrorWithAttachment)
CheckMsg(ctx context.Context, in *CheckMsgRequest, opts ...grpc_go.CallOption) (*SendMsgStatusResponse, common.ErrorWithAttachment) CheckMsg(ctx context.Context, in *CheckMsgRequest, opts ...grpc_go.CallOption) (*SendMsgStatusResponse, common.ErrorWithAttachment)
SendNewTelNumMsg(ctx context.Context, in *SendNewTelNumMsgRequest, opts ...grpc_go.CallOption) (*SendMsgStatusResponse, common.ErrorWithAttachment) SendNewTelNumMsg(ctx context.Context, in *SendNewTelNumMsgRequest, opts ...grpc_go.CallOption) (*SendMsgStatusResponse, common.ErrorWithAttachment)
@ -61,9 +63,11 @@ type AccountClientImpl struct {
Logout func(ctx context.Context, in *DecryptJwtRequest) (*CommonResponse, error) Logout func(ctx context.Context, in *DecryptJwtRequest) (*CommonResponse, error)
OffLine func(ctx context.Context, in *CommonRequest) (*CommonResponse, error) OffLine func(ctx context.Context, in *CommonRequest) (*CommonResponse, error)
OnlineLog func(ctx context.Context, in *LoginInfosByUserIdRequest) (*LoginLogsResponse, error) OnlineLog func(ctx context.Context, in *LoginInfosByUserIdRequest) (*LoginLogsResponse, error)
OnlineLogById func(ctx context.Context, in *OnlineLogByIdRequest) (*LoginLog, error)
CheckPwd func(ctx context.Context, in *CheckPwdRequest) (*UpdateResponse, error) CheckPwd func(ctx context.Context, in *CheckPwdRequest) (*UpdateResponse, error)
Register func(ctx context.Context, in *RegistRequest) (*RequestStatus, error) Register func(ctx context.Context, in *RegistRequest) (*RequestStatus, error)
SendMsg func(ctx context.Context, in *SendMsgRequest) (*SendMsgStatusResponse, error) SendMsg func(ctx context.Context, in *SendMsgRequest) (*SendMsgStatusResponse, error)
SendCustomMsg func(ctx context.Context, in *SendCustomMsgRequest) (*SendMsgStatusResponse, error)
SendMsgRegister func(ctx context.Context, in *SendMsgRequest) (*SendMsgStatusResponse, error) SendMsgRegister func(ctx context.Context, in *SendMsgRequest) (*SendMsgStatusResponse, error)
CheckMsg func(ctx context.Context, in *CheckMsgRequest) (*SendMsgStatusResponse, error) CheckMsg func(ctx context.Context, in *CheckMsgRequest) (*SendMsgStatusResponse, error)
SendNewTelNumMsg func(ctx context.Context, in *SendNewTelNumMsgRequest) (*SendMsgStatusResponse, error) SendNewTelNumMsg func(ctx context.Context, in *SendNewTelNumMsgRequest) (*SendMsgStatusResponse, error)
@ -117,6 +121,12 @@ func (c *accountClient) OnlineLog(ctx context.Context, in *LoginInfosByUserIdReq
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/OnlineLog", in, out) return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/OnlineLog", in, out)
} }
func (c *accountClient) OnlineLogById(ctx context.Context, in *OnlineLogByIdRequest, opts ...grpc_go.CallOption) (*LoginLog, common.ErrorWithAttachment) {
out := new(LoginLog)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/OnlineLogById", in, out)
}
func (c *accountClient) CheckPwd(ctx context.Context, in *CheckPwdRequest, opts ...grpc_go.CallOption) (*UpdateResponse, common.ErrorWithAttachment) { func (c *accountClient) CheckPwd(ctx context.Context, in *CheckPwdRequest, opts ...grpc_go.CallOption) (*UpdateResponse, common.ErrorWithAttachment) {
out := new(UpdateResponse) out := new(UpdateResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string) interfaceKey := ctx.Value(constant.InterfaceKey).(string)
@ -135,6 +145,12 @@ func (c *accountClient) SendMsg(ctx context.Context, in *SendMsgRequest, opts ..
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/SendMsg", in, out) return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/SendMsg", in, out)
} }
func (c *accountClient) SendCustomMsg(ctx context.Context, in *SendCustomMsgRequest, opts ...grpc_go.CallOption) (*SendMsgStatusResponse, common.ErrorWithAttachment) {
out := new(SendMsgStatusResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/SendCustomMsg", in, out)
}
func (c *accountClient) SendMsgRegister(ctx context.Context, in *SendMsgRequest, opts ...grpc_go.CallOption) (*SendMsgStatusResponse, common.ErrorWithAttachment) { func (c *accountClient) SendMsgRegister(ctx context.Context, in *SendMsgRequest, opts ...grpc_go.CallOption) (*SendMsgStatusResponse, common.ErrorWithAttachment) {
out := new(SendMsgStatusResponse) out := new(SendMsgStatusResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string) interfaceKey := ctx.Value(constant.InterfaceKey).(string)
@ -233,9 +249,11 @@ type AccountServer interface {
Logout(context.Context, *DecryptJwtRequest) (*CommonResponse, error) Logout(context.Context, *DecryptJwtRequest) (*CommonResponse, error)
OffLine(context.Context, *CommonRequest) (*CommonResponse, error) OffLine(context.Context, *CommonRequest) (*CommonResponse, error)
OnlineLog(context.Context, *LoginInfosByUserIdRequest) (*LoginLogsResponse, error) OnlineLog(context.Context, *LoginInfosByUserIdRequest) (*LoginLogsResponse, error)
OnlineLogById(context.Context, *OnlineLogByIdRequest) (*LoginLog, error)
CheckPwd(context.Context, *CheckPwdRequest) (*UpdateResponse, error) CheckPwd(context.Context, *CheckPwdRequest) (*UpdateResponse, error)
Register(context.Context, *RegistRequest) (*RequestStatus, error) Register(context.Context, *RegistRequest) (*RequestStatus, error)
SendMsg(context.Context, *SendMsgRequest) (*SendMsgStatusResponse, error) SendMsg(context.Context, *SendMsgRequest) (*SendMsgStatusResponse, error)
SendCustomMsg(context.Context, *SendCustomMsgRequest) (*SendMsgStatusResponse, error)
SendMsgRegister(context.Context, *SendMsgRequest) (*SendMsgStatusResponse, error) SendMsgRegister(context.Context, *SendMsgRequest) (*SendMsgStatusResponse, error)
CheckMsg(context.Context, *CheckMsgRequest) (*SendMsgStatusResponse, error) CheckMsg(context.Context, *CheckMsgRequest) (*SendMsgStatusResponse, error)
SendNewTelNumMsg(context.Context, *SendNewTelNumMsgRequest) (*SendMsgStatusResponse, error) SendNewTelNumMsg(context.Context, *SendNewTelNumMsgRequest) (*SendMsgStatusResponse, error)
@ -271,6 +289,9 @@ func (UnimplementedAccountServer) OffLine(context.Context, *CommonRequest) (*Com
func (UnimplementedAccountServer) OnlineLog(context.Context, *LoginInfosByUserIdRequest) (*LoginLogsResponse, error) { func (UnimplementedAccountServer) OnlineLog(context.Context, *LoginInfosByUserIdRequest) (*LoginLogsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method OnlineLog not implemented") return nil, status.Errorf(codes.Unimplemented, "method OnlineLog not implemented")
} }
func (UnimplementedAccountServer) OnlineLogById(context.Context, *OnlineLogByIdRequest) (*LoginLog, error) {
return nil, status.Errorf(codes.Unimplemented, "method OnlineLogById not implemented")
}
func (UnimplementedAccountServer) CheckPwd(context.Context, *CheckPwdRequest) (*UpdateResponse, error) { func (UnimplementedAccountServer) CheckPwd(context.Context, *CheckPwdRequest) (*UpdateResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CheckPwd not implemented") return nil, status.Errorf(codes.Unimplemented, "method CheckPwd not implemented")
} }
@ -280,6 +301,9 @@ func (UnimplementedAccountServer) Register(context.Context, *RegistRequest) (*Re
func (UnimplementedAccountServer) SendMsg(context.Context, *SendMsgRequest) (*SendMsgStatusResponse, error) { func (UnimplementedAccountServer) SendMsg(context.Context, *SendMsgRequest) (*SendMsgStatusResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SendMsg not implemented") return nil, status.Errorf(codes.Unimplemented, "method SendMsg not implemented")
} }
func (UnimplementedAccountServer) SendCustomMsg(context.Context, *SendCustomMsgRequest) (*SendMsgStatusResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SendCustomMsg not implemented")
}
func (UnimplementedAccountServer) SendMsgRegister(context.Context, *SendMsgRequest) (*SendMsgStatusResponse, error) { func (UnimplementedAccountServer) SendMsgRegister(context.Context, *SendMsgRequest) (*SendMsgStatusResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SendMsgRegister not implemented") return nil, status.Errorf(codes.Unimplemented, "method SendMsgRegister not implemented")
} }
@ -469,6 +493,35 @@ func _Account_OnlineLog_Handler(srv interface{}, ctx context.Context, dec func(i
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _Account_OnlineLogById_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(OnlineLogByIdRequest)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("OnlineLogById", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _Account_CheckPwd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) { func _Account_CheckPwd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(CheckPwdRequest) in := new(CheckPwdRequest)
if err := dec(in); err != nil { if err := dec(in); err != nil {
@ -556,6 +609,35 @@ func _Account_SendMsg_Handler(srv interface{}, ctx context.Context, dec func(int
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _Account_SendCustomMsg_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(SendCustomMsgRequest)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("SendCustomMsg", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _Account_SendMsgRegister_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) { func _Account_SendMsgRegister_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(SendMsgRequest) in := new(SendMsgRequest)
if err := dec(in); err != nil { if err := dec(in); err != nil {
@ -1014,6 +1096,10 @@ var Account_ServiceDesc = grpc_go.ServiceDesc{
MethodName: "OnlineLog", MethodName: "OnlineLog",
Handler: _Account_OnlineLog_Handler, Handler: _Account_OnlineLog_Handler,
}, },
{
MethodName: "OnlineLogById",
Handler: _Account_OnlineLogById_Handler,
},
{ {
MethodName: "CheckPwd", MethodName: "CheckPwd",
Handler: _Account_CheckPwd_Handler, Handler: _Account_CheckPwd_Handler,
@ -1026,6 +1112,10 @@ var Account_ServiceDesc = grpc_go.ServiceDesc{
MethodName: "SendMsg", MethodName: "SendMsg",
Handler: _Account_SendMsg_Handler, Handler: _Account_SendMsg_Handler,
}, },
{
MethodName: "SendCustomMsg",
Handler: _Account_SendCustomMsg_Handler,
},
{ {
MethodName: "SendMsgRegister", MethodName: "SendMsgRegister",
Handler: _Account_SendMsgRegister_Handler, Handler: _Account_SendMsgRegister_Handler,