diff --git a/api/v1/cmb_cpn.proto b/api/v1/cmb_cpn.proto index 8512042..13941f4 100644 --- a/api/v1/cmb_cpn.proto +++ b/api/v1/cmb_cpn.proto @@ -4,6 +4,7 @@ package api.v1; option go_package = "voucher/api/v1;v1"; import "validate/validate.proto"; import "google/api/annotations.proto"; +import "v1/common.proto"; service Cmb { @@ -55,6 +56,12 @@ service Cmb { }; } + rpc Test (Empty) returns (Empty) { + option (google.api.http) = { + post: "/voucher/cmb/v1/test", + body: "*" + }; + } } message CmbRequest { diff --git a/api/v1/common.proto b/api/v1/common.proto new file mode 100644 index 0000000..9b1780c --- /dev/null +++ b/api/v1/common.proto @@ -0,0 +1,7 @@ +syntax = "proto3"; + +package api.v1; +option go_package = "voucher/api/v1;v1"; + +// 空请求或返回 +message Empty {} \ No newline at end of file diff --git a/internal/service/cmb_mock.go b/internal/service/cmb_mock.go index 4b71eaa..eee8948 100644 --- a/internal/service/cmb_mock.go +++ b/internal/service/cmb_mock.go @@ -62,3 +62,12 @@ func (s *CmbService) DecryptBody(ctx context.Context, request *v1.EncryptBodyReq DecryptBody: decryptBody, }, nil } + +func (s *VoucherService) Test(ctx context.Context, request *v1.Empty) (*v1.Empty, error) { + + if err := s.VoucherBiz.ExecuteNotice(ctx); err != nil { + return nil, err + } + + return nil, nil +} diff --git a/internal/service/voucher.go b/internal/service/voucher.go index 64b4c2b..0d3745b 100644 --- a/internal/service/voucher.go +++ b/internal/service/voucher.go @@ -1,7 +1,6 @@ package service import ( - "github.com/go-kratos/kratos/v2/transport/http" "github.com/robfig/cron" "voucher/internal/biz" "voucher/internal/conf" @@ -24,12 +23,3 @@ func NewVoucherService( VoucherBiz: VoucherBiz, } } - -func (s *VoucherService) Test(ctx http.Context) error { - - if err := s.VoucherBiz.ExecuteNotice(ctx); err != nil { - return err - } - - return nil -} diff --git a/third_party/swagger_ui/openapi.yaml b/third_party/swagger_ui/openapi.yaml index c91552e..eb8440b 100644 --- a/third_party/swagger_ui/openapi.yaml +++ b/third_party/swagger_ui/openapi.yaml @@ -132,6 +132,24 @@ paths: application/json: schema: $ref: '#/components/schemas/api.v1.CmbRequest' + /voucher/cmb/v1/test: + post: + tags: + - Cmb + operationId: Cmb_Test + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/api.v1.Empty' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/api.v1.Empty' components: schemas: api.v1.CmbOrderRequest: @@ -236,6 +254,10 @@ components: properties: decryptBody: type: string + api.v1.Empty: + type: object + properties: {} + description: 空请求或返回 api.v1.EncryptBodyRequest: type: object properties: