代码调整

This commit is contained in:
李子铭 2025-03-21 17:47:58 +08:00
parent 6183b7cf4d
commit 41c1be4763
5 changed files with 45 additions and 10 deletions

View File

@ -4,6 +4,7 @@ package api.v1;
option go_package = "voucher/api/v1;v1"; option go_package = "voucher/api/v1;v1";
import "validate/validate.proto"; import "validate/validate.proto";
import "google/api/annotations.proto"; import "google/api/annotations.proto";
import "v1/common.proto";
service Cmb { 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 { message CmbRequest {

7
api/v1/common.proto Normal file
View File

@ -0,0 +1,7 @@
syntax = "proto3";
package api.v1;
option go_package = "voucher/api/v1;v1";
//
message Empty {}

View File

@ -62,3 +62,12 @@ func (s *CmbService) DecryptBody(ctx context.Context, request *v1.EncryptBodyReq
DecryptBody: decryptBody, DecryptBody: decryptBody,
}, nil }, 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
}

View File

@ -1,7 +1,6 @@
package service package service
import ( import (
"github.com/go-kratos/kratos/v2/transport/http"
"github.com/robfig/cron" "github.com/robfig/cron"
"voucher/internal/biz" "voucher/internal/biz"
"voucher/internal/conf" "voucher/internal/conf"
@ -24,12 +23,3 @@ func NewVoucherService(
VoucherBiz: VoucherBiz, VoucherBiz: VoucherBiz,
} }
} }
func (s *VoucherService) Test(ctx http.Context) error {
if err := s.VoucherBiz.ExecuteNotice(ctx); err != nil {
return err
}
return nil
}

View File

@ -132,6 +132,24 @@ paths:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/api.v1.CmbRequest' $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: components:
schemas: schemas:
api.v1.CmbOrderRequest: api.v1.CmbOrderRequest:
@ -236,6 +254,10 @@ components:
properties: properties:
decryptBody: decryptBody:
type: string type: string
api.v1.Empty:
type: object
properties: {}
description: 空请求或返回
api.v1.EncryptBodyRequest: api.v1.EncryptBodyRequest:
type: object type: object
properties: properties: