Skip to content

Commit 4c37a7e

Browse files
committed
feature(1.2.8): swagger 接口文档新增 Security
- 将 middleware 命名为 interceptor - 将 deploy 命名为 deployments - 移除 pkg/errno - 使用 proposal 目录 - 优化代码
1 parent fc7e58d commit 4c37a7e

File tree

114 files changed

+2552
-1419
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+2552
-1419
lines changed

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# FROM 基于 golang:1.15-alpine
2-
FROM golang:1.15-alpine AS builder
1+
# FROM 基于 golang:1.16-alpine
2+
FROM golang:1.16-alpine AS builder
33

44
# ENV 设置环境变量
55
ENV GOPATH=/opt/repo
66
ENV GO111MODULE=on
77
ENV GOPROXY=https://goproxy.io,direct
88

9-
# ADD 源路径 目标路径
9+
# COPY 源路径 目标路径
1010
COPY . $GOPATH/src/github.com/xinliangnote/go-gin-api
1111

1212
# RUN 执行 go build .

cmd/handlergen/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,14 @@ func main() {
8989
funcContent += fmt.Sprintf("// @Description%s \n", nameArr[1])
9090
// Tags
9191
funcContent += fmt.Sprintf("%s \n", v.Decorations().Start.All()[1])
92-
funcContent += fmt.Sprintf("// @Accept multipart/form-data \n")
92+
funcContent += fmt.Sprintf("// @Accept application/x-www-form-urlencoded \n")
9393
funcContent += fmt.Sprintf("// @Produce json \n")
9494
funcContent += fmt.Sprintf("// @Param Request body %sRequest true \"请求信息\" \n", Lcfirst(v.Names[0].String()))
9595
funcContent += fmt.Sprintf("// @Success 200 {object} %sResponse \n", Lcfirst(v.Names[0].String()))
9696
funcContent += fmt.Sprintf("// @Failure 400 {object} code.Failure \n")
9797
// Router
9898
funcContent += fmt.Sprintf("%s \n", v.Decorations().Start.All()[2])
99-
funcContent += fmt.Sprintf("func (h *handler) %s() core.HandlerFunc { \n return func(c core.Context) {\n\n}}", v.Names[0].String())
99+
funcContent += fmt.Sprintf("func (h *handler) %s() core.HandlerFunc { \n return func(ctx core.Context) {\n\n}}", v.Names[0].String())
100100

101101
funcFile.WriteString(funcContent)
102102
funcFile.Close()

configs/constants.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package configs
22

3+
import "time"
4+
35
const (
46
// MinGoVersion 最小 Go 版本
57
MinGoVersion = 1.16
@@ -28,12 +30,15 @@ const (
2830
// HeaderLoginToken 登录验证 Token,Header 中传递的参数
2931
HeaderLoginToken = "Token"
3032

31-
// HeaderSignToken 签名验证 Token,Header 中传递的参数
33+
// HeaderSignToken 签名验证 Authorization,Header 中传递的参数
3234
HeaderSignToken = "Authorization"
3335

3436
// HeaderSignTokenDate 签名验证 Date,Header 中传递的参数
3537
HeaderSignTokenDate = "Authorization-Date"
3638

39+
// HeaderSignTokenTimeout 签名有效期为 2 分钟
40+
HeaderSignTokenTimeout = time.Minute * 2
41+
3742
// RedisKeyPrefixLoginUser Redis Key 前缀 - 登录用户信息
3843
RedisKeyPrefixLoginUser = ProjectName + ":login-user:"
3944

@@ -48,4 +53,7 @@ const (
4853

4954
// MaxRequestsPerSecond 每秒最大请求量
5055
MaxRequestsPerSecond = 10000
56+
57+
// LoginSessionTTL 登录有效期为 24 小时
58+
LoginSessionTTL = time.Hour * 24
5159
)
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)