This commit is contained in:
李子铭 2025-03-03 15:07:14 +08:00
parent 0db44baa84
commit 6dd6be6214
7 changed files with 104 additions and 21 deletions

4
.gitignore vendored
View File

@ -23,8 +23,8 @@ Thumbs.db
.vscode/
.idea/
bin/
cache
runtime/
cert/
configs_prd
api/**/*.go
/cmd/server/wire_gen.go
/internal/conf/*.go

View File

@ -15,17 +15,6 @@ else
API_PROTO_FILES=$(shell find api -name *.proto)
endif
.PHONY: deploy
#deploy 命令格式make deploy folder=./configs_dev
deploy:
@echo '正在部署中...'
sh ./deploy.sh $(folder) $(image_name) $(container_name) $(http_port)
.PHONY: deploy2
#deploy2
deploy2:
@echo '正在部署中...'
sh ./deploy2.sh $(folder) $(image_name) $(container_name) $(http_port)
.PHONY: init
# init env
init:
@ -71,7 +60,7 @@ build:
.PHONY: generate
# generate
generate:
#go generate ./...
go generate ./...
.PHONY: gorm
# gorm

View File

@ -8,5 +8,33 @@ import "validate/validate.proto";
import "v1/common.proto";
service Order {
rpc Order (OrderRequest) returns (OrderReply) {
option (google.api.http) = {
post: "/openapi/v1/voucher/order",
body:"*"
};
}
rpc Query (QueryRequest) returns (QueryReply) {
option (google.api.http) = {
post: "/openapi/v1/voucher/query",
body:"*"
};
}
}
message OrderRequest {
}
message OrderReply {
}
message QueryRequest {
}
message QueryReply {
}

View File

@ -46,7 +46,7 @@ const (
func init() {
flag.StringVar(&nacosIp, "nacosIp", "120.55.12.245", "nacos ip address")
flag.IntVar(&nacosPort, "nacosPort", 8848, "nacos port")
flag.StringVar(&nacosSpace, "nacosSpace", "marketing", "nacos space")
flag.StringVar(&nacosSpace, "nacosSpace", "voucher", "nacos space")
flag.StringVar(&nacosUsername, "nacosUsername", "nacos", "nacos passowrd")
flag.StringVar(&nacosPassword, "nacosPassword", "LsxdNacos@2025", "nacos passowrd")
flag.Parse()

View File

@ -30,8 +30,8 @@ rocketMQ:
secretToken: ""
eventMap:
order:
topic: voucher_order_xx
group: voucher_order_xx_group
topic: voucher_order_create
group: voucher_order_create_group
isOpenConsumer: false #是否启动消费 true/false
PerCoroutineCnt: 5 #协程数量不配置默认为20
RetryCnt: 3 #重试次数,不配置默认38

View File

@ -1,6 +1,12 @@
package service
import "voucher/internal/biz"
import (
"context"
v1 "voucher/api/v1"
"voucher/internal/biz"
)
var _ v1.OrderHTTPServer = (*VoucherService)(nil)
type VoucherService struct {
VoucherBiz *biz.VoucherBiz
@ -9,3 +15,13 @@ type VoucherService struct {
func NewVoucherService(VoucherBiz *biz.VoucherBiz) *VoucherService {
return &VoucherService{VoucherBiz: VoucherBiz}
}
func (v VoucherService) Order(ctx context.Context, request *v1.OrderRequest) (*v1.OrderReply, error) {
//TODO implement me
panic("implement me")
}
func (v VoucherService) Query(ctx context.Context, request *v1.QueryRequest) (*v1.QueryReply, error) {
//TODO implement me
panic("implement me")
}

View File

@ -3,8 +3,58 @@
openapi: 3.0.3
info:
title: ""
title: Order API
version: 0.0.1
paths: {}
paths:
/openapi/v1/voucher/order:
post:
tags:
- Order
operationId: Order_Order
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/api.v1.OrderRequest'
required: true
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/api.v1.OrderReply'
/openapi/v1/voucher/query:
post:
tags:
- Order
operationId: Order_Query
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/api.v1.QueryRequest'
required: true
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/api.v1.QueryReply'
components:
schemas: {}
schemas:
api.v1.OrderReply:
type: object
properties: {}
api.v1.OrderRequest:
type: object
properties: {}
api.v1.QueryReply:
type: object
properties: {}
api.v1.QueryRequest:
type: object
properties: {}
tags:
- name: Order