Compare commits
10 Commits
ff41fe0577
...
5d04b8deea
Author | SHA1 | Date |
---|---|---|
|
5d04b8deea | |
|
1207291249 | |
|
06bf641e7a | |
|
ce764082b8 | |
|
aebc301b05 | |
|
3b93a073c3 | |
|
a4a7b44da9 | |
|
e65be6ee36 | |
|
2d0b9ecac0 | |
|
5a5b86aeec |
|
@ -66,7 +66,7 @@ func (a *AutoCodeHistoryApi) Delete(c *gin.Context) {
|
|||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body systemReq.RollBack true "请求参数"
|
||||
// @Param data body request.SysAutoHistoryRollBack true "请求参数"
|
||||
// @Success 200 {object} response.Response{msg=string} "回滚自动生成代码"
|
||||
// @Router /autoCode/rollback [post]
|
||||
func (a *AutoCodeHistoryApi) RollBack(c *gin.Context) {
|
||||
|
@ -90,7 +90,7 @@ func (a *AutoCodeHistoryApi) RollBack(c *gin.Context) {
|
|||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body systemReq.SysAutoHistory true "请求参数"
|
||||
// @Param data body common.PageInfo true "请求参数"
|
||||
// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "查询回滚记录,返回包括列表,总数,页码,每页数量"
|
||||
// @Router /autoCode/getSysHistory [post]
|
||||
func (a *AutoCodeHistoryApi) GetList(c *gin.Context) {
|
||||
|
|
|
@ -19,7 +19,7 @@ type AutoCodePackageApi struct{}
|
|||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body system.SysAutoCode true "创建package"
|
||||
// @Param data body request.SysAutoCodePackageCreate true "创建package"
|
||||
// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "创建package成功"
|
||||
// @Router /autoCode/createPackage [post]
|
||||
func (a *AutoCodePackageApi) Create(c *gin.Context) {
|
||||
|
@ -48,7 +48,7 @@ func (a *AutoCodePackageApi) Create(c *gin.Context) {
|
|||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body system.SysAutoCode true "创建package"
|
||||
// @Param data body common.GetById true "创建package"
|
||||
// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "删除package成功"
|
||||
// @Router /autoCode/delPackage [post]
|
||||
func (a *AutoCodePackageApi) Delete(c *gin.Context) {
|
||||
|
|
|
@ -55,7 +55,7 @@ func (a *AutoCodePluginApi) Install(c *gin.Context) {
|
|||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body system.SysAutoCode true "打包插件"
|
||||
// @Param plugName query string true "插件名称"
|
||||
// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "打包插件成功"
|
||||
// @Router /autoCode/pubPlug [get]
|
||||
func (a *AutoCodePluginApi) Packaged(c *gin.Context) {
|
||||
|
|
|
@ -17,7 +17,7 @@ type AutoCodeTemplateApi struct{}
|
|||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body system.AutoCodeStruct true "预览创建代码"
|
||||
// @Param data body request.AutoCode true "预览创建代码"
|
||||
// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "预览创建后的代码"
|
||||
// @Router /autoCode/preview [post]
|
||||
func (a *AutoCodeTemplateApi) Preview(c *gin.Context) {
|
||||
|
@ -53,7 +53,7 @@ func (a *AutoCodeTemplateApi) Preview(c *gin.Context) {
|
|||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body system.AutoCodeStruct true "创建自动代码"
|
||||
// @Param data body request.AutoCode true "创建自动代码"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
|
||||
// @Router /autoCode/createTemp [post]
|
||||
func (a *AutoCodeTemplateApi) Create(c *gin.Context) {
|
||||
|
|
|
@ -211,6 +211,15 @@ aws-s3:
|
|||
base-url: https://gin.vue.admin
|
||||
path-prefix: github.com/flipped-aurora/gin-vue-admin/server
|
||||
|
||||
# cloudflare r2 configuration
|
||||
cloudflare-r2:
|
||||
bucket: xxxx0bucket
|
||||
base-url: https://gin.vue.admin.com
|
||||
path: uploads
|
||||
account-id: xxx_account_id
|
||||
access-key-id: xxx_key_id
|
||||
secret-access-key: xxx_secret_key
|
||||
|
||||
# huawei obs configuration
|
||||
hua-wei-obs:
|
||||
path: you-path
|
||||
|
|
|
@ -24,6 +24,7 @@ type Server struct {
|
|||
HuaWeiObs HuaWeiObs `mapstructure:"hua-wei-obs" json:"hua-wei-obs" yaml:"hua-wei-obs"`
|
||||
TencentCOS TencentCOS `mapstructure:"tencent-cos" json:"tencent-cos" yaml:"tencent-cos"`
|
||||
AwsS3 AwsS3 `mapstructure:"aws-s3" json:"aws-s3" yaml:"aws-s3"`
|
||||
CloudflareR2 CloudflareR2 `mapstructure:"cloudflare-r2" json:"cloudflare-r2" yaml:"cloudflare-r2"`
|
||||
|
||||
Excel Excel `mapstructure:"excel" json:"excel" yaml:"excel"`
|
||||
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
package config
|
||||
|
||||
type CloudflareR2 struct {
|
||||
Bucket string `mapstructure:"bucket" json:"bucket" yaml:"bucket"`
|
||||
BaseURL string `mapstructure:"base-url" json:"base-url" yaml:"base-url"`
|
||||
Path string `mapstructure:"path" json:"path" yaml:"path"`
|
||||
AccountID string `mapstructure:"account-id" json:"account-id" yaml:"account-id"`
|
||||
AccessKeyID string `mapstructure:"access-key-id" json:"access-key-id" yaml:"access-key-id"`
|
||||
SecretAccessKey string `mapstructure:"secret-access-key" json:"secret-access-key" yaml:"secret-access-key"`
|
||||
}
|
1138
server/docs/docs.go
1138
server/docs/docs.go
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -16,34 +16,16 @@ definitions:
|
|||
type: object
|
||||
config.Autocode:
|
||||
properties:
|
||||
ai-path:
|
||||
type: string
|
||||
module:
|
||||
type: string
|
||||
root:
|
||||
type: string
|
||||
server:
|
||||
type: string
|
||||
server-api:
|
||||
type: string
|
||||
server-initialize:
|
||||
type: string
|
||||
server-model:
|
||||
type: string
|
||||
server-plug:
|
||||
type: string
|
||||
server-request:
|
||||
type: string
|
||||
server-router:
|
||||
type: string
|
||||
server-service:
|
||||
type: string
|
||||
transfer-restart:
|
||||
type: boolean
|
||||
web:
|
||||
type: string
|
||||
web-api:
|
||||
type: string
|
||||
web-form:
|
||||
type: string
|
||||
web-table:
|
||||
type: string
|
||||
type: object
|
||||
config.AwsS3:
|
||||
properties:
|
||||
|
@ -106,6 +88,21 @@ definitions:
|
|||
description: 防爆破验证码超时时间,单位:s(秒)
|
||||
type: integer
|
||||
type: object
|
||||
config.CloudflareR2:
|
||||
properties:
|
||||
access-key-id:
|
||||
type: string
|
||||
account-id:
|
||||
type: string
|
||||
base-url:
|
||||
type: string
|
||||
bucket:
|
||||
type: string
|
||||
path:
|
||||
type: string
|
||||
secret-access-key:
|
||||
type: string
|
||||
type: object
|
||||
config.DiskList:
|
||||
properties:
|
||||
mount-point:
|
||||
|
@ -431,6 +428,8 @@ definitions:
|
|||
$ref: '#/definitions/config.AwsS3'
|
||||
captcha:
|
||||
$ref: '#/definitions/config.Captcha'
|
||||
cloudflare-r2:
|
||||
$ref: '#/definitions/config.CloudflareR2'
|
||||
cors:
|
||||
allOf:
|
||||
- $ref: '#/definitions/config.CORS'
|
||||
|
@ -764,6 +763,32 @@ definitions:
|
|||
description: 收件人:多个以英文逗号分隔 例:a@qq.com b@qq.com 正式开发中请把此项目作为参数使用
|
||||
type: string
|
||||
type: object
|
||||
model.Info:
|
||||
properties:
|
||||
ID:
|
||||
description: 主键ID
|
||||
type: integer
|
||||
attachments:
|
||||
description: 附件
|
||||
items:
|
||||
type: object
|
||||
type: array
|
||||
content:
|
||||
description: 内容
|
||||
type: string
|
||||
createdAt:
|
||||
description: 创建时间
|
||||
type: string
|
||||
title:
|
||||
description: 标题
|
||||
type: string
|
||||
updatedAt:
|
||||
description: 更新时间
|
||||
type: string
|
||||
userID:
|
||||
description: 作者
|
||||
type: integer
|
||||
type: object
|
||||
request.AddMenuAuthorityInfo:
|
||||
properties:
|
||||
authorityId:
|
||||
|
@ -774,6 +799,8 @@ definitions:
|
|||
$ref: '#/definitions/system.SysBaseMenu'
|
||||
type: array
|
||||
type: object
|
||||
request.AutoCode:
|
||||
type: object
|
||||
request.CasbinInReceive:
|
||||
properties:
|
||||
authorityId:
|
||||
|
@ -909,21 +936,6 @@ definitions:
|
|||
example: 用户名
|
||||
type: string
|
||||
type: object
|
||||
request.RollBack:
|
||||
properties:
|
||||
deleteApi:
|
||||
description: 是否删除接口
|
||||
type: boolean
|
||||
deleteMenu:
|
||||
description: 是否删除菜单
|
||||
type: boolean
|
||||
deleteTable:
|
||||
description: 是否删除表
|
||||
type: boolean
|
||||
id:
|
||||
description: 主键ID
|
||||
type: integer
|
||||
type: object
|
||||
request.SearchApiParams:
|
||||
properties:
|
||||
ID:
|
||||
|
@ -990,16 +1002,34 @@ definitions:
|
|||
type: integer
|
||||
type: array
|
||||
type: object
|
||||
request.SysAutoHistory:
|
||||
request.SysAutoCodePackageCreate:
|
||||
properties:
|
||||
keyword:
|
||||
description: 关键字
|
||||
desc:
|
||||
example: 描述
|
||||
type: string
|
||||
page:
|
||||
description: 页码
|
||||
type: integer
|
||||
pageSize:
|
||||
description: 每页大小
|
||||
label:
|
||||
example: 展示名
|
||||
type: string
|
||||
packageName:
|
||||
example: 包名
|
||||
type: string
|
||||
template:
|
||||
example: 模版
|
||||
type: string
|
||||
type: object
|
||||
request.SysAutoHistoryRollBack:
|
||||
properties:
|
||||
deleteApi:
|
||||
description: 是否删除接口
|
||||
type: boolean
|
||||
deleteMenu:
|
||||
description: 是否删除菜单
|
||||
type: boolean
|
||||
deleteTable:
|
||||
description: 是否删除表
|
||||
type: boolean
|
||||
id:
|
||||
description: 主键ID
|
||||
type: integer
|
||||
type: object
|
||||
response.Email:
|
||||
|
@ -1140,53 +1170,6 @@ definitions:
|
|||
user:
|
||||
$ref: '#/definitions/system.SysUser'
|
||||
type: object
|
||||
system.AutoCodeStruct:
|
||||
properties:
|
||||
abbreviation:
|
||||
description: Struct简称
|
||||
type: string
|
||||
autoCreateApiToSql:
|
||||
description: 是否自动创建api
|
||||
type: boolean
|
||||
autoCreateMenuToSql:
|
||||
description: 是否自动创建menu
|
||||
type: boolean
|
||||
autoCreateResource:
|
||||
description: 是否自动创建资源标识
|
||||
type: boolean
|
||||
autoMigrate:
|
||||
description: 是否自动迁移表结构
|
||||
type: boolean
|
||||
businessDB:
|
||||
description: 业务数据库
|
||||
type: string
|
||||
description:
|
||||
description: Struct中文名称
|
||||
type: string
|
||||
fields:
|
||||
items:
|
||||
$ref: '#/definitions/system.Field'
|
||||
type: array
|
||||
gvaModel:
|
||||
description: 是否使用gva默认Model
|
||||
type: boolean
|
||||
humpPackageName:
|
||||
description: go文件名称
|
||||
type: string
|
||||
package:
|
||||
type: string
|
||||
packageName:
|
||||
description: 文件名称
|
||||
type: string
|
||||
primaryField:
|
||||
$ref: '#/definitions/system.Field'
|
||||
structName:
|
||||
description: Struct名称
|
||||
type: string
|
||||
tableName:
|
||||
description: 表名
|
||||
type: string
|
||||
type: object
|
||||
system.Condition:
|
||||
properties:
|
||||
ID:
|
||||
|
@ -1207,82 +1190,6 @@ definitions:
|
|||
description: 更新时间
|
||||
type: string
|
||||
type: object
|
||||
system.DataSource:
|
||||
properties:
|
||||
association:
|
||||
description: 关联关系 1 一对一 2 一对多
|
||||
type: integer
|
||||
label:
|
||||
type: string
|
||||
table:
|
||||
type: string
|
||||
value:
|
||||
type: string
|
||||
type: object
|
||||
system.Field:
|
||||
properties:
|
||||
checkDataSource:
|
||||
description: 是否检查数据源
|
||||
type: boolean
|
||||
clearable:
|
||||
description: 是否可清空
|
||||
type: boolean
|
||||
columnName:
|
||||
description: 数据库字段
|
||||
type: string
|
||||
comment:
|
||||
description: 数据库字段描述
|
||||
type: string
|
||||
dataSource:
|
||||
allOf:
|
||||
- $ref: '#/definitions/system.DataSource'
|
||||
description: 数据源
|
||||
dataTypeLong:
|
||||
description: 数据库字段长度
|
||||
type: string
|
||||
defaultValue:
|
||||
description: 是否必填
|
||||
type: string
|
||||
dictType:
|
||||
description: 字典
|
||||
type: string
|
||||
errorText:
|
||||
description: 校验失败文字
|
||||
type: string
|
||||
fieldDesc:
|
||||
description: 中文名
|
||||
type: string
|
||||
fieldIndexType:
|
||||
description: 索引类型
|
||||
type: string
|
||||
fieldJson:
|
||||
description: FieldJson
|
||||
type: string
|
||||
fieldName:
|
||||
description: Field名
|
||||
type: string
|
||||
fieldSearchHide:
|
||||
description: 是否隐藏查询条件
|
||||
type: boolean
|
||||
fieldSearchType:
|
||||
description: 搜索条件
|
||||
type: string
|
||||
fieldType:
|
||||
description: Field数据类型
|
||||
type: string
|
||||
front:
|
||||
description: 是否前端可见
|
||||
type: boolean
|
||||
primaryKey:
|
||||
description: 是否主键
|
||||
type: boolean
|
||||
require:
|
||||
description: 是否必填
|
||||
type: boolean
|
||||
sort:
|
||||
description: 是否增加排序
|
||||
type: boolean
|
||||
type: object
|
||||
system.JoinTemplate:
|
||||
properties:
|
||||
ID:
|
||||
|
@ -1382,24 +1289,6 @@ definitions:
|
|||
description: 更新时间
|
||||
type: string
|
||||
type: object
|
||||
system.SysAutoCode:
|
||||
properties:
|
||||
ID:
|
||||
description: 主键ID
|
||||
type: integer
|
||||
createdAt:
|
||||
description: 创建时间
|
||||
type: string
|
||||
desc:
|
||||
type: string
|
||||
label:
|
||||
type: string
|
||||
packageName:
|
||||
type: string
|
||||
updatedAt:
|
||||
description: 更新时间
|
||||
type: string
|
||||
type: object
|
||||
system.SysBaseMenu:
|
||||
properties:
|
||||
ID:
|
||||
|
@ -1831,6 +1720,27 @@ paths:
|
|||
summary: 删除选中Api
|
||||
tags:
|
||||
- SysApi
|
||||
/api/enterSyncApi:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 确认同步API
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.Response'
|
||||
- properties:
|
||||
msg:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 确认同步API
|
||||
tags:
|
||||
- SysApi
|
||||
/api/freshCasbin:
|
||||
get:
|
||||
consumes:
|
||||
|
@ -1901,6 +1811,27 @@ paths:
|
|||
summary: 根据id获取api
|
||||
tags:
|
||||
- SysApi
|
||||
/api/getApiGroups:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 获取API分组
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.Response'
|
||||
- properties:
|
||||
msg:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 获取API分组
|
||||
tags:
|
||||
- SysApi
|
||||
/api/getApiList:
|
||||
post:
|
||||
consumes:
|
||||
|
@ -1931,6 +1862,48 @@ paths:
|
|||
summary: 分页获取API列表
|
||||
tags:
|
||||
- SysApi
|
||||
/api/ignoreApi:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 同步API
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.Response'
|
||||
- properties:
|
||||
msg:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 忽略API
|
||||
tags:
|
||||
- IgnoreApi
|
||||
/api/syncApi:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 同步API
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.Response'
|
||||
- properties:
|
||||
msg:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 同步API
|
||||
tags:
|
||||
- SysApi
|
||||
/api/updateApi:
|
||||
post:
|
||||
consumes:
|
||||
|
@ -2214,6 +2187,29 @@ paths:
|
|||
summary: 设置权限按钮
|
||||
tags:
|
||||
- AuthorityBtn
|
||||
/autoCode/addFunc:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: 增加方法
|
||||
in: body
|
||||
name: data
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/request.AutoCode'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: '{"success":true,"data":{},"msg":"创建成功"}'
|
||||
schema:
|
||||
type: string
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 增加方法
|
||||
tags:
|
||||
- AddFunc
|
||||
/autoCode/createPackage:
|
||||
post:
|
||||
consumes:
|
||||
|
@ -2224,7 +2220,7 @@ paths:
|
|||
name: data
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/system.SysAutoCode'
|
||||
$ref: '#/definitions/request.SysAutoCodePackageCreate'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
|
@ -2244,38 +2240,7 @@ paths:
|
|||
- ApiKeyAuth: []
|
||||
summary: 创建package
|
||||
tags:
|
||||
- AutoCode
|
||||
/autoCode/createPlug:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: 创建插件模板
|
||||
in: body
|
||||
name: data
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/system.SysAutoCode'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 创建插件模板成功
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.Response'
|
||||
- properties:
|
||||
data:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
msg:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 创建插件模板
|
||||
tags:
|
||||
- AutoCode
|
||||
- AutoCodePackage
|
||||
/autoCode/createTemp:
|
||||
post:
|
||||
consumes:
|
||||
|
@ -2286,7 +2251,7 @@ paths:
|
|||
name: data
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/system.AutoCodeStruct'
|
||||
$ref: '#/definitions/request.AutoCode'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
|
@ -2298,7 +2263,7 @@ paths:
|
|||
- ApiKeyAuth: []
|
||||
summary: 自动代码模板
|
||||
tags:
|
||||
- AutoCode
|
||||
- AutoCodeTemplate
|
||||
/autoCode/delPackage:
|
||||
post:
|
||||
consumes:
|
||||
|
@ -2309,7 +2274,7 @@ paths:
|
|||
name: data
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/system.SysAutoCode'
|
||||
$ref: '#/definitions/request.GetById'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
|
@ -2460,7 +2425,7 @@ paths:
|
|||
- ApiKeyAuth: []
|
||||
summary: 获取package
|
||||
tags:
|
||||
- AutoCode
|
||||
- AutoCodePackage
|
||||
/autoCode/getSysHistory:
|
||||
post:
|
||||
consumes:
|
||||
|
@ -2471,7 +2436,7 @@ paths:
|
|||
name: data
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/request.SysAutoHistory'
|
||||
$ref: '#/definitions/request.PageInfo'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
|
@ -2515,6 +2480,30 @@ paths:
|
|||
summary: 获取当前数据库所有表
|
||||
tags:
|
||||
- AutoCode
|
||||
/autoCode/getTemplates:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 创建package成功
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.Response'
|
||||
- properties:
|
||||
data:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
msg:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 获取package
|
||||
tags:
|
||||
- AutoCodePackage
|
||||
/autoCode/installPlugin:
|
||||
post:
|
||||
consumes:
|
||||
|
@ -2545,7 +2534,7 @@ paths:
|
|||
- ApiKeyAuth: []
|
||||
summary: 安装插件
|
||||
tags:
|
||||
- AutoCode
|
||||
- AutoCodePlugin
|
||||
/autoCode/preview:
|
||||
post:
|
||||
consumes:
|
||||
|
@ -2556,7 +2545,7 @@ paths:
|
|||
name: data
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/system.AutoCodeStruct'
|
||||
$ref: '#/definitions/request.AutoCode'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
|
@ -2576,18 +2565,17 @@ paths:
|
|||
- ApiKeyAuth: []
|
||||
summary: 预览创建后的代码
|
||||
tags:
|
||||
- AutoCode
|
||||
- AutoCodeTemplate
|
||||
/autoCode/pubPlug:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: 打包插件
|
||||
in: body
|
||||
name: data
|
||||
- description: 插件名称
|
||||
in: query
|
||||
name: plugName
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/system.SysAutoCode'
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
|
@ -2607,7 +2595,7 @@ paths:
|
|||
- ApiKeyAuth: []
|
||||
summary: 打包插件
|
||||
tags:
|
||||
- AutoCode
|
||||
- AutoCodePlugin
|
||||
/autoCode/rollback:
|
||||
post:
|
||||
consumes:
|
||||
|
@ -2618,7 +2606,7 @@ paths:
|
|||
name: data
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/request.RollBack'
|
||||
$ref: '#/definitions/request.SysAutoHistoryRollBack'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
|
@ -3115,6 +3103,262 @@ paths:
|
|||
summary: 上传文件示例
|
||||
tags:
|
||||
- ExaFileUploadAndDownload
|
||||
/info/createInfo:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: 创建公告
|
||||
in: body
|
||||
name: data
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/model.Info'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 创建成功
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.Response'
|
||||
- properties:
|
||||
msg:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 创建公告
|
||||
tags:
|
||||
- Info
|
||||
/info/deleteInfo:
|
||||
delete:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: 删除公告
|
||||
in: body
|
||||
name: data
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/model.Info'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 删除成功
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.Response'
|
||||
- properties:
|
||||
msg:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 删除公告
|
||||
tags:
|
||||
- Info
|
||||
/info/deleteInfoByIds:
|
||||
delete:
|
||||
consumes:
|
||||
- application/json
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 批量删除成功
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.Response'
|
||||
- properties:
|
||||
msg:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 批量删除公告
|
||||
tags:
|
||||
- Info
|
||||
/info/findInfo:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: 主键ID
|
||||
in: query
|
||||
name: ID
|
||||
type: integer
|
||||
- description: 内容
|
||||
in: query
|
||||
name: content
|
||||
type: string
|
||||
- description: 创建时间
|
||||
in: query
|
||||
name: createdAt
|
||||
type: string
|
||||
- description: 标题
|
||||
in: query
|
||||
name: title
|
||||
type: string
|
||||
- description: 更新时间
|
||||
in: query
|
||||
name: updatedAt
|
||||
type: string
|
||||
- description: 作者
|
||||
in: query
|
||||
name: userID
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 查询成功
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.Response'
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/model.Info'
|
||||
msg:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 用id查询公告
|
||||
tags:
|
||||
- Info
|
||||
/info/getInfoDataSource:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 查询成功
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.Response'
|
||||
- properties:
|
||||
data:
|
||||
type: object
|
||||
msg:
|
||||
type: string
|
||||
type: object
|
||||
summary: 获取Info的数据源
|
||||
tags:
|
||||
- Info
|
||||
/info/getInfoList:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- in: query
|
||||
name: endCreatedAt
|
||||
type: string
|
||||
- description: 关键字
|
||||
in: query
|
||||
name: keyword
|
||||
type: string
|
||||
- description: 页码
|
||||
in: query
|
||||
name: page
|
||||
type: integer
|
||||
- description: 每页大小
|
||||
in: query
|
||||
name: pageSize
|
||||
type: integer
|
||||
- in: query
|
||||
name: startCreatedAt
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 获取成功
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.Response'
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/response.PageResult'
|
||||
msg:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 分页获取公告列表
|
||||
tags:
|
||||
- Info
|
||||
/info/getInfoPublic:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- in: query
|
||||
name: endCreatedAt
|
||||
type: string
|
||||
- description: 关键字
|
||||
in: query
|
||||
name: keyword
|
||||
type: string
|
||||
- description: 页码
|
||||
in: query
|
||||
name: page
|
||||
type: integer
|
||||
- description: 每页大小
|
||||
in: query
|
||||
name: pageSize
|
||||
type: integer
|
||||
- in: query
|
||||
name: startCreatedAt
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 获取成功
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.Response'
|
||||
- properties:
|
||||
data:
|
||||
type: object
|
||||
msg:
|
||||
type: string
|
||||
type: object
|
||||
summary: 不需要鉴权的公告接口
|
||||
tags:
|
||||
- Info
|
||||
/info/updateInfo:
|
||||
put:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: 更新公告
|
||||
in: body
|
||||
name: data
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/model.Info'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 更新成功
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.Response'
|
||||
- properties:
|
||||
msg:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 更新公告
|
||||
tags:
|
||||
- Info
|
||||
/init/checkdb:
|
||||
post:
|
||||
produces:
|
||||
|
|
|
@ -12,18 +12,18 @@ import (
|
|||
type AutoCode struct {
|
||||
Package string `json:"package"`
|
||||
PackageT string `json:"-"`
|
||||
TableName string `json:"tableName" example:"表名"`
|
||||
BusinessDB string `json:"businessDB" example:"业务数据库"`
|
||||
StructName string `json:"structName" example:"Struct名称"`
|
||||
PackageName string `json:"packageName" example:"文件名称"`
|
||||
Description string `json:"description" example:"Struct中文名称"`
|
||||
Abbreviation string `json:"abbreviation" example:"Struct简称"`
|
||||
HumpPackageName string `json:"humpPackageName" example:"go文件名称"`
|
||||
GvaModel bool `json:"gvaModel" example:"是否使用gva默认Model"`
|
||||
AutoMigrate bool `json:"autoMigrate" example:"是否自动迁移表结构"`
|
||||
AutoCreateResource bool `json:"autoCreateResource" example:"是否自动创建资源标识"`
|
||||
AutoCreateApiToSql bool `json:"autoCreateApiToSql" example:"是否自动创建api"`
|
||||
AutoCreateMenuToSql bool `json:"autoCreateMenuToSql" example:"是否自动创建menu"`
|
||||
TableName string `json:"tableName" example:"表名"` // 表名
|
||||
BusinessDB string `json:"businessDB" example:"业务数据库"` // 业务数据库
|
||||
StructName string `json:"structName" example:"Struct名称"` // Struct名称
|
||||
PackageName string `json:"packageName" example:"文件名称"` // 文件名称
|
||||
Description string `json:"description" example:"Struct中文名称"` // Struct中文名称
|
||||
Abbreviation string `json:"abbreviation" example:"Struct简称"` // Struct简称
|
||||
HumpPackageName string `json:"humpPackageName" example:"go文件名称"` // go文件名称
|
||||
GvaModel bool `json:"gvaModel" example:"false"` // 是否使用gva默认Model
|
||||
AutoMigrate bool `json:"autoMigrate" example:"false"` // 是否自动迁移表结构
|
||||
AutoCreateResource bool `json:"autoCreateResource" example:"false"` // 是否自动创建资源标识
|
||||
AutoCreateApiToSql bool `json:"autoCreateApiToSql" example:"false"` // 是否自动创建api
|
||||
AutoCreateMenuToSql bool `json:"autoCreateMenuToSql" example:"false"` // 是否自动创建menu
|
||||
Fields []*AutoCodeField `json:"fields"`
|
||||
DictTypes []string `json:"-"`
|
||||
FrontFields []*AutoCodeField `json:"-"`
|
||||
|
|
|
@ -19,7 +19,7 @@ type info struct{}
|
|||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body announcement.Info true "创建公告"
|
||||
// @Param data body model.Info true "创建公告"
|
||||
// @Success 200 {object} response.Response{msg=string} "创建成功"
|
||||
// @Router /info/createInfo [post]
|
||||
func (a *info) CreateInfo(c *gin.Context) {
|
||||
|
@ -44,7 +44,7 @@ func (a *info) CreateInfo(c *gin.Context) {
|
|||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body announcement.Info true "删除公告"
|
||||
// @Param data body model.Info true "删除公告"
|
||||
// @Success 200 {object} response.Response{msg=string} "删除成功"
|
||||
// @Router /info/deleteInfo [delete]
|
||||
func (a *info) DeleteInfo(c *gin.Context) {
|
||||
|
@ -82,7 +82,7 @@ func (a *info) DeleteInfoByIds(c *gin.Context) {
|
|||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body announcement.Info true "更新公告"
|
||||
// @Param data body model.Info true "更新公告"
|
||||
// @Success 200 {object} response.Response{msg=string} "更新成功"
|
||||
// @Router /info/updateInfo [put]
|
||||
func (a *info) UpdateInfo(c *gin.Context) {
|
||||
|
@ -107,8 +107,8 @@ func (a *info) UpdateInfo(c *gin.Context) {
|
|||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data query announcement.Info true "用id查询公告"
|
||||
// @Success 200 {object} response.Response{data=object{reinfo=announcement.Info},msg=string} "查询成功"
|
||||
// @Param data query model.Info true "用id查询公告"
|
||||
// @Success 200 {object} response.Response{data=model.Info,msg=string} "查询成功"
|
||||
// @Router /info/findInfo [get]
|
||||
func (a *info) FindInfo(c *gin.Context) {
|
||||
ID := c.Query("ID")
|
||||
|
|
|
@ -122,7 +122,7 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Update{{.StructName}}(c *gin.Con
|
|||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data query {{.Package}}.{{.StructName}} true "用id查询{{.Description}}"
|
||||
// @Success 200 {object} response.Response{data=object{re{{.Abbreviation}}={{.Package}}.{{.StructName}}},msg=string} "查询成功"
|
||||
// @Success 200 {object} response.Response{data={{.Package}}.{{.StructName}},msg=string} "查询成功"
|
||||
// @Router /{{.Abbreviation}}/find{{.StructName}} [get]
|
||||
func ({{.Abbreviation}}Api *{{.StructName}}Api) Find{{.StructName}}(c *gin.Context) {
|
||||
{{.PrimaryField.FieldJson}} := c.Query("{{.PrimaryField.FieldJson}}")
|
||||
|
|
|
@ -22,7 +22,7 @@ type {{.Abbreviation}} struct {}
|
|||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body {{.Package}}.{{.StructName}} true "创建{{.Description}}"
|
||||
// @Param data body model.{{.StructName}} true "创建{{.Description}}"
|
||||
// @Success 200 {object} response.Response{msg=string} "创建成功"
|
||||
// @Router /{{.Abbreviation}}/create{{.StructName}} [post]
|
||||
func (a *{{.Abbreviation}}) Create{{.StructName}}(c *gin.Context) {
|
||||
|
@ -50,7 +50,7 @@ func (a *{{.Abbreviation}}) Create{{.StructName}}(c *gin.Context) {
|
|||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body {{.Package}}.{{.StructName}} true "删除{{.Description}}"
|
||||
// @Param data body model.{{.StructName}} true "删除{{.Description}}"
|
||||
// @Success 200 {object} response.Response{msg=string} "删除成功"
|
||||
// @Router /{{.Abbreviation}}/delete{{.StructName}} [delete]
|
||||
func (a *{{.Abbreviation}}) Delete{{.StructName}}(c *gin.Context) {
|
||||
|
@ -95,7 +95,7 @@ func (a *{{.Abbreviation}}) Delete{{.StructName}}ByIds(c *gin.Context) {
|
|||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body {{.Package}}.{{.StructName}} true "更新{{.Description}}"
|
||||
// @Param data body model.{{.StructName}} true "更新{{.Description}}"
|
||||
// @Success 200 {object} response.Response{msg=string} "更新成功"
|
||||
// @Router /{{.Abbreviation}}/update{{.StructName}} [put]
|
||||
func (a *{{.Abbreviation}}) Update{{.StructName}}(c *gin.Context) {
|
||||
|
@ -123,8 +123,8 @@ func (a *{{.Abbreviation}}) Update{{.StructName}}(c *gin.Context) {
|
|||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data query {{.Package}}.{{.StructName}} true "用id查询{{.Description}}"
|
||||
// @Success 200 {object} response.Response{data=object{re{{.Abbreviation}}={{.Package}}.{{.StructName}}},msg=string} "查询成功"
|
||||
// @Param data query model.{{.StructName}} true "用id查询{{.Description}}"
|
||||
// @Success 200 {object} response.Response{data=model.{{.StructName}},msg=string} "查询成功"
|
||||
// @Router /{{.Abbreviation}}/find{{.StructName}} [get]
|
||||
func (a *{{.Abbreviation}}) Find{{.StructName}}(c *gin.Context) {
|
||||
{{.PrimaryField.FieldJson}} := c.Query("{{.PrimaryField.FieldJson}}")
|
||||
|
|
|
@ -564,7 +564,7 @@ func (s *autoCodePackage) templates(ctx context.Context, entity model.SysAutoCod
|
|||
code[four] = create
|
||||
continue
|
||||
}
|
||||
create := filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.WebRoot(), "plugin", entity.PackageName, secondDirs[j].Name(), info.Abbreviation+filepath.Ext(strings.TrimSuffix(threeDirs[k].Name(), ext)))
|
||||
create := filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.WebRoot(), "plugin", entity.PackageName, secondDirs[j].Name(), info.PackageName+filepath.Ext(strings.TrimSuffix(threeDirs[k].Name(), ext)))
|
||||
code[four] = create
|
||||
}
|
||||
default:
|
||||
|
|
|
@ -0,0 +1,85 @@
|
|||
package upload
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"mime/multipart"
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/credentials"
|
||||
"github.com/aws/aws-sdk-go/aws/session"
|
||||
"github.com/aws/aws-sdk-go/service/s3"
|
||||
"github.com/aws/aws-sdk-go/service/s3/s3manager"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type CloudflareR2 struct{}
|
||||
|
||||
func (c *CloudflareR2) UploadFile(file *multipart.FileHeader) (fileUrl string, fileName string, err error) {
|
||||
session := c.newSession()
|
||||
client := s3manager.NewUploader(session)
|
||||
|
||||
fileKey := fmt.Sprintf("%d_%s", time.Now().Unix(), file.Filename)
|
||||
fileName = fmt.Sprintf("%s/%s", global.GVA_CONFIG.CloudflareR2.Path, fileKey)
|
||||
f, openError := file.Open()
|
||||
if openError != nil {
|
||||
global.GVA_LOG.Error("function file.Open() failed", zap.Any("err", openError.Error()))
|
||||
return "", "", errors.New("function file.Open() failed, err:" + openError.Error())
|
||||
}
|
||||
defer f.Close() // 创建文件 defer 关闭
|
||||
|
||||
input := &s3manager.UploadInput{
|
||||
Bucket: aws.String(global.GVA_CONFIG.CloudflareR2.Bucket),
|
||||
Key: aws.String(fileName),
|
||||
Body: f,
|
||||
}
|
||||
|
||||
_, err = client.Upload(input)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("function uploader.Upload() failed", zap.Any("err", err.Error()))
|
||||
return "", "", err
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%s/%s", global.GVA_CONFIG.CloudflareR2.BaseURL,
|
||||
fileName),
|
||||
fileKey,
|
||||
nil
|
||||
}
|
||||
|
||||
func (c *CloudflareR2) DeleteFile(key string) error {
|
||||
session := newSession()
|
||||
svc := s3.New(session)
|
||||
filename := global.GVA_CONFIG.CloudflareR2.Path + "/" + key
|
||||
bucket := global.GVA_CONFIG.CloudflareR2.Bucket
|
||||
|
||||
_, err := svc.DeleteObject(&s3.DeleteObjectInput{
|
||||
Bucket: aws.String(bucket),
|
||||
Key: aws.String(filename),
|
||||
})
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("function svc.DeleteObject() failed", zap.Any("err", err.Error()))
|
||||
return errors.New("function svc.DeleteObject() failed, err:" + err.Error())
|
||||
}
|
||||
|
||||
_ = svc.WaitUntilObjectNotExists(&s3.HeadObjectInput{
|
||||
Bucket: aws.String(bucket),
|
||||
Key: aws.String(filename),
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
func (*CloudflareR2) newSession() *session.Session {
|
||||
endpoint := fmt.Sprintf("%s.r2.cloudflarestorage.com", global.GVA_CONFIG.CloudflareR2.AccountID)
|
||||
|
||||
return session.Must(session.NewSession(&aws.Config{
|
||||
Region: aws.String("auto"),
|
||||
Endpoint: aws.String(endpoint),
|
||||
Credentials: credentials.NewStaticCredentials(
|
||||
global.GVA_CONFIG.CloudflareR2.AccessKeyID,
|
||||
global.GVA_CONFIG.CloudflareR2.SecretAccessKey,
|
||||
"",
|
||||
),
|
||||
}))
|
||||
}
|
|
@ -7,6 +7,7 @@ import (
|
|||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
|
@ -14,6 +15,8 @@ import (
|
|||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
var mu sync.Mutex
|
||||
|
||||
type Local struct{}
|
||||
|
||||
//@author: [piexlmax](https://github.com/piexlmax)
|
||||
|
@ -76,11 +79,31 @@ func (*Local) UploadFile(file *multipart.FileHeader) (string, string, error) {
|
|||
//@return: error
|
||||
|
||||
func (*Local) DeleteFile(key string) error {
|
||||
p := global.GVA_CONFIG.Local.StorePath + "/" + key
|
||||
if strings.Contains(p, global.GVA_CONFIG.Local.StorePath) {
|
||||
if err := os.Remove(p); err != nil {
|
||||
return errors.New("本地文件删除失败, err:" + err.Error())
|
||||
// 检查 key 是否为空
|
||||
if key == "" {
|
||||
return errors.New("key不能为空")
|
||||
}
|
||||
|
||||
// 验证 key 是否包含非法字符或尝试访问存储路径之外的文件
|
||||
if strings.Contains(key, "..") || strings.ContainsAny(key, `\/:*?"<>|`) {
|
||||
return errors.New("非法的key")
|
||||
}
|
||||
|
||||
p := filepath.Join(global.GVA_CONFIG.Local.StorePath, key)
|
||||
|
||||
// 检查文件是否存在
|
||||
if _, err := os.Stat(p); os.IsNotExist(err) {
|
||||
return errors.New("文件不存在")
|
||||
}
|
||||
|
||||
// 使用文件锁防止并发删除
|
||||
mu.Lock()
|
||||
defer mu.Unlock()
|
||||
|
||||
err := os.Remove(p)
|
||||
if err != nil {
|
||||
return errors.New("文件删除失败: " + err.Error())
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -31,6 +31,8 @@ func NewOss() OSS {
|
|||
return HuaWeiObs
|
||||
case "aws-s3":
|
||||
return &AwsS3{}
|
||||
case "cloudflare-r2":
|
||||
return &CloudflareR2{}
|
||||
default:
|
||||
return &Local{}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
@contextmenu.prevent="openContextMenu($event)"
|
||||
@tab-click="changeTab"
|
||||
@tab-remove="removeTab"
|
||||
@click.middle.prevent="middleCloseTab($event)"
|
||||
>
|
||||
<el-tab-pane
|
||||
v-for="item in historys"
|
||||
|
@ -343,6 +344,21 @@ onUnmounted(() => {
|
|||
emitter.off('collapse')
|
||||
emitter.off('mobile')
|
||||
})
|
||||
|
||||
const middleCloseTab = (e) => {
|
||||
if (historys.value.length === 1 && route.name === defaultRouter.value) {
|
||||
return false
|
||||
}
|
||||
let id = ''
|
||||
if (e.srcElement.nodeName === 'SPAN') {
|
||||
id = e.srcElement.offsetParent.id
|
||||
} else {
|
||||
id = e.srcElement.id
|
||||
}
|
||||
if (id) {
|
||||
removeTab(id.substring(4))
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
@ -248,6 +248,9 @@ const addFuncBtn = (row) => {
|
|||
autoFunc.value.abbreviation = req.abbreviation
|
||||
autoFunc.value.humpPackageName = req.humpPackageName
|
||||
autoFunc.value.businessDB = req.businessDB
|
||||
autoFunc.value.method = ""
|
||||
autoFunc.value.funcName = ""
|
||||
autoFunc.value.router = ""
|
||||
funcFlag.value = true;
|
||||
};
|
||||
|
||||
|
|
|
@ -52,8 +52,8 @@ export default ({
|
|||
}
|
||||
|
||||
const config = {
|
||||
base: '/', // index.html文件所在位置
|
||||
root: './', // js导入的资源路径,src
|
||||
base: '/', // 编译后js导入的资源路径
|
||||
root: './', // index.html文件所在位置
|
||||
publicDir: 'public', // 静态资源文件夹
|
||||
resolve: {
|
||||
alias,
|
||||
|
|
Loading…
Reference in New Issue