animeic-cd 1 yıl önce
ebeveyn
işleme
b6a6e3abf8
2 değiştirilmiş dosya ile 18 ekleme ve 6 silme
  1. 11 5
      main.go
  2. 7 1
      utils/utils.go

+ 11 - 5
main.go

@@ -74,13 +74,16 @@ func main() {
 	fmt.Println(uploadConf[appConf.Key])
 
 	// 复制文件到目标目录中
-	for _, file := range copyFiles {
-		err := utils.Copy(file, fmt.Sprintf("%s/%s", dest, file))
-		if err != nil {
-			fmt.Println(err)
-			return
+	if len(copyFiles) > 0 {
+		for _, file := range copyFiles {
+			err := utils.Copy(file, fmt.Sprintf("%s/%s", dest, file))
+			if err != nil {
+				fmt.Println(err)
+				return
+			}
 		}
 	}
+
 	// 获取版本信息
 	version, err := utils.GetVersion()
 	if err != nil {
@@ -231,6 +234,9 @@ func main() {
 			Url:       obsUrl,
 			Platform:  appVersion.Platform,
 			Thumbnail: appVersion.Thumbnail,
+			Desc:      appVersion.Desc,
+			AppType:   appVersion.AppType,
+			InstCount: appConf.InstCount,
 		}, outputDb)
 		if err != nil {
 			fmt.Println("写入output/db.json错误:", err)

+ 7 - 1
utils/utils.go

@@ -26,6 +26,9 @@ type AppVersion struct {
 	Url       string             `json:"url"`
 	Platform  string             `json:"platform"`
 	Thumbnail string             `json:"thumbnail"`
+	Desc      string             `json:"desc"`
+	AppType   string             `json:"appType"`
+	InstCount int                `json:"instCount"`
 }
 
 type Version struct {
@@ -38,6 +41,9 @@ type Version struct {
 	Url       string `json:"url"`
 	Platform  string `json:"platform"`
 	Thumbnail string `json:"thumbnail"`
+	Desc      string `json:"desc"`
+	AppType   string `json:"appType"`
+	InstCount int    `json:"instCount"`
 }
 
 type App struct {
@@ -50,7 +56,7 @@ type App struct {
 	Tags           string   `json:"tags"`
 	Desc           string   `json:"desc"`
 	Entry          string   `json:"entry"`
-	Type           string   `json:"type"`
+	AppType        string   `json:"appType"`
 	Key            string   `json:"key"`
 	InstCount      int      `json:"instCount"`
 }