蛋蛋星球 后台端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

57 line
1.4 KiB

  1. package cloud_bundle
  2. import (
  3. "applet/app/db"
  4. "applet/app/e"
  5. "applet/app/md"
  6. "applet/app/svc"
  7. "applet/app/utils"
  8. "applet/app/utils/cache"
  9. "code.fnuoos.com/EggPlanet/egg_models.git/src/implement"
  10. "encoding/json"
  11. "github.com/gin-gonic/gin"
  12. )
  13. func VersionBase(c *gin.Context) {
  14. appCloudBundleData := svc.GetSysCfgStr("app_version")
  15. tmp := make([]md.CloudBundleVersion, 0)
  16. json.Unmarshal([]byte(appCloudBundleData), &tmp)
  17. data := []md.CloudBundleVersion{
  18. {Type: "station", Name: "本站"},
  19. {Type: "yingyongbao", Name: "应用宝"},
  20. {Type: "ios", Name: "IOS"},
  21. {Type: "huawei", Name: "华为"},
  22. {Type: "xiaomi", Name: "小米"},
  23. {Type: "meizu", Name: "魅族"},
  24. {Type: "vivo", Name: "VIVO"},
  25. {Type: "oppo", Name: "OPPO"},
  26. }
  27. for k, v := range data {
  28. data[k].Img = v.Type + "_icon.png"
  29. data[k].ImgUrl = svc.GetOssUrl(v.Type + "_icon.png")
  30. for _, v1 := range tmp {
  31. if v1.Type == v.Type {
  32. data[k].Version = v1.Version
  33. data[k].Url = v1.Url
  34. data[k].Content = v1.Content
  35. data[k].IsMust = v1.IsMust
  36. }
  37. }
  38. }
  39. res := md.CloudBundleVersionResp{Version: data}
  40. e.OutSuc(c, res, nil)
  41. return
  42. }
  43. func VersionBaseSave(c *gin.Context) {
  44. var req []md.CloudBundleVersion
  45. if err := c.ShouldBindJSON(&req); err != nil {
  46. e.OutErr(c, e.ERR_INVALID_ARGS, err)
  47. return
  48. }
  49. conn := cache.GetPool().Get()
  50. cfgDb := implement.NewSysCfgDb(db.Db, conn)
  51. cfgDb.SysCfgUpdate("app_version", utils.SerializeStr(req))
  52. e.OutSuc(c, "success", nil)
  53. return
  54. }