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

59 lines
1.6 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. {Type: "360", Name: "360应用商店"},
  26. {Type: "aliApp", Name: "阿里应用"},
  27. }
  28. for k, v := range data {
  29. data[k].Img = "default_icon/" + v.Type + "_icon.png"
  30. data[k].ImgUrl = svc.GetOssUrl(data[k].Img)
  31. for _, v1 := range tmp {
  32. if v1.Type == v.Type {
  33. data[k].Version = v1.Version
  34. data[k].Url = v1.Url
  35. data[k].Content = v1.Content
  36. data[k].IsMust = v1.IsMust
  37. data[k].DownType = v1.DownType
  38. data[k].OutUrl = v1.OutUrl
  39. }
  40. }
  41. }
  42. res := md.CloudBundleVersionResp{Version: data}
  43. e.OutSuc(c, res, nil)
  44. return
  45. }
  46. func VersionBaseSave(c *gin.Context) {
  47. var req []md.CloudBundleVersion
  48. if err := c.ShouldBindJSON(&req); err != nil {
  49. e.OutErr(c, e.ERR_INVALID_ARGS, err)
  50. return
  51. }
  52. cfgDb := sys_cfg.NewSysCfgDb(db.Db)
  53. cfgDb.SysCfgUpdate("app_version", utils.SerializeStr(req))
  54. e.OutSuc(c, "success", nil)
  55. return
  56. }