package cloud_bundle import ( "applet/app/db" "applet/app/e" "applet/app/md" "applet/app/svc" "applet/app/svc/sys_cfg" "applet/app/utils" "encoding/json" "github.com/gin-gonic/gin" ) func VersionBase(c *gin.Context) { appCloudBundleData := svc.GetSysCfgStr("app_version") tmp := make([]md.CloudBundleVersion, 0) json.Unmarshal([]byte(appCloudBundleData), &tmp) data := []md.CloudBundleVersion{ {Type: "station", Name: "官方渠道"}, {Type: "yingyongbao", Name: "应用宝商店"}, {Type: "ios", Name: "IOS商店"}, {Type: "huawei", Name: "华为应用商店"}, {Type: "xiaomi", Name: "小米应用商店"}, {Type: "meizu", Name: "魅族应用商店"}, {Type: "vivo", Name: "VIVO应用商店"}, {Type: "oppo", Name: "OPPO应用商店"}, {Type: "360", Name: "360应用商店"}, } for k, v := range data { data[k].Img = "default_icon/" + v.Type + "_icon.png" data[k].ImgUrl = svc.GetOssUrl(data[k].Img) for _, v1 := range tmp { if v1.Type == v.Type { data[k].Version = v1.Version data[k].Url = v1.Url data[k].Content = v1.Content data[k].IsMust = v1.IsMust } } } res := md.CloudBundleVersionResp{Version: data} e.OutSuc(c, res, nil) return } func VersionBaseSave(c *gin.Context) { var req []md.CloudBundleVersion if err := c.ShouldBindJSON(&req); err != nil { e.OutErr(c, e.ERR_INVALID_ARGS, err) return } cfgDb := sys_cfg.NewSysCfgDb(db.Db) cfgDb.SysCfgUpdate("app_version", utils.SerializeStr(req)) e.OutSuc(c, "success", nil) return }