public: 发布2.8.0版本 (#1998)

* feat:修改token获取优先级,优先从header获取

* feat: 增加业务ctx的传递

* fix文件选择问题,
有公共函数onDownloadFile,去掉downloadFile

* 没问题

* feat: 增加context引入

* fix: 修复图片多选的情况下点击确定抽屉无法收起的bug

* feat: 提高header的token优先级,优化导出表格逻辑,不再依赖于cookie鉴权

---------

Co-authored-by: piexlMax(奇淼 <qimiaojiangjizhao@gmail.com>
Co-authored-by: task <121913992@qq.com>
This commit is contained in:
PiexlMax(奇淼
2025-03-15 13:31:33 +08:00
committed by GitHub
parent f776a061ce
commit ab75bc7f59
29 changed files with 416 additions and 100 deletions

View File

@@ -7,8 +7,10 @@
// @Success 200 {object} response.Response{data=object,msg=string} "获取成功"
// @Router /{{.Abbreviation}}/{{.Router}} [{{.Method}}]
func (a *{{.Abbreviation}}) {{.FuncName}}(c *gin.Context) {
// Context
ctx := c.Request.Context()
//
err := service{{ .StructName }}.{{.FuncName}}()
err := service{{ .StructName }}.{{.FuncName}}(ctx)
if err != nil {
global.GVA_LOG.Error("失败!", zap.Error(err))
response.FailWithMessage("失败", c)
@@ -28,8 +30,10 @@ func (a *{{.Abbreviation}}) {{.FuncName}}(c *gin.Context) {
// @Success 200 {object} response.Response{data=object,msg=string} "成功"
// @Router /{{.Abbreviation}}/{{.Router}} [{{.Method}}]
func ({{.Abbreviation}}Api *{{.StructName}}Api){{.FuncName}}(c *gin.Context) {
// Context
ctx := c.Request.Context()
//
err := {{.Abbreviation}}Service.{{.FuncName}}()
err := {{.Abbreviation}}Service.{{.FuncName}}(ctx)
if err != nil {
global.GVA_LOG.Error("失败!", zap.Error(err))
response.FailWithMessage("失败", c)

View File

@@ -8,7 +8,7 @@
// {{.FuncName}} {{.FuncDesc}}
// Author [yourname](https://github.com/yourname)
func (s *{{.Abbreviation}}) {{.FuncName}}() (err error) {
func (s *{{.Abbreviation}}) {{.FuncName}}(ctx context.Context) (err error) {
db := {{$db}}.Model(&model.{{.StructName}}{})
return db.Error
}
@@ -17,9 +17,9 @@ func (s *{{.Abbreviation}}) {{.FuncName}}() (err error) {
// {{.FuncName}} {{.FuncDesc}}
// Author [yourname](https://github.com/yourname)
func ({{.Abbreviation}}Service *{{.StructName}}Service){{.FuncName}}() (err error) {
func ({{.Abbreviation}}Service *{{.StructName}}Service){{.FuncName}}(ctx context.Context) (err error) {
//
db := {{$db}}.Model(&{{.Package}}.{{.StructName}}{})
return db.Error
}
{{end}}
{{end}}