|
@@ -3,7 +3,9 @@ package api
|
|
|
import (
|
|
|
"cr-svc/db/model"
|
|
|
"cr-svc/db/repo"
|
|
|
+ "errors"
|
|
|
"fmt"
|
|
|
+ "path"
|
|
|
"path/filepath"
|
|
|
"time"
|
|
|
|
|
@@ -24,9 +26,12 @@ func UploadPkg(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
-
|
|
|
+ fmt.Println(file.Size)
|
|
|
size := fmt.Sprintf("%.2fM", float64(file.Size)/float64(1024*1024))
|
|
|
fmt.Println(size)
|
|
|
+ if path.Ext(file.Filename) != ".zip" {
|
|
|
+ return nil, errors.New("仅支持zip文件")
|
|
|
+ }
|
|
|
|
|
|
basePath := "./package/"
|
|
|
filename := basePath + filepath.Base(file.Filename)
|