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

svc_version_info.go 1.5 KiB

3 weeks ago
2 weeks ago
3 weeks ago
2 weeks ago
3 weeks ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 = "default_icon/" + v.Type + "_icon.png"
  29. data[k].ImgUrl = svc.GetOssUrl(data[k].Img)
  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. }