Skip to content

Commit

Permalink
Merge branch 'dev/michaelhu' into feat/openapi
Browse files Browse the repository at this point in the history
  • Loading branch information
Matrix-X committed Sep 4, 2024
2 parents 1b40481 + 41dbc69 commit db5b195
Show file tree
Hide file tree
Showing 13 changed files with 223 additions and 154 deletions.
4 changes: 2 additions & 2 deletions api/admin/crm/business/opportunity.api
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ syntax = "v1"
info(
title: "商机管理"
desc: "商机管理"
author: "YourName"
email: "yourEmail@example.com"
author: "Matrix-X"
email: "matrix-x@artisan-cloud.com"
version: "v1"
)

Expand Down
2 changes: 1 addition & 1 deletion api/admin/crm/product/product.api
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ type (
ProductId int64 `path:"id"`
}

DisableProductReply struct{
DisableProductReply{
ProductId int64 `json:"id"`
}

Expand Down
1 change: 0 additions & 1 deletion api/admin/crm/trade/warehouse.api
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ info (
)

service PowerX {

@doc("查询仓库列表")
@handler ListWarehouses
get /warehouses (ListWarehousesRequest) returns (ListWarehousesResponse)
Expand Down
8 changes: 4 additions & 4 deletions api/admin/dictionary.api
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ type (
Total int64 `json:"total"`
}

GetDictionaryTypeRequest struct{
GetDictionaryTypeRequest{
DictionaryType string `path:"type"`
}

GetDictionaryTypeReply struct{
GetDictionaryTypeReply{
*DictionaryType
}
)
Expand Down Expand Up @@ -150,12 +150,12 @@ type (
List []DictionaryItem `json:"list"`
}

GetDictionaryItemRequest struct{
GetDictionaryItemRequest{
DictionaryType string `path:"type"`
DictionaryItem string `path:"key"`
}

GetDictionaryItemReply struct{
GetDictionaryItemReply{
*DictionaryItem
}
)
Expand Down
4 changes: 2 additions & 2 deletions api/mp/product/productcategory.api
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ service PowerX {
}

type (
ListProductCategoriesRequest struct{
ListProductCategoriesRequest{
CategoryPId int `form:"categoryPId,optional"`
NeedChildren bool `form:"needChildren,optional"`
Limit int `form:"limit,optional"`
}

ListProductCategoriesReply struct{
ListProductCategoriesReply{
ProductCategories []*ProductCategory `json:"list"`
}
)
Expand Down
2 changes: 1 addition & 1 deletion api/mp/trade/billingaddress.api
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ info(
)


import "./shippingaddress.api"
import "../../admin/crm/trade/shippingaddress.api"

@server(
group: mp/crm/trade/address/billing
Expand Down
4 changes: 2 additions & 2 deletions api/mp/trade/deliveryaddress.api
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ info(
version: "v1"
)

import "./shippingaddress.api"
import "../../admin/crm/trade/shippingaddress.api"

@server(
group: mp/crm/trade/address/delivery
Expand All @@ -17,7 +17,7 @@ import "./shippingaddress.api"
)

service PowerX {
@doc("查询订单发货地址列表")
// @doc("查询订单发货地址列表")
@handler ListDeliveryAddressesPage
get /delivery/page-list (ListDeliveryAddressesPageRequest) returns (ListDeliveryAddressesPageReply)

Expand Down
3 changes: 2 additions & 1 deletion api/mp/trade/shippingaddress.api
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ info(
)


import "../../admin/crm/trade/shippingaddress.api"

@server(
group: mp/crm/trade/address/shipping
prefix: /api/v1/mp/trade/address
middleware: MPCustomerJWTAuth, MPCustomerGet
)

service PowerX {
@doc("查询收货地址列表")
@handler ListShippingAddressesPage
Expand Down
1 change: 1 addition & 0 deletions api/openapi.api
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import "openapi/demo.api"
43 changes: 43 additions & 0 deletions api/openapi/demo.api
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
syntax = "v1"

info(
title: "Demo Open API"
desc: "This is a demo Open API for testing purposes."
author: "Matrix-X"
email: "[email protected]"
version: "v1"
)


@server(
jwt: Auth
group: openapi
prefix: /openapi/v1
)


service OpenAPI {
@doc "Get the version of the API"
@handler GetVersion
get /version returns (GetVersionResponse)

@doc "Create a new echo message"
@handler CreateEcho
post /echo (CreateEchoRequest) returns (CreateEchoResponse)
}


type (
GetVersionResponse {
Version string `json:"version,optional"`
}


CreateEchoRequest {
Echo string `json:"echo,optional"`
}

CreateEchoResponse {
Response string `json:"response,optional"`
}
)
1 change: 1 addition & 0 deletions api/powerx.api
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import "admin.scrm.api"
import "admin.wechat.offiaccount.api"
import "mp.api"
import "web.api"
import "openapi.api"

import "custom.api"
import "plugin.api"
Expand Down
99 changes: 49 additions & 50 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module PowerX

go 1.21
go 1.21.0

//replace github.com/ArtisanCloud/PowerWeChat/v3 => ../../../PowerWechat/PowerWeChat

Expand All @@ -14,19 +14,19 @@ require (
github.com/gin-gonic/gin v1.9.0
github.com/golang-jwt/jwt/v4 v4.5.0
github.com/golang-module/carbon/v2 v2.2.3
github.com/google/uuid v1.3.1
github.com/google/uuid v1.6.0
github.com/gorilla/mux v1.8.0
github.com/kr/pretty v0.3.1
github.com/minio/minio-go/v7 v7.0.52
github.com/pkg/errors v0.9.1
github.com/robfig/cron/v3 v3.0.1
github.com/stretchr/testify v1.8.4
github.com/stretchr/testify v1.9.0
github.com/urfave/cli/v2 v2.11.0
github.com/zeromicro/go-zero v1.5.6
github.com/zeromicro/go-zero/tools/goctl v1.5.6
github.com/zeromicro/go-zero v1.7.2
github.com/zeromicro/go-zero/tools/goctl v1.7.2
github.com/zeromicro/zero-contrib/router/gin v0.0.0-20230708101417-16e73a5d116c
golang.org/x/crypto v0.13.0
golang.org/x/oauth2 v0.10.0
golang.org/x/crypto v0.26.0
golang.org/x/oauth2 v0.22.0
gopkg.in/yaml.v3 v3.0.1
gorm.io/datatypes v1.1.1
gorm.io/driver/mysql v1.4.7
Expand All @@ -35,92 +35,91 @@ require (
)

require (
filippo.io/edwards25519 v1.1.0 // indirect
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bytedance/sonic v1.8.0 // indirect
github.com/cenkalti/backoff/v4 v4.2.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/clbanning/mxj/v2 v2.7.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/fatih/color v1.15.0 // indirect
github.com/fatih/color v1.17.0 // indirect
github.com/fatih/structtag v1.2.0 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.11.2 // indirect
github.com/go-redis/redis/v8 v8.11.5 // indirect
github.com/go-sql-driver/mysql v1.7.1 // indirect
github.com/go-sql-driver/mysql v1.8.1 // indirect
github.com/goccy/go-json v0.10.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/gookit/color v1.5.4 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
github.com/jackc/pgx/v5 v5.4.3 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jackc/pgx/v5 v5.6.0 // indirect
github.com/jackc/puddle/v2 v2.2.1 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.16.0 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
github.com/lib/pq v1.10.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/minio/md5-simd v1.1.2 // indirect
github.com/minio/sha256-simd v1.0.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/openzipkin/zipkin-go v0.4.1 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/openzipkin/zipkin-go v0.4.3 // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.16.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/procfs v0.10.1 // indirect
github.com/redis/go-redis/v9 v9.1.0 // indirect
github.com/rogpeppe/go-internal v1.9.0 // indirect
github.com/prometheus/client_golang v1.20.2 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.58.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/redis/go-redis/v9 v9.6.1 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/rs/xid v1.4.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.9 // indirect
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
github.com/zeromicro/antlr v0.0.1 // indirect
go.opentelemetry.io/otel v1.14.0 // indirect
go.opentelemetry.io/otel/exporters/jaeger v1.14.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.14.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.14.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.14.0 // indirect
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.14.0 // indirect
go.opentelemetry.io/otel/exporters/zipkin v1.14.0 // indirect
go.opentelemetry.io/otel/sdk v1.14.0 // indirect
go.opentelemetry.io/otel/trace v1.14.0 // indirect
go.opentelemetry.io/proto/otlp v0.19.0 // indirect
go.opentelemetry.io/otel v1.29.0 // indirect
go.opentelemetry.io/otel/exporters/jaeger v1.17.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.29.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.29.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.29.0 // indirect
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.29.0 // indirect
go.opentelemetry.io/otel/exporters/zipkin v1.29.0 // indirect
go.opentelemetry.io/otel/metric v1.29.0 // indirect
go.opentelemetry.io/otel/sdk v1.29.0 // indirect
go.opentelemetry.io/otel/trace v1.29.0 // indirect
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
go.uber.org/automaxprocs v1.5.3 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.25.0 // indirect
golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect
golang.org/x/net v0.15.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/text v0.13.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230913181813-007df8e322eb // indirect
google.golang.org/grpc v1.58.2 // indirect
google.golang.org/protobuf v1.31.0 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/text v0.17.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect
google.golang.org/grpc v1.66.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down
Loading

0 comments on commit db5b195

Please sign in to comment.