Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into book/proxima
Browse files Browse the repository at this point in the history
  • Loading branch information
oldme-git committed Dec 17, 2024
2 parents 040e983 + 953e547 commit c3013ef
Show file tree
Hide file tree
Showing 86 changed files with 620 additions and 715 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,17 @@ jobs:
name: Build And Deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4

- name: Check documentation consistency
run: |
bash .github/workflows/consistency-check.sh
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn
Expand Down
67 changes: 37 additions & 30 deletions .github/workflows/build-check.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,37 @@
name: Build check

on:
push:
branches-ignore:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
deploy:
name: Build check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn

- name: Install dependencies
run: |
yarn
- name: Build website
run: |
make build
name: Build check

on:
push:
branches-ignore:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
deploy:
name: Build check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Check documentation consistency
run: |
bash .github/workflows/consistency-check.sh
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn

- name: Install dependencies
run: |
yarn
- name: Build website
run: |
make build
40 changes: 40 additions & 0 deletions .github/workflows/consistency-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env bash

IGNORE_FILES="来杯咖啡.md"

# Convert IGNORE_FILES to array
IFS=' ' read -r -a ignore_array <<< "$IGNORE_FILES"

# Find all markdown files in docs directory
missing_files=0
while IFS= read -r file; do
# Get relative path from docs directory
rel_path="${file#docs/}"

# Check if file should be ignored
should_ignore=0
for ignore_file in "${ignore_array[@]}"; do
if [[ "$rel_path" == *"$ignore_file" ]]; then
should_ignore=1
break
fi
done

# Skip check if file should be ignored
if [ $should_ignore -eq 1 ]; then
echo "Ignoring file: ${rel_path}"
continue
fi

# Check if corresponding English translation exists
if [ ! -f "i18n/en/docusaurus-plugin-content-docs/current/${rel_path}" ]; then
echo "Missing English translation for: ${rel_path}"
missing_files=$((missing_files + 1))
fi
done < <(find docs -name "*.md" -type f)

# Exit with error if any files are missing
if [ $missing_files -gt 0 ]; then
echo "Error: Found ${missing_files} files without English translations"
exit 1
fi
34 changes: 25 additions & 9 deletions docs/community/支持我们/来杯咖啡.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
---
slug: '/supportus/donate'
title: '来杯咖啡☕️'
title: 'Warm Coffee☕️'
sidebar_position: 0
hide_title: true
keywords: [GoFrame,GoFrame框架,捐赠,微信支付,支付宝支付,开源支持,开源社区,捐赠支持,项目支持,编码社区]
description: '支持GoFrame框架项目,通过微信、支付宝以及码云等渠道进行捐赠。捐赠者可以在支付备注中留下自己的GitHub或Gitee账号,帮助框架不断发展壮大。感谢所有支持者,推动开源社区的进步和发展。'
---

We currently accept donation by `Wechat`/ `Alipay`/ `Gitee`, please note your `github`/ `gitee` account in your payment bill.
Expand All @@ -23,7 +21,7 @@ We currently accept donation by `Wechat`/ `Alipay`/ `Gitee`, please note your `g

## Donates

Latest updated at/最后更新日志:2024-09-26 19:53:00
Latest updated at/最后更新日志:2024-12-04 21:40:00

| Name | Channel | Amount | Time | Comment |
| --- | --- | --- | --- | --- |
Expand All @@ -32,6 +30,7 @@ Latest updated at/最后更新日志:2024-09-26 19:53:00
| [Han Wang](https://gitee.com/hwang7799) | `gitee` | `¥1000.00` | | 感谢您的开源项目!感谢您详细的说明文档!祝GoFrame越来越好 |
| \*\*源(che\*\*\*@qq.com) | `alipay` | `¥888.88` | | |
| soidea666 | `wechat+qq` | `¥800.00` | | |
| 孙庆鹏 | `wechat` | `¥666.00` | `2024-12-05 09:24:24` | gf加油,兄弟加油 |
| [闫沧](https://github.com/ireadx) | `alipay` | `¥589.00` | - |`golang` 以来 `gf` 一直都在 |
| 大海 | `wechat` | `¥588.00` | | 精品认可 |
| Tom | `wechat` | `¥500.00` | | 一点心意 希望 `GF` 越来越好 |
Expand All @@ -41,7 +40,7 @@ Latest updated at/最后更新日志:2024-09-26 19:53:00
| [佳雨](https://github.com/xinjiayu) | `wechat` | `¥300.00` | - | 加油! |
| [liusuxian](https://github.com/liusuxian) | `alipay` | `¥300.00` | | |
| 慧橞云汤姆 | `alipay` | `¥288.00` | | 慧橞云汤姆。感谢付出。 |
| \*\* | `alipay` | `¥268.88` | | |
| [lingcoder](https://github.com/lingcoder) | `alipay` | `¥268.88` | | |
| [王中阳](https://www.bilibili.com/video/BV1Ng41167fW/) | `wechat` | `¥266.66` | | 我会多多分享 `GoFrame` 实战教程,和社区一起越做越好! |
| 扶程星云 | `wechat` | `¥266.66` | | `goframe` 框架真不错,学习资料也很全👍 |
| 侯哥 | `wechat` | `¥210.00` | | |
Expand Down Expand Up @@ -111,10 +110,15 @@ Latest updated at/最后更新日志:2024-09-26 19:53:00
| 霍莹辉 | `wechat` | `¥100.00` | `2023-08-18 12:29:01` | gf v3 |
| 陈暖 | `wechat` | `¥100.00` | `2023-10-24 14:30:49` | 祝愿gf越做越好 |
| 乐道 | `wechat` | `¥100.00` | `2024-04-26 10:40:51` | 感谢log的ser prefix功能 |
| 凌江涛 | `wechat` | `¥100.00` | `2024-05-11 12:08:04` | 加油!感谢goframe |
| 凌江涛 | `wechat` | `¥100.00` | `2024-07-09 08:29:04` | 请强哥喝咖啡 |
| 凌江涛 | `wechat` | `¥100.00` | `2024-09-25 14:31:15` | 来杯咖啡提提神! |
| [lingcoder](https://github.com/lingcoder) | `wechat` | `¥100.00` | `2024-05-11 12:08:04` | 加油!感谢goframe |
| [lingcoder](https://github.com/lingcoder) | `wechat` | `¥100.00` | `2024-07-09 08:29:04` | 请强哥喝咖啡 |
| [lingcoder](https://github.com/lingcoder) | `wechat` | `¥100.00` | `2024-09-25 14:31:15` | 来杯咖啡提提神! |
| 義薄雲天💋🍃🌺💋 | `wechat` | `¥100.00` | `2024-09-26 10:43:06` | |
| [jiatower](https://github.com/jiatower)| `alipay` | `¥100.00` | `2024-09-27 10:28:17` | |
| [ibryang](https://github.com/ibryang) | `wechat` | `¥100.00` | `2024-09-30 13:32:13` | |
| 喜子 | `wechat` | `¥100.00` | `2024-09-30 14:39:07` | 万事如意 |
| [lingcoder](https://github.com/lingcoder) | `alipay` | `¥100.00` | `2024-12-04 19:10:29` | 加油GF!给强哥点杯咖啡 |
| 杨延庆 | `wechat` | `¥100.00` | `2024-11-06 11:27:43` | |
| 严宇轩 | `alipay` | `¥99.99` | | |
| [米司特包](https://github.com/misitebao) | `wechat` | `¥99.99` | | |
| [seny0929](https://gitee.com/seny0929) | `wechat` | `¥99.90` | | |
Expand All @@ -134,6 +138,8 @@ Latest updated at/最后更新日志:2024-09-26 19:53:00
| 紫焰 | `wechat` | `¥88.00` | `2023-01-18 16:15:21` | 强哥一年辛苦了!用GF赚钱了,请你喝杯奶茶,明年再接再厉✌️ |
| 冰冰 | `wechat` | `¥88.00` | | |
| | `wechat` | `¥88.00` | `2022-07-06 22:40:01` | 祝GF越来越好 |
| 飞龙左 | `wechat` | `¥88.00` | `2024-09-30 12:57:10` | 希望goframe越来越好,持续发展100年 |
| AD | `wechat` | `¥88.00` | `2024-09-30 13:11:40` | 争取成为国产TOP 1 |
| 郭亚浩 | `wechat` | `¥80.00` | | |
| Hades | `alipay` | `¥66.66` | | |
| C\*e | `wechat` | `¥66.66` | | `GF` 越来越好,棒👍! |
Expand Down Expand Up @@ -174,6 +180,7 @@ Latest updated at/最后更新日志:2024-09-26 19:53:00
| yinfeng | `wechat` | `¥66.00` | `2023-09-15 16:47:43` | 老同事,加油 |
| 霍莹辉 | `wechat` | `¥66.00` | `2024-03-13 13:53:21` | 期望一年一个版本 |
| 饶友 | `wechat` | `¥66.00` | `2024-05-08 09:04:18` | 支持 |
| 邱利茂 | `wechat` | `¥66.00` | `2024-09-30 12:52:40` | 👍👍 |
| 【追寻】 | `wechat` | `¥52.10` | `2022-05-20 11:45:27` | 2022.05.20http + grpc. 愿越来越好 |
|\*e | `wechat` | `¥50.00` | | |
| [katydid酱](https://gitee.com/katydid2005) | `gitee` | `¥50.00` | | 感谢您的开源项目!框架给予了很大的帮助!谢谢大佬! |
Expand Down Expand Up @@ -257,7 +264,11 @@ Latest updated at/最后更新日志:2024-09-26 19:53:00
| 水雕歌 | `wechat` | `¥20.00` | `2023-08-18 08:33:51` | 强哥,加油。 |
| | `wechat` | `¥20.00` | `2023-08-18 10:21:32` | 祝gf越来越强 |
| | `wechat` | `¥20.00` | `2023-08-25 13:27:14` | 愿gf越来越好 |
| 灯火消逝的码头 | `wechat` | `¥20.00` | `2024-01-30 15:59:33` | 愿所有的努力值得您的一句赞赏 |
| 灯火消逝的码头 | `wechat` | `¥20.00` | `2024-01-30 15:59:33` | |
| 卡卡 | `wechat` | `¥20.00` | `2024-09-30 13:15:56` | 继续打磨 |
| ℳঞ💕 | `wechat` | `¥20.00` | `2024-09-30 13:56:08` | gf越来越强大 |
| 黄石头 | `wechat` | `¥20.00` | `2024-09-30 14:50:23` | |
| 马健鸿 | `wechat` | `¥20.00` | `2024-09-30 20:30:45` | 强哥,加油👏 |
| 郭淑芸 | `wechat` | `¥19.90` | `2022-07-06 22:56:15` | 默默水群的见习猎人 感谢强哥包容 |
| R\*s | `wechat` | `¥18.88` | | 谢谢 `GF`!辛苦了! |
| [Mr.奇淼](https://www.gin-vue-admin.com/) | `wechat` | `¥18.88` | | 强哥无敌,奇淼爱你 |
Expand Down Expand Up @@ -371,6 +382,11 @@ Latest updated at/最后更新日志:2024-09-26 19:53:00
| | `wechat` | `¥10.00` | `2023-09-30 09:31:42` | 愿越来越好,使用框架赚到了点辛苦钱,感谢有你 GoFrame |
| lin文锐 | `wechat` | `¥10.00` | `2023-11-23 11:48:58` | 谢谢,gf很强 |
| 广州大智汇 | `wechat` | `¥10.00` | `2023-11-29 17:37:58` | |
| Sumail | `wechat` | `¥10.00` | `2024-09-30 12:51:19` | |
| [tutuge](https://github.com/tutuge) | `wechat` | `¥10.00` | `2024-09-30 13:03:52` | |
| lobtao | `wechat` | `¥10.00` | `2024-09-30 13:08:37` | 😂 |
| | `wechat` | `¥10.00` | `2024-09-30 13:11:20` | 一杯奶茶 |
| HUGO | `wechat` | `¥10.00` | `2024-10-01 01:48:12` | |
| [米司特包](https://github.com/misitebao) | `wechat` | `¥9.99` | | |
| faddei | `qq` | `¥9.99` | | |
| \*| `alipay` | `¥9.99` | | 支持一下, `gf` 越来越好 |
Expand Down
2 changes: 1 addition & 1 deletion docs/community/社区交流/技术交流群.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ description: '加入GoFrame框架的技术交流群,参与GoFrame实战群和
点击链接加入群聊【GoFrame实战3群】: [https://qm.qq.com/q/K7UMKSrVq8](https://qm.qq.com/q/K7UMKSrVq8)

## 加入微信群
扫描或微信添加 `389961817` 备注 `GF` 加群
扫描或微信添加 `389961817` 备注 加群

<img src="/markdown/57c4df7168f6b77c3442e823b65613f8.png" style={{width: 200}} />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ $ gf up
| &nbsp;&nbsp;&nbsp;&nbsp;`cmd` | 入口指令 | 命令行管理目录。可以管理维护多个命令行。 |
| &nbsp;&nbsp;&nbsp;&nbsp;`consts` | 常量定义 | 项目所有常量定义。 |
| &nbsp;&nbsp;&nbsp;&nbsp;`controller` | 接口处理 | 接收/解析用户输入参数的入口/接口层。 |
| &nbsp;&nbsp;&nbsp;&nbsp;`dao` | 数据访问 | 数据访问对象,这是一层抽象对象,用于和底层数据库交互,仅包含最基础的 CURD 方法。 |
| &nbsp;&nbsp;&nbsp;&nbsp;`dao` | 数据访问 | 数据访问对象,这是一层抽象对象,用于和底层数据库交互,仅包含最基础的 CRUD 方法。 |
| &nbsp;&nbsp;&nbsp;&nbsp;`logic` | 业务封装 | 业务逻辑封装管理,特定的业务逻辑实现和封装。往往是项目中最复杂的部分。 |
| &nbsp;&nbsp;&nbsp;&nbsp;`model` | 结构模型 | 数据结构管理模块,管理数据实体对象,以及输入与输出数据结构定义。 |
| &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`do` | 领域对象 | 用于 dao 数据操作中业务模型与实例模型转换,由工具维护,用户不能修改。 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ description: '使用GET方式查询单词的分页列表,包含模糊查询功

*api/words/v1/words_struct.go*
```go
package v1
import "github.com/gogf/gf/v2/os/gtime"
type List struct {
Id uint `json:"id"`
Word string `json:"word"`
Definition string `json:"definition"`
ProficiencyLevel uint `json:"proficiencyLevel"`
package v1

import "star/internal/model"

type List struct {
Id uint `json:"id"`
Word string `json:"word"`
Definition string `json:"definition"`
ProficiencyLevel model.ProficiencyLevel `json:"proficiencyLevel"`
}
```

Expand Down
23 changes: 22 additions & 1 deletion docs/docs/WEB服务开发/接口文档/接口文档-OpenAPIv3.md
Original file line number Diff line number Diff line change
Expand Up @@ -469,4 +469,25 @@ func main() {

![](/markdown/452372a121db73abd8c5027077b3026e.png)

我们可以发现通过通用的 `OpenAPIv3` 对象我们可以自定义修改其内容,并且根据它生成其他各种自定义类型的接口文档。
我们可以发现通过通用的 `OpenAPIv3` 对象我们可以自定义修改其内容,并且根据它生成其他各种自定义类型的接口文档。

## 六、添加api.json(swagger)自定义鉴权

对于需要进行api文档鉴权的情况,可以使用 `ghttp.BindHookHandler` 方法对 `s.GetOpenApiPath()` 路由绑定前置方法进行鉴权,示例如下:

``` go
func main() {
s := g.Server()
// if api.json requires authentication, add openApiBasicAuth handler
s.BindHookHandler(s.GetOpenApiPath(), ghttp.HookBeforeServe, openApiBasicAuth)
s.Run()
}

func openApiBasicAuth(r *ghttp.Request) {
if !r.BasicAuth("OpenApiAuthUserName", "OpenApiAuthPass", "Restricted") {
r.ExitAll()
return
}
}

```
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ slug: '/docs/web/router-registering-strict-router-faq'
title: '规范路由-常见问题'
sidebar_position: 2
hide_title: true
keywords: [GoFrame,GoFrame框架,规范路由,HTTP Method,RESTful接口,API设计,用户接口,CURD操作,Meta标签,Response结构体]
keywords: [GoFrame,GoFrame框架,规范路由,HTTP Method,RESTful接口,API设计,用户接口,CRUD操作,Meta标签,Response结构体]
description: '在使用GoFrame框架的规范路由下,如何支持同一接口的多种HTTP Method提交方式。在设计RESTful接口时,每个API应有明确的HTTP Method对应,如创建用户、获取用户列表等。如果需要一个接口支持多个HTTP Method,可以通过Meta标签设置。此外,介绍如何使用类型别名让Response结构体的Data字段返回数组形式。'
---

## 在规范路由下,同一接口如何支持多种 `HTTP Method` 提交方式

首先,一个接口应当只做一件事情, `HTTP Method` 是有意义的(例如 `RESTful` 接口风格设计),一个接口支持多种 `HTTP Method` 方式通常是接口设计不合理,建议重新审视接口设计。

通常是不存在一个 `API` 需要绑定多个 `HTTP Method` 的场景的。例如,拿用户接口来讲,一个 `CURD` 接口在 `RESTful` 实现应当有 `4-5``API` 定义,实现不同的业务逻辑。那么可能存在以下 `API` 定义的 `RESTful` 接口:
通常是不存在一个 `API` 需要绑定多个 `HTTP Method` 的场景的。例如,拿用户接口来讲,一个 `CRUD` 接口在 `RESTful` 实现应当有 `4-5``API` 定义,实现不同的业务逻辑。那么可能存在以下 `API` 定义的 `RESTful` 接口:

```
接口名称 Method Path
Expand Down
Loading

0 comments on commit c3013ef

Please sign in to comment.