Merge branch 'dev'
This commit is contained in:
commit
ea4ffb8867
7 files changed
+53
-7
No files matched your search
@@ -24,6 +24,8 @@ type FileResponse struct {
|
|||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const path = "static/uploadfile/"
|
||||||
|
|
||||||
type File struct {
|
type File struct {
|
||||||
apis.Api
|
apis.Api
|
||||||
}
|
}
|
||||||
@@ -72,7 +74,11 @@ func (e *File) baseImg(c *gin.Context, fileResponse FileResponse, urlPerfix stri
|
|||||||
ddd, _ := base64.StdEncoding.DecodeString(file2list[1])
|
ddd, _ := base64.StdEncoding.DecodeString(file2list[1])
|
||||||
guid := uuid.New().String()
|
guid := uuid.New().String()
|
||||||
fileName := guid + ".jpg"
|
fileName := guid + ".jpg"
|
||||||
base64File := "static/uploadfile/" + fileName
|
err := utils.IsNotExistMkDir(path)
|
||||||
|
if err != nil {
|
||||||
|
e.Error(c, 500, errors.New(""), "初始化文件路径失败")
|
||||||
|
}
|
||||||
|
base64File := path + fileName
|
||||||
_ = ioutil.WriteFile(base64File, ddd, 0666)
|
_ = ioutil.WriteFile(base64File, ddd, 0666)
|
||||||
typeStr := strings.Replace(strings.Replace(file2list[0], "data:", "", -1), ";base64", "", -1)
|
typeStr := strings.Replace(strings.Replace(file2list[0], "data:", "", -1), ";base64", "", -1)
|
||||||
fileResponse = FileResponse{
|
fileResponse = FileResponse{
|
||||||
@@ -83,7 +89,7 @@ func (e *File) baseImg(c *gin.Context, fileResponse FileResponse, urlPerfix stri
|
|||||||
Type: typeStr,
|
Type: typeStr,
|
||||||
}
|
}
|
||||||
source, _ := c.GetPostForm("source")
|
source, _ := c.GetPostForm("source")
|
||||||
err := thirdUpload(source, fileName, base64File)
|
err = thirdUpload(source, fileName, base64File)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
e.Error(c, 200, errors.New(""), "上传第三方失败")
|
e.Error(c, 200, errors.New(""), "上传第三方失败")
|
||||||
return fileResponse
|
return fileResponse
|
||||||
@@ -102,7 +108,12 @@ func (e *File) multipleFile(c *gin.Context, urlPerfix string) []FileResponse {
|
|||||||
for _, f := range files {
|
for _, f := range files {
|
||||||
guid := uuid.New().String()
|
guid := uuid.New().String()
|
||||||
fileName := guid + utils.GetExt(f.Filename)
|
fileName := guid + utils.GetExt(f.Filename)
|
||||||
multipartFileName := "static/uploadfile/" + fileName
|
|
||||||
|
err := utils.IsNotExistMkDir(path)
|
||||||
|
if err != nil {
|
||||||
|
e.Error(c, 500, errors.New(""), "初始化文件路径失败")
|
||||||
|
}
|
||||||
|
multipartFileName := path + fileName
|
||||||
err1 := c.SaveUploadedFile(f, multipartFileName)
|
err1 := c.SaveUploadedFile(f, multipartFileName)
|
||||||
fileType, _ := utils.GetType(multipartFileName)
|
fileType, _ := utils.GetType(multipartFileName)
|
||||||
if err1 == nil {
|
if err1 == nil {
|
||||||
@@ -139,7 +150,12 @@ func (e *File) singleFile(c *gin.Context, fileResponse FileResponse, urlPerfix s
|
|||||||
guid := uuid.New().String()
|
guid := uuid.New().String()
|
||||||
|
|
||||||
fileName := guid + utils.GetExt(files.Filename)
|
fileName := guid + utils.GetExt(files.Filename)
|
||||||
singleFile := "static/uploadfile/" + fileName
|
|
||||||
|
err = utils.IsNotExistMkDir(path)
|
||||||
|
if err != nil {
|
||||||
|
e.Error(c, 500, errors.New(""), "初始化文件路径失败")
|
||||||
|
}
|
||||||
|
singleFile := path + fileName
|
||||||
_ = c.SaveUploadedFile(files, singleFile)
|
_ = c.SaveUploadedFile(files, singleFile)
|
||||||
fileType, _ := utils.GetType(singleFile)
|
fileType, _ := utils.GetType(singleFile)
|
||||||
fileResponse = FileResponse{
|
fileResponse = FileResponse{
|
||||||
|
|||||||
+3
-1
@@ -22,6 +22,7 @@ import (
|
|||||||
"go-admin/app/jobs"
|
"go-admin/app/jobs"
|
||||||
"go-admin/common/database"
|
"go-admin/common/database"
|
||||||
"go-admin/common/global"
|
"go-admin/common/global"
|
||||||
|
ext "go-admin/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -50,7 +51,8 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func setup() {
|
func setup() {
|
||||||
|
// 注入配置扩展项
|
||||||
|
config.ExtendConfig = &ext.ExtConfig
|
||||||
//1. 读取配置
|
//1. 读取配置
|
||||||
config.Setup(file.NewSource, file.WithPath(configYml))
|
config.Setup(file.NewSource, file.WithPath(configYml))
|
||||||
go config.Watch()
|
go config.Watch()
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package global
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
// go-admin Version Info
|
// go-admin Version Info
|
||||||
Version = "1.3.2"
|
Version = "1.3.3"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package config
|
||||||
|
|
||||||
|
var ExtConfig Extand
|
||||||
|
|
||||||
|
// 扩展配置
|
||||||
|
// extend:
|
||||||
|
// demo:
|
||||||
|
// name: demo-name
|
||||||
|
// 使用方法: config.ExtConfig......即可!!
|
||||||
|
type Extand struct {
|
||||||
|
// Demo Demo // 这里配置对应配置文件的结构即可
|
||||||
|
}
|
||||||
|
|
||||||
|
type Demo struct {
|
||||||
|
Name string
|
||||||
|
}
|
||||||
@@ -42,8 +42,14 @@ settings:
|
|||||||
source: user:password@tcp(127.0.0.1:3306)/dbname?charset=utf8&parseTime=True&loc=Local&timeout=1000ms
|
source: user:password@tcp(127.0.0.1:3306)/dbname?charset=utf8&parseTime=True&loc=Local&timeout=1000ms
|
||||||
# source: sqlite3.db
|
# source: sqlite3.db
|
||||||
# source: host=myhost port=myport user=gorm dbname=gorm password=mypassword
|
# source: host=myhost port=myport user=gorm dbname=gorm password=mypassword
|
||||||
|
registers:
|
||||||
|
- sources:
|
||||||
|
- user:password@tcp(127.0.0.1:3306)/dbname?charset=utf8&parseTime=True&loc=Local&timeout=1000ms
|
||||||
gen:
|
gen:
|
||||||
# 代码生成读取的数据库名称
|
# 代码生成读取的数据库名称
|
||||||
dbname: dbname
|
dbname: dbname
|
||||||
# 代码生成是使用前端代码存放位置,需要指定到src文件夹,相对路径
|
# 代码生成是使用前端代码存放位置,需要指定到src文件夹,相对路径
|
||||||
frontpath: ../go-admin-ui/src
|
frontpath: ../go-admin-ui/src
|
||||||
|
extend: # 扩展项使用说明
|
||||||
|
demo:
|
||||||
|
name: data
|
||||||
@@ -31,8 +31,14 @@ settings:
|
|||||||
driver: mysql
|
driver: mysql
|
||||||
# 数据库连接字符串 mysql 缺省信息 charset=utf8&parseTime=True&loc=Local&timeout=1000ms
|
# 数据库连接字符串 mysql 缺省信息 charset=utf8&parseTime=True&loc=Local&timeout=1000ms
|
||||||
source: user:password@tcp(127.0.0.1:3306)/dbname?charset=utf8&parseTime=True&loc=Local&timeout=1000ms
|
source: user:password@tcp(127.0.0.1:3306)/dbname?charset=utf8&parseTime=True&loc=Local&timeout=1000ms
|
||||||
|
registers:
|
||||||
|
- sources:
|
||||||
|
- user:password@tcp(127.0.0.1:3306)/dbname?charset=utf8&parseTime=True&loc=Local&timeout=1000ms
|
||||||
gen:
|
gen:
|
||||||
# 代码生成读取的数据库名称
|
# 代码生成读取的数据库名称
|
||||||
dbname: dbname
|
dbname: dbname
|
||||||
# 代码生成是使用前端代码存放位置,需要指定到src文件夹,相对路径
|
# 代码生成是使用前端代码存放位置,需要指定到src文件夹,相对路径
|
||||||
frontpath: ../go-admin-ui/src
|
frontpath: ../go-admin-ui/src
|
||||||
|
extend: # 扩展项使用说明
|
||||||
|
demo:
|
||||||
|
name: data
|
||||||
@@ -8,7 +8,7 @@ require (
|
|||||||
github.com/aliyun/aliyun-oss-go-sdk v0.0.0-20190307165228-86c17b95fcd5
|
github.com/aliyun/aliyun-oss-go-sdk v0.0.0-20190307165228-86c17b95fcd5
|
||||||
github.com/casbin/casbin/v2 v2.25.1
|
github.com/casbin/casbin/v2 v2.25.1
|
||||||
github.com/gin-gonic/gin v1.6.3
|
github.com/gin-gonic/gin v1.6.3
|
||||||
github.com/go-admin-team/go-admin-core v1.3.2-rc.0
|
github.com/go-admin-team/go-admin-core v1.3.4-0.20210331124757-4c4d0bf6c336
|
||||||
github.com/google/uuid v1.2.0
|
github.com/google/uuid v1.2.0
|
||||||
github.com/mojocn/base64Captcha v1.3.1
|
github.com/mojocn/base64Captcha v1.3.1
|
||||||
github.com/mssola/user_agent v0.5.2
|
github.com/mssola/user_agent v0.5.2
|
||||||
|
|||||||
Reference in new issue
Block a user