|
@@ -35,16 +35,22 @@ func RunCmd(cmd *cobra.Command, args []string) {
|
|
timeUnix := time.Now().Unix()
|
|
timeUnix := time.Now().Unix()
|
|
var mainTourUrl string
|
|
var mainTourUrl string
|
|
var mainJsonUrl string
|
|
var mainJsonUrl string
|
|
|
|
+ var ossUrl string
|
|
|
|
+ var bucket string
|
|
code = args[0]
|
|
code = args[0]
|
|
dest := args[1]
|
|
dest := args[1]
|
|
|
|
|
|
if isProduction {
|
|
if isProduction {
|
|
mainJsonUrl = "https://4dkk.4dage.com/720yun_fd_manage/" + code + "/someData.json?rnd=" + strconv.FormatInt(timeUnix, 10)
|
|
mainJsonUrl = "https://4dkk.4dage.com/720yun_fd_manage/" + code + "/someData.json?rnd=" + strconv.FormatInt(timeUnix, 10)
|
|
mainTourUrl = "https://4dkk.4dage.com/720yun_fd_manage/" + code + "/tour.xml?rnd=" + strconv.FormatInt(timeUnix, 10)
|
|
mainTourUrl = "https://4dkk.4dage.com/720yun_fd_manage/" + code + "/tour.xml?rnd=" + strconv.FormatInt(timeUnix, 10)
|
|
|
|
+ ossUrl = "https://4dkk.4dage.com/"
|
|
|
|
+ bucket = "oss://4dkankan"
|
|
|
|
|
|
} else {
|
|
} else {
|
|
mainJsonUrl = "https://ossxiaoan.4dage.com/720yun_fd_manage/" + code + "/someData.json?rnd=" + strconv.FormatInt(timeUnix, 10)
|
|
mainJsonUrl = "https://ossxiaoan.4dage.com/720yun_fd_manage/" + code + "/someData.json?rnd=" + strconv.FormatInt(timeUnix, 10)
|
|
- mainTourUrl = "\nhttps://ossxiaoan.4dage.com/720yun_fd_manage/" + code + "/tour.xml?rnd=" + strconv.FormatInt(timeUnix, 10)
|
|
|
|
|
|
+ mainTourUrl = "https://ossxiaoan.4dage.com/720yun_fd_manage/" + code + "/tour.xml?rnd=" + strconv.FormatInt(timeUnix, 10)
|
|
|
|
+ ossUrl = "https://ossxiaoan.4dage.com/"
|
|
|
|
+ bucket = "oss://oss-xiaoan"
|
|
}
|
|
}
|
|
|
|
|
|
data := &utils.ScenesDataType{}
|
|
data := &utils.ScenesDataType{}
|
|
@@ -54,18 +60,12 @@ func RunCmd(cmd *cobra.Command, args []string) {
|
|
}
|
|
}
|
|
|
|
|
|
err := utils.GetJson(mainJsonUrl, data)
|
|
err := utils.GetJson(mainJsonUrl, data)
|
|
- //err = utils.GetXml(mainTourUrl, data)
|
|
|
|
err = utils.DownloadMainXml(mainTourUrl, dest+"/tour/")
|
|
err = utils.DownloadMainXml(mainTourUrl, dest+"/tour/")
|
|
-
|
|
|
|
- if err != nil {
|
|
|
|
- log.Error("Error: ", "type", err)
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- //dataFile := dest + "/someData.json"
|
|
|
|
- err = utils.CovertJsonAndDownload("https://4dkk.4dage.com/720yun_fd_manage/WK1792459279224066048/someData.json?_=0.08240579686447669", dest)
|
|
|
|
|
|
+ err = utils.CovertJsonAndDownload(mainJsonUrl, dest, ossUrl)
|
|
|
|
|
|
if err != nil {
|
|
if err != nil {
|
|
fmt.Println("Error: ", err)
|
|
fmt.Println("Error: ", err)
|
|
|
|
+ return
|
|
|
|
|
|
}
|
|
}
|
|
excludeArray := []string{"*.exe", "tour_testingserver_macos", "tour.html", "*.js", "vtourskin*.xml", "webvr.xml", "combobox.xml", "vtourskin*.png", "vtourskin.png", "rotate_device.png"}
|
|
excludeArray := []string{"*.exe", "tour_testingserver_macos", "tour.html", "*.js", "vtourskin*.xml", "webvr.xml", "combobox.xml", "vtourskin*.png", "vtourskin.png", "rotate_device.png"}
|
|
@@ -78,13 +78,13 @@ func RunCmd(cmd *cobra.Command, args []string) {
|
|
if v.Type == "pano" {
|
|
if v.Type == "pano" {
|
|
// 主Tiles图
|
|
// 主Tiles图
|
|
if utils.IsCommandAvailable("ossutil") {
|
|
if utils.IsCommandAvailable("ossutil") {
|
|
- runMainTileDownload(v.SceneCode, dest, exclString)
|
|
|
|
|
|
+ runMainTileDownload(v.SceneCode, dest, exclString, bucket)
|
|
}
|
|
}
|
|
|
|
|
|
// 场景封面图
|
|
// 场景封面图
|
|
if len(v.Icon) > 0 {
|
|
if len(v.Icon) > 0 {
|
|
log.Info("Downloading Scenes-cover", "url", fmt.Sprintf("%s", v.Icon))
|
|
log.Info("Downloading Scenes-cover", "url", fmt.Sprintf("%s", v.Icon))
|
|
- url := utils.DetectSource(v.Icon, dest)
|
|
|
|
|
|
+ url := utils.DetectSource(v.Icon, dest, ossUrl)
|
|
err = utils.DownloadFile(url, v.Icon)
|
|
err = utils.DownloadFile(url, v.Icon)
|
|
log.Info("Save Scenes-cover", "url", fmt.Sprintf("%s", url))
|
|
log.Info("Save Scenes-cover", "url", fmt.Sprintf("%s", url))
|
|
|
|
|
|
@@ -97,7 +97,7 @@ func RunCmd(cmd *cobra.Command, args []string) {
|
|
// 热点封面图
|
|
// 热点封面图
|
|
if len(Hotspot.Secne.Icon) > 0 {
|
|
if len(Hotspot.Secne.Icon) > 0 {
|
|
log.Info("Downloading Hotspots-cover", "url", fmt.Sprintf("%s", Hotspot.Secne.Icon))
|
|
log.Info("Downloading Hotspots-cover", "url", fmt.Sprintf("%s", Hotspot.Secne.Icon))
|
|
- url := utils.DetectSource(Hotspot.Secne.Icon, dest)
|
|
|
|
|
|
+ url := utils.DetectSource(Hotspot.Secne.Icon, dest, ossUrl)
|
|
err = utils.DownloadFile(url, Hotspot.Secne.Icon)
|
|
err = utils.DownloadFile(url, Hotspot.Secne.Icon)
|
|
log.Info("Save Hotspots-cover", "url", fmt.Sprintf("%s", url))
|
|
log.Info("Save Hotspots-cover", "url", fmt.Sprintf("%s", url))
|
|
}
|
|
}
|
|
@@ -106,7 +106,7 @@ func RunCmd(cmd *cobra.Command, args []string) {
|
|
if len(Hotspot.ImageTextInfo.ImageList) > 0 {
|
|
if len(Hotspot.ImageTextInfo.ImageList) > 0 {
|
|
for _, img := range Hotspot.ImageTextInfo.ImageList {
|
|
for _, img := range Hotspot.ImageTextInfo.ImageList {
|
|
log.Info("Downloading Hotspots-ImageList", "url", fmt.Sprintf("%s", img.OssPath))
|
|
log.Info("Downloading Hotspots-ImageList", "url", fmt.Sprintf("%s", img.OssPath))
|
|
- url := utils.DetectSource(img.OssPath, dest)
|
|
|
|
|
|
+ url := utils.DetectSource(img.OssPath, dest, ossUrl)
|
|
err = utils.DownloadFile(url, img.OssPath)
|
|
err = utils.DownloadFile(url, img.OssPath)
|
|
log.Info("Save Hotspots-ImageList", "url", fmt.Sprintf("%s", url))
|
|
log.Info("Save Hotspots-ImageList", "url", fmt.Sprintf("%s", url))
|
|
}
|
|
}
|
|
@@ -114,7 +114,7 @@ func RunCmd(cmd *cobra.Command, args []string) {
|
|
// customIconInfo
|
|
// customIconInfo
|
|
if len(Hotspot.CustomIconInfo.Img) > 0 {
|
|
if len(Hotspot.CustomIconInfo.Img) > 0 {
|
|
log.Info("Downloading Hotspots-CustomIconInfo", "url", fmt.Sprintf("%s", Hotspot.CustomIconInfo.Img))
|
|
log.Info("Downloading Hotspots-CustomIconInfo", "url", fmt.Sprintf("%s", Hotspot.CustomIconInfo.Img))
|
|
- url := utils.DetectSource(Hotspot.CustomIconInfo.Img, dest)
|
|
|
|
|
|
+ url := utils.DetectSource(Hotspot.CustomIconInfo.Img, dest, ossUrl)
|
|
err = utils.DownloadFile(url, Hotspot.CustomIconInfo.Img)
|
|
err = utils.DownloadFile(url, Hotspot.CustomIconInfo.Img)
|
|
log.Info("Save Hotspots-CustomIconInfo", "url", fmt.Sprintf("%s", url))
|
|
log.Info("Save Hotspots-CustomIconInfo", "url", fmt.Sprintf("%s", url))
|
|
|
|
|
|
@@ -124,14 +124,14 @@ func RunCmd(cmd *cobra.Command, args []string) {
|
|
|
|
|
|
if len(v.CustomMask.Sky.Icon) > 0 {
|
|
if len(v.CustomMask.Sky.Icon) > 0 {
|
|
log.Info("Downloading CustomMask Sky", "url", fmt.Sprintf("%s", v.CustomMask.Sky.Icon))
|
|
log.Info("Downloading CustomMask Sky", "url", fmt.Sprintf("%s", v.CustomMask.Sky.Icon))
|
|
- url := utils.DetectSource(v.CustomMask.Sky.Icon, dest)
|
|
|
|
|
|
+ url := utils.DetectSource(v.CustomMask.Sky.Icon, dest, ossUrl)
|
|
err = utils.DownloadFile(url, v.CustomMask.Sky.Icon)
|
|
err = utils.DownloadFile(url, v.CustomMask.Sky.Icon)
|
|
log.Info("Save CustomMask Sky", "url", fmt.Sprintf("%s", url))
|
|
log.Info("Save CustomMask Sky", "url", fmt.Sprintf("%s", url))
|
|
}
|
|
}
|
|
|
|
|
|
if len(v.CustomMask.Earth.Icon) > 0 {
|
|
if len(v.CustomMask.Earth.Icon) > 0 {
|
|
log.Info("Downloading CustomMask Earth", "url", fmt.Sprintf("%s", v.CustomMask.Earth.Icon))
|
|
log.Info("Downloading CustomMask Earth", "url", fmt.Sprintf("%s", v.CustomMask.Earth.Icon))
|
|
- url := utils.DetectSource(v.CustomMask.Earth.Icon, dest)
|
|
|
|
|
|
+ url := utils.DetectSource(v.CustomMask.Earth.Icon, dest, ossUrl)
|
|
err = utils.DownloadFile(url, v.CustomMask.Earth.Icon)
|
|
err = utils.DownloadFile(url, v.CustomMask.Earth.Icon)
|
|
log.Info("Save CustomMask Earth", "url", fmt.Sprintf("%s", url))
|
|
log.Info("Save CustomMask Earth", "url", fmt.Sprintf("%s", url))
|
|
}
|
|
}
|
|
@@ -141,10 +141,10 @@ func RunCmd(cmd *cobra.Command, args []string) {
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
-func runMainTileDownload(sceneCode string, dest string, exclString string) {
|
|
|
|
|
|
+func runMainTileDownload(sceneCode string, dest string, exclString string, bucket string) {
|
|
|
|
|
|
log.Info("Downloading Scenes", "code", fmt.Sprintf("%s", sceneCode))
|
|
log.Info("Downloading Scenes", "code", fmt.Sprintf("%s", sceneCode))
|
|
- command := "ossutil cp -r -f oss://4dkankan/720yun_fd_manage/" + sceneCode + " " + dest + " " + exclString
|
|
|
|
|
|
+ command := "ossutil cp -r -f " + bucket + "/720yun_fd_manage/" + sceneCode + " " + dest + " " + exclString
|
|
|
|
|
|
var cmd *exec.Cmd
|
|
var cmd *exec.Cmd
|
|
|
|
|