蛋蛋星球 后台端
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

svc_base.go 1.8 KiB

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