feat 自定义问答
This commit is contained in:
@@ -24,6 +24,8 @@ const _ = grpc.SupportPackageIsVersion7
|
||||
type QgdzsClient interface {
|
||||
// 生成题目
|
||||
GenerateQuestion(ctx context.Context, in *GenerateQuestionReq, opts ...grpc.CallOption) (*GenerateQuestionResp, error)
|
||||
// 自定义问答
|
||||
CustomAnswerQuestion(ctx context.Context, in *CustomAnswerQuestionReq, opts ...grpc.CallOption) (*CustomAnswerQuestionResp, error)
|
||||
// ---------- 随机答题 ----------
|
||||
// 获取题目
|
||||
RandomGetQuestion(ctx context.Context, in *RandomGetQuestionReq, opts ...grpc.CallOption) (*RandomGetQuestionResp, error)
|
||||
@@ -70,6 +72,15 @@ func (c *qgdzsClient) GenerateQuestion(ctx context.Context, in *GenerateQuestion
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *qgdzsClient) CustomAnswerQuestion(ctx context.Context, in *CustomAnswerQuestionReq, opts ...grpc.CallOption) (*CustomAnswerQuestionResp, error) {
|
||||
out := new(CustomAnswerQuestionResp)
|
||||
err := c.cc.Invoke(ctx, "/Qgdzs/CustomAnswerQuestion", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *qgdzsClient) RandomGetQuestion(ctx context.Context, in *RandomGetQuestionReq, opts ...grpc.CallOption) (*RandomGetQuestionResp, error) {
|
||||
out := new(RandomGetQuestionResp)
|
||||
err := c.cc.Invoke(ctx, "/Qgdzs/RandomGetQuestion", in, out, opts...)
|
||||
@@ -175,6 +186,8 @@ func (c *qgdzsClient) GetPoint(ctx context.Context, in *GetPointReq, opts ...grp
|
||||
type QgdzsServer interface {
|
||||
// 生成题目
|
||||
GenerateQuestion(context.Context, *GenerateQuestionReq) (*GenerateQuestionResp, error)
|
||||
// 自定义问答
|
||||
CustomAnswerQuestion(context.Context, *CustomAnswerQuestionReq) (*CustomAnswerQuestionResp, error)
|
||||
// ---------- 随机答题 ----------
|
||||
// 获取题目
|
||||
RandomGetQuestion(context.Context, *RandomGetQuestionReq) (*RandomGetQuestionResp, error)
|
||||
@@ -212,6 +225,9 @@ type UnimplementedQgdzsServer struct {
|
||||
func (UnimplementedQgdzsServer) GenerateQuestion(context.Context, *GenerateQuestionReq) (*GenerateQuestionResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GenerateQuestion not implemented")
|
||||
}
|
||||
func (UnimplementedQgdzsServer) CustomAnswerQuestion(context.Context, *CustomAnswerQuestionReq) (*CustomAnswerQuestionResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CustomAnswerQuestion not implemented")
|
||||
}
|
||||
func (UnimplementedQgdzsServer) RandomGetQuestion(context.Context, *RandomGetQuestionReq) (*RandomGetQuestionResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method RandomGetQuestion not implemented")
|
||||
}
|
||||
@@ -276,6 +292,24 @@ func _Qgdzs_GenerateQuestion_Handler(srv interface{}, ctx context.Context, dec f
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Qgdzs_CustomAnswerQuestion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CustomAnswerQuestionReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QgdzsServer).CustomAnswerQuestion(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/Qgdzs/CustomAnswerQuestion",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QgdzsServer).CustomAnswerQuestion(ctx, req.(*CustomAnswerQuestionReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Qgdzs_RandomGetQuestion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(RandomGetQuestionReq)
|
||||
if err := dec(in); err != nil {
|
||||
@@ -485,6 +519,10 @@ var Qgdzs_ServiceDesc = grpc.ServiceDesc{
|
||||
MethodName: "GenerateQuestion",
|
||||
Handler: _Qgdzs_GenerateQuestion_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CustomAnswerQuestion",
|
||||
Handler: _Qgdzs_CustomAnswerQuestion_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "RandomGetQuestion",
|
||||
Handler: _Qgdzs_RandomGetQuestion_Handler,
|
||||
|
||||
Reference in New Issue
Block a user