publish: 发布2.7.4版本Beta (#1880)
* 媒体库增加批量导入URL * fix 描述错误 * feature: 自动化代码方法支持增加方法描述 * update: 更新依赖,升级为最新版本 * feature: 自动化代码预览部分支持黑夜模式 * fixed: 修复keepalive上线后失效的bug * feature: 增加自动化基础模板功能 * feature: 增加自动化基础模板功能 * 将用户配置保存到数据库,刷新或者异地登录配置不丢失 * update: 清除无用的userinfo配置信息 * fixed: 清理开发阶段页面无端进入404的bug * feature: 前端主题配置跟随用户,不再单独设置json编译生效。 * feature: 增加个人中心配置兼容性 * fix(package): 包名设置为中文会导致无法自动生成代码,禁止包名设置为中文 * feature: 格式化代码 * feature: 对严格模式新建根角色进行调整。 * feature: 版本变更为2.7.4 --------- Co-authored-by: sliboy <34034053+sliboy@users.noreply.github.com> Co-authored-by: ba0ch3ng <ba0ch3ng@foxmail.com> Co-authored-by: task <121913992@qq.com> Co-authored-by: task <ms.yangdan@gmail.com> Co-authored-by: 爱丽-黑子 <62006632+ailiheizi@users.noreply.github.com> Co-authored-by: sliboy <sliboy@hotmail.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
{{if not .OnlyTemplate}}
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/plugin/{{.Package}}/model"
|
||||
@@ -10,12 +11,16 @@ import (
|
||||
{{- if .AutoCreateResource}}
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/utils"
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
|
||||
"github.com/gin-gonic/gin"
|
||||
{{- end }}
|
||||
)
|
||||
|
||||
var {{.StructName}} = new({{.Abbreviation}})
|
||||
|
||||
type {{.Abbreviation}} struct {}
|
||||
|
||||
{{if not .OnlyTemplate}}
|
||||
// Create{{.StructName}} 创建{{.Description}}
|
||||
// @Tags {{.StructName}}
|
||||
// @Summary 创建{{.Description}}
|
||||
@@ -186,7 +191,7 @@ func (a *{{.Abbreviation}}) Get{{.StructName}}DataSource(c *gin.Context) {
|
||||
response.OkWithData(dataSource, c)
|
||||
}
|
||||
{{- end }}
|
||||
|
||||
{{- end }}
|
||||
// Get{{.StructName}}Public 不需要鉴权的{{.Description}}接口
|
||||
// @Tags {{.StructName}}
|
||||
// @Summary 不需要鉴权的{{.Description}}接口
|
||||
@@ -197,5 +202,6 @@ func (a *{{.Abbreviation}}) Get{{.StructName}}DataSource(c *gin.Context) {
|
||||
// @Router /{{.Abbreviation}}/get{{.StructName}}Public [get]
|
||||
func (a *{{.Abbreviation}}) Get{{.StructName}}Public(c *gin.Context) {
|
||||
// 此接口不需要鉴权 示例为返回了一个固定的消息接口,一般本接口用于C端服务,需要自己实现业务逻辑
|
||||
service{{ .StructName }}.Get{{.StructName}}Public()
|
||||
response.OkWithDetailed(gin.H{"info": "不需要鉴权的{{.Description}}接口信息"}, "获取成功", c)
|
||||
}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package model
|
||||
|
||||
{{- if not .OnlyTemplate}}
|
||||
import (
|
||||
{{- if .GvaModel }}
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
@@ -11,9 +12,11 @@ import (
|
||||
"gorm.io/datatypes"
|
||||
{{- end }}
|
||||
)
|
||||
{{- end }}
|
||||
|
||||
// {{.StructName}} {{.Description}} 结构体
|
||||
type {{.StructName}} struct {
|
||||
{{- if not .OnlyTemplate}}
|
||||
{{- if .GvaModel }}
|
||||
global.GVA_MODEL
|
||||
{{- end }}
|
||||
@@ -45,6 +48,7 @@ type {{.StructName}} struct {
|
||||
UpdatedBy uint `gorm:"column:updated_by;comment:更新者"`
|
||||
DeletedBy uint `gorm:"column:deleted_by;comment:删除者"`
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
}
|
||||
|
||||
{{ if .TableName }}
|
||||
|
@@ -1,11 +1,13 @@
|
||||
package request
|
||||
|
||||
{{- if not .OnlyTemplate}}
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
|
||||
{{ if or .HasSearchTimer .GvaModel}}"time"{{ end }}
|
||||
)
|
||||
|
||||
{{- end}}
|
||||
type {{.StructName}}Search struct{
|
||||
{{- if not .OnlyTemplate}}
|
||||
|
||||
{{- if .GvaModel }}
|
||||
StartCreatedAt *time.Time `json:"startCreatedAt" form:"startCreatedAt"`
|
||||
EndCreatedAt *time.Time `json:"endCreatedAt" form:"endCreatedAt"`
|
||||
@@ -31,4 +33,5 @@ type {{.StructName}}Search struct{
|
||||
Sort string `json:"sort" form:"sort"`
|
||||
Order string `json:"order" form:"order"`
|
||||
{{- end}}
|
||||
{{- end}}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/middleware"
|
||||
{{if .OnlyTemplate }} // {{end}}"github.com/flipped-aurora/gin-vue-admin/server/middleware"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
@@ -11,6 +11,7 @@ type {{.Abbreviation}} struct {}
|
||||
|
||||
// Init 初始化 {{.Description}} 路由信息
|
||||
func (r *{{.Abbreviation}}) Init(public *gin.RouterGroup, private *gin.RouterGroup) {
|
||||
{{- if not .OnlyTemplate }}
|
||||
{
|
||||
group := private.Group("{{.Abbreviation}}").Use(middleware.OperationRecord())
|
||||
group.POST("create{{.StructName}}", api{{.StructName}}.Create{{.StructName}}) // 新建{{.Description}}
|
||||
@@ -23,11 +24,23 @@ func (r *{{.Abbreviation}}) Init(public *gin.RouterGroup, private *gin.RouterGro
|
||||
group.GET("find{{.StructName}}", api{{.StructName}}.Find{{.StructName}}) // 根据ID获取{{.Description}}
|
||||
group.GET("get{{.StructName}}List", api{{.StructName}}.Get{{.StructName}}List) // 获取{{.Description}}列表
|
||||
}
|
||||
{{- if .HasDataSource}}
|
||||
{
|
||||
group := public.Group("{{.Abbreviation}}")
|
||||
{{- if .HasDataSource}}
|
||||
group.GET("get{{.StructName}}DataSource", api{{.StructName}}.Get{{.StructName}}DataSource) // 获取{{.Description}}数据源
|
||||
group.GET("get{{.StructName}}Public", api{{.StructName}}.Get{{.StructName}}Public) // 获取{{.Description}}列表
|
||||
{{- end}}
|
||||
group.GET("get{{.StructName}}Public", api{{.StructName}}.Get{{.StructName}}Public) // {{.Description}}开放接口
|
||||
}
|
||||
{{- end}}
|
||||
{{- else}}
|
||||
// {
|
||||
// group := private.Group("{{.Abbreviation}}").Use(middleware.OperationRecord())
|
||||
// }
|
||||
// {
|
||||
// group := private.Group("{{.Abbreviation}}")
|
||||
// }
|
||||
{
|
||||
group := public.Group("{{.Abbreviation}}")
|
||||
group.GET("get{{.StructName}}Public", api{{.StructName}}.Get{{.StructName}}Public) // {{.Description}}开放接口
|
||||
}
|
||||
{{- end}}
|
||||
}
|
||||
|
@@ -1,12 +1,14 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
{{- if not .OnlyTemplate }}
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/plugin/{{.Package}}/model"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/plugin/{{.Package}}/model/request"
|
||||
{{- if .AutoCreateResource }}
|
||||
"gorm.io/gorm"
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
)
|
||||
|
||||
var {{.StructName}} = new({{.Abbreviation}})
|
||||
@@ -19,7 +21,7 @@ type {{.Abbreviation}} struct {}
|
||||
{{- else}}
|
||||
{{- $db = printf "global.MustGetGlobalDBByDBName(\"%s\")" .BusinessDB }}
|
||||
{{- end}}
|
||||
|
||||
{{- if not .OnlyTemplate }}
|
||||
// Create{{.StructName}} 创建{{.Description}}记录
|
||||
// Author [piexlmax](https://github.com/piexlmax)
|
||||
func (s *{{.Abbreviation}}) Create{{.StructName}}({{.Abbreviation}} *model.{{.StructName}}) (err error) {
|
||||
@@ -153,3 +155,8 @@ func (s *{{.Abbreviation}})Get{{.StructName}}DataSource() (res map[string][]map[
|
||||
return
|
||||
}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
func (s *{{.Abbreviation}})Get{{.StructName}}Public() {
|
||||
|
||||
}
|
@@ -1,5 +1,5 @@
|
||||
import service from '@/utils/request'
|
||||
|
||||
{{- if not .OnlyTemplate}}
|
||||
// @Tags {{.StructName}}
|
||||
// @Summary 创建{{.Description}}
|
||||
// @Security ApiKeyAuth
|
||||
@@ -111,3 +111,17 @@ export const get{{.StructName}}DataSource = () => {
|
||||
})
|
||||
}
|
||||
{{- end}}
|
||||
{{- end}}
|
||||
// @Tags {{.StructName}}
|
||||
// @Summary 不需要鉴权的{{.Description}}接口
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data query request.{{.StructName}}Search true "分页获取{{.Description}}列表"
|
||||
// @Success 200 {object} response.Response{data=object,msg=string} "获取成功"
|
||||
// @Router /{{.Abbreviation}}/get{{.StructName}}Public [get]
|
||||
export const get{{.StructName}}Public = () => {
|
||||
return service({
|
||||
url: '/{{.Abbreviation}}/get{{.StructName}}Public',
|
||||
method: 'get',
|
||||
})
|
||||
}
|
@@ -1,3 +1,4 @@
|
||||
{{- if not .OnlyTemplate}}
|
||||
<template>
|
||||
<div>
|
||||
<div class="gva-form-box">
|
||||
@@ -239,3 +240,12 @@ const back = () => {
|
||||
|
||||
<style>
|
||||
</style>
|
||||
{{- else }}
|
||||
<template>
|
||||
<div>form</div>
|
||||
</template>
|
||||
<script setup>
|
||||
</script>
|
||||
<style>
|
||||
</style>
|
||||
{{- end }}
|
@@ -1,5 +1,6 @@
|
||||
{{- $global := . }}
|
||||
{{- $templateID := printf "%s_%s" .Package .StructName }}
|
||||
{{- if not .OnlyTemplate}}
|
||||
<template>
|
||||
<div>
|
||||
<div class="gva-search-box">
|
||||
@@ -900,3 +901,15 @@ const closeDetailShow = () => {
|
||||
}
|
||||
{{end}}
|
||||
</style>
|
||||
{{- else}}
|
||||
<template>
|
||||
<div>form</div>
|
||||
</template>
|
||||
<script setup>
|
||||
defineOptions({
|
||||
name: '{{.StructName}}'
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
</style>
|
||||
{{- end}}
|
Reference in New Issue
Block a user