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

66 lines
1.7 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. var launchScreen = map[string]string{
  17. "640_960": svc.GetOssUrl(tmp.Build640960),
  18. "640_1136": svc.GetOssUrl(tmp.Build6401136),
  19. "1242_2208": svc.GetOssUrl(tmp.Build12422208),
  20. "750_1334": svc.GetOssUrl(tmp.Build7501334),
  21. "1125_2436": svc.GetOssUrl(tmp.Build11252436),
  22. "720_1280": svc.GetOssUrl(tmp.Build7201280),
  23. "1080_2280": svc.GetOssUrl(tmp.Build10802280),
  24. }
  25. var res = md.CloudBundleBaseResp{
  26. AndroidLogo: svc.GetOssUrl(tmp.AndroidLogo),
  27. IosLogo: svc.GetOssUrl(tmp.IosLogo),
  28. LaunchScreen: launchScreen,
  29. }
  30. e.OutSuc(c, res, nil)
  31. return
  32. }
  33. func UpdateState(c *gin.Context) {
  34. var req *md.CloudBundleUpdateStateReq
  35. if err := c.ShouldBindJSON(&req); err != nil {
  36. e.OutErr(c, e.ERR_INVALID_ARGS, err)
  37. return
  38. }
  39. NewCloudBundleDb := implement.NewCloudBundleDb(db.Db)
  40. data, _ := NewCloudBundleDb.GetCloudBundle(req.Id)
  41. if data == nil {
  42. e.OutErr(c, 400, e.NewErr(400, "记录不存在"))
  43. return
  44. }
  45. if req.State != "" {
  46. data.State = utils.StrToInt(req.State)
  47. }
  48. if req.ErrorMsg != "" {
  49. data.ErrorMsg = req.ErrorMsg
  50. }
  51. if req.Src != "" {
  52. data.Src = req.Src
  53. }
  54. if req.BuildNumber != "" {
  55. data.BuildNumber = req.BuildNumber
  56. }
  57. if req.BuildId != "" {
  58. data.BuildId = req.BuildId
  59. }
  60. db.Db.Where("id=?", data.Id).Cols("build_id,build_number,error_msg,state,src").Update(data)
  61. e.OutSuc(c, "success", nil)
  62. return
  63. }