|
- package cloud_bundle
-
- import (
- "applet/app/db"
- "applet/app/e"
- "applet/app/md"
- "applet/app/svc"
- "applet/app/utils"
- "applet/app/utils/cache"
- "code.fnuoos.com/EggPlanet/egg_models.git/src/implement"
- "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"},
- }
- for k, v := range data {
- data[k].Img = v.Type + "_icon.png"
- data[k].ImgUrl = svc.GetOssUrl(v.Type + "_icon.png")
- 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
- }
- conn := cache.GetPool().Get()
- cfgDb := implement.NewSysCfgDb(db.Db, conn)
- cfgDb.SysCfgUpdate("app_version", utils.SerializeStr(req))
- e.OutSuc(c, "success", nil)
- return
- }
|