蛋蛋星球 后台端
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.
 
 
 
 

55 lines
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/svc/sys_cfg"
  8. "applet/app/utils"
  9. "encoding/json"
  10. "github.com/gin-gonic/gin"
  11. )
  12. func VersionBase(c *gin.Context) {
  13. appCloudBundleData := svc.GetSysCfgStr("app_version")
  14. tmp := make([]md.CloudBundleVersion, 0)
  15. json.Unmarshal([]byte(appCloudBundleData), &tmp)
  16. data := []md.CloudBundleVersion{
  17. {Type: "station", Name: "官方渠道"},
  18. {Type: "yingyongbao", Name: "应用宝商店"},
  19. {Type: "ios", Name: "IOS商店"},
  20. {Type: "huawei", Name: "华为应用商店"},
  21. {Type: "xiaomi", Name: "小米应用商店"},
  22. {Type: "meizu", Name: "魅族应用商店"},
  23. {Type: "vivo", Name: "VIVO应用商店"},
  24. {Type: "oppo", Name: "OPPO应用商店"},
  25. }
  26. for k, v := range data {
  27. data[k].Img = "default_icon/" + v.Type + "_icon.png"
  28. data[k].ImgUrl = svc.GetOssUrl(data[k].Img)
  29. for _, v1 := range tmp {
  30. if v1.Type == v.Type {
  31. data[k].Version = v1.Version
  32. data[k].Url = v1.Url
  33. data[k].Content = v1.Content
  34. data[k].IsMust = v1.IsMust
  35. }
  36. }
  37. }
  38. res := md.CloudBundleVersionResp{Version: data}
  39. e.OutSuc(c, res, nil)
  40. return
  41. }
  42. func VersionBaseSave(c *gin.Context) {
  43. var req []md.CloudBundleVersion
  44. if err := c.ShouldBindJSON(&req); err != nil {
  45. e.OutErr(c, e.ERR_INVALID_ARGS, err)
  46. return
  47. }
  48. cfgDb := sys_cfg.NewSysCfgDb(db.Db)
  49. cfgDb.SysCfgUpdate("app_version", utils.SerializeStr(req))
  50. e.OutSuc(c, "success", nil)
  51. return
  52. }