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

64 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/utils"
  8. "code.fnuoos.com/EggPlanet/egg_models.git/src/implement"
  9. "encoding/json"
  10. "github.com/gin-gonic/gin"
  11. )
  12. func Base(c *gin.Context) {
  13. appCloudBundleData := svc.GetSysCfgStr("app_cloud_bundle_data")
  14. tmp := md.CloudBundleBase{}
  15. json.Unmarshal([]byte(appCloudBundleData), &tmp)
  16. for k, v := range tmp.AndroidStartImg {
  17. tmp.AndroidStartImg[k]["img"] = svc.GetOssUrl(v["img"])
  18. }
  19. for k, v := range tmp.IosStartImg {
  20. tmp.IosStartImg[k]["img"] = svc.GetOssUrl(v["img"])
  21. }
  22. var res = md.CloudBundleBaseResp{
  23. AndroidLogo: svc.GetOssUrl(tmp.AndroidLogo),
  24. AndroidStartImg: tmp.IosStartImg,
  25. IosLogo: svc.GetOssUrl(tmp.IosLogo),
  26. IosStartImg: tmp.IosStartImg,
  27. }
  28. e.OutSuc(c, res, nil)
  29. return
  30. }
  31. func UpdateState(c *gin.Context) {
  32. var req *md.CloudBundleUpdateStateReq
  33. if err := c.ShouldBindJSON(&req); err != nil {
  34. e.OutErr(c, e.ERR_INVALID_ARGS, err)
  35. return
  36. }
  37. NewCloudBundleDb := implement.NewCloudBundleDb(db.Db)
  38. data, _ := NewCloudBundleDb.GetCloudBundle(req.Id)
  39. if data == nil {
  40. e.OutErr(c, 400, e.NewErr(400, "记录不存在"))
  41. return
  42. }
  43. if req.State != "" {
  44. data.State = utils.StrToInt(req.State)
  45. }
  46. if req.ErrorMsg != "" {
  47. data.ErrorMsg = req.ErrorMsg
  48. }
  49. if req.Src != "" {
  50. data.Src = req.Src
  51. }
  52. if req.BuildNumber != "" {
  53. data.BuildNumber = req.BuildNumber
  54. }
  55. if req.BuildId != "" {
  56. data.BuildId = req.BuildId
  57. }
  58. db.Db.Where("id=?", data.Id).Cols("build_id,build_number,error_msg,state,src").Update(data)
  59. e.OutSuc(c, "success", nil)
  60. return
  61. }