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:
co-authored by
sliboy
ba0ch3ng
task
task
爱丽-黑子
sliboy
parent
df3fc0a9ef
commit
c20ea7e030
@@ -106,3 +106,13 @@ func (e *FileUploadAndDownloadService) UploadFile(header *multipart.FileHeader,
|
||||
}
|
||||
return f, nil
|
||||
}
|
||||
|
||||
//@author: [piexlmax](https://github.com/piexlmax)
|
||||
//@function: ImportURL
|
||||
//@description: 导入URL
|
||||
//@param: file model.ExaFileUploadAndDownload
|
||||
//@return: error
|
||||
|
||||
func (e *FileUploadAndDownloadService) ImportURL(file *[]example.ExaFileUploadAndDownload) error {
|
||||
return global.GVA_DB.Create(&file).Error
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ func (s *autoCodeTemplate) Create(ctx context.Context, info request.AutoCode) er
|
||||
}
|
||||
|
||||
// 自动创建api
|
||||
if info.AutoCreateApiToSql {
|
||||
if info.AutoCreateApiToSql && !info.OnlyTemplate {
|
||||
apis := info.Apis()
|
||||
err := global.GVA_DB.WithContext(ctx).Transaction(func(tx *gorm.DB) error {
|
||||
for _, v := range apis {
|
||||
@@ -118,7 +118,7 @@ func (s *autoCodeTemplate) Create(ctx context.Context, info request.AutoCode) er
|
||||
id = entity.ID
|
||||
} else {
|
||||
entity = info.Menu(autoPkg.Template)
|
||||
if info.AutoCreateBtnAuth {
|
||||
if info.AutoCreateBtnAuth && !info.OnlyTemplate {
|
||||
entity.MenuBtn = []model.SysBaseMenuBtn{
|
||||
{SysBaseMenuID: entity.ID, Name: "add", Desc: "新增"},
|
||||
{SysBaseMenuID: entity.ID, Name: "batchDelete", Desc: "批量删除"},
|
||||
@@ -200,8 +200,10 @@ func (s *autoCodeTemplate) Preview(ctx context.Context, info request.AutoCode) (
|
||||
if len(key) > len(global.GVA_CONFIG.AutoCode.Root) {
|
||||
key, _ = filepath.Rel(global.GVA_CONFIG.AutoCode.Root, key)
|
||||
}
|
||||
// 获取key的后缀 取消.
|
||||
suffix := filepath.Ext(key)[1:]
|
||||
var builder strings.Builder
|
||||
builder.WriteString("```\n\n")
|
||||
builder.WriteString("```" + suffix + "\n\n")
|
||||
builder.WriteString(writer.String())
|
||||
builder.WriteString("\n\n```")
|
||||
preview[key] = builder.String()
|
||||
@@ -229,28 +231,37 @@ func (s *autoCodeTemplate) generate(ctx context.Context, info request.AutoCode,
|
||||
code[create] = builder
|
||||
} // 生成文件
|
||||
injections := make(map[string]utilsAst.Ast, len(asts))
|
||||
if info.AutoMigrate {
|
||||
for key, value := range asts {
|
||||
keys := strings.Split(key, "=>")
|
||||
if len(keys) == 2 {
|
||||
if keys[1] == utilsAst.TypePluginInitializeV2 {
|
||||
for key, value := range asts {
|
||||
keys := strings.Split(key, "=>")
|
||||
if len(keys) == 2 {
|
||||
if keys[1] == utilsAst.TypePluginInitializeV2 {
|
||||
continue
|
||||
}
|
||||
if info.OnlyTemplate {
|
||||
if keys[1] == utilsAst.TypePackageInitializeGorm || keys[1] == utilsAst.TypePluginInitializeGorm {
|
||||
continue
|
||||
}
|
||||
var builder strings.Builder
|
||||
parse, _ := value.Parse("", &builder)
|
||||
if parse != nil {
|
||||
_ = value.Injection(parse)
|
||||
err = value.Format("", &builder, parse)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
code[keys[0]] = builder
|
||||
injections[keys[1]] = value
|
||||
fmt.Println(keys[0], "注入成功!")
|
||||
}
|
||||
if !info.AutoMigrate {
|
||||
if keys[1] == utilsAst.TypePackageInitializeGorm || keys[1] == utilsAst.TypePluginInitializeGorm {
|
||||
continue
|
||||
}
|
||||
}
|
||||
var builder strings.Builder
|
||||
parse, _ := value.Parse("", &builder)
|
||||
if parse != nil {
|
||||
_ = value.Injection(parse)
|
||||
err = value.Format("", &builder, parse)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
code[keys[0]] = builder
|
||||
injections[keys[1]] = value
|
||||
fmt.Println(keys[0], "注入成功!")
|
||||
}
|
||||
}
|
||||
} // 注入代码
|
||||
}
|
||||
// 注入代码
|
||||
return code, templates, injections, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package system
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"gorm.io/datatypes"
|
||||
"time"
|
||||
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
@@ -213,7 +214,7 @@ func (userService *UserService) DeleteUser(id int) (err error) {
|
||||
|
||||
func (userService *UserService) SetUserInfo(req system.SysUser) error {
|
||||
return global.GVA_DB.Model(&system.SysUser{}).
|
||||
Select("updated_at", "nick_name", "header_img", "phone", "email", "sideMode", "enable").
|
||||
Select("updated_at", "nick_name", "header_img", "phone", "email", "enable").
|
||||
Where("id=?", req.ID).
|
||||
Updates(map[string]interface{}{
|
||||
"updated_at": time.Now(),
|
||||
@@ -221,7 +222,6 @@ func (userService *UserService) SetUserInfo(req system.SysUser) error {
|
||||
"header_img": req.HeaderImg,
|
||||
"phone": req.Phone,
|
||||
"email": req.Email,
|
||||
"side_mode": req.SideMode,
|
||||
"enable": req.Enable,
|
||||
}).Error
|
||||
}
|
||||
@@ -238,6 +238,16 @@ func (userService *UserService) SetSelfInfo(req system.SysUser) error {
|
||||
Updates(req).Error
|
||||
}
|
||||
|
||||
//@author: [piexlmax](https://github.com/piexlmax)
|
||||
//@function: SetSelfSetting
|
||||
//@description: 设置用户配置
|
||||
//@param: req datatypes.JSON, uid uint
|
||||
//@return: err error
|
||||
|
||||
func (userService *UserService) SetSelfSetting(req *datatypes.JSON, uid uint) error {
|
||||
return global.GVA_DB.Model(&system.SysUser{}).Where("id = ?", uid).Update("origin_setting", req).Error
|
||||
}
|
||||
|
||||
//@author: [piexlmax](https://github.com/piexlmax)
|
||||
//@author: [SliverHorn](https://github.com/SliverHorn)
|
||||
//@function: GetUserInfo
|
||||
|
||||
Reference in New Issue
Block a user