Skip to content

Commit

Permalink
3.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
helloxz committed Mar 26, 2023
1 parent 42c1060 commit a5ce356
Show file tree
Hide file tree
Showing 10 changed files with 309 additions and 274 deletions.
4 changes: 2 additions & 2 deletions cli/Version.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ var VersionDate string

// 赋值全局变量
func init() {
Version = "3.2.0"
VersionDate = "20230109"
Version = "3.3.0"
VersionDate = "20230326"
}

// 命令行打印版本
Expand Down
2 changes: 1 addition & 1 deletion compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ OS=$1
ARCH=$2

#Zdir版本号
VERSION=3.2.0
VERSION=3.3.0

#编译linux
compile_linux() {
Expand Down
4 changes: 0 additions & 4 deletions controller/FileList.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,8 @@ import (
"zdir/config"

"github.com/gin-gonic/gin"
"gopkg.in/ini.v1"
)

// 声明一个全局变量用来获取.ini配置
var cfg *ini.File

// 定义一个结构体,用来存放文件或文件夹信息
type info struct {
Name string
Expand Down
3 changes: 3 additions & 0 deletions controller/Functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"math/rand"
"net/url"
"strings"
"time"

"github.com/gin-gonic/gin"
)
Expand All @@ -20,6 +21,8 @@ func md5s(str string) string {

// 生成一个随机字符串
func RandStr(n int) string {
//如果seed固定,那么每次程序重启后重新生成随机数会重复上一次的随机数,所以这里设置一个随机seed
rand.Seed(time.Now().UnixNano())
var bytes []byte = []byte("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890")
result := make([]byte, n)
for i := 0; i < n; i++ {
Expand Down
13 changes: 12 additions & 1 deletion controller/Upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ import (
"github.com/gin-gonic/gin"
)

// 声明一个结构体,用于保存文件上传成功后的信息
type fileinfo struct {
Url string `json:"url"`
}

func Upload(c *gin.Context) {
//获取文件路径
path := c.PostForm("path")
Expand Down Expand Up @@ -71,10 +76,16 @@ func Upload(c *gin.Context) {
dst := full_path + file_name
// 上传文件至指定的完整文件路径
c.SaveUploadedFile(file, dst)

//拼接url
var finfo fileinfo
//获取公共存储的域名
storage_domain := config.Public_domain(c)
finfo.Url = storage_domain + path + file_name
//返回上传成功
c.JSON(200, gin.H{
"code": 200,
"msg": "success",
"data": "",
"data": finfo,
})
}
1 change: 0 additions & 1 deletion templates/assets/addmin.css

This file was deleted.

2 changes: 1 addition & 1 deletion templates/assets/admin.css

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions templates/assets/admin.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion templates/assets/index.css

Large diffs are not rendered by default.

536 changes: 281 additions & 255 deletions templates/assets/index.js

Large diffs are not rendered by default.

0 comments on commit a5ce356

Please sign in to comment.