package cloud_bundle import ( "applet/app/db" "applet/app/e" "applet/app/md" "applet/app/svc" "applet/app/utils" "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" "encoding/json" "github.com/gin-gonic/gin" ) func Base(c *gin.Context) { appCloudBundleData := svc.GetSysCfgStr("app_cloud_bundle_data") tmp := md.CloudBundleBase{} json.Unmarshal([]byte(appCloudBundleData), &tmp) for k, v := range tmp.AndroidStartImg { tmp.AndroidStartImg[k]["img"] = svc.GetOssUrl(v["img"]) } for k, v := range tmp.IosStartImg { tmp.IosStartImg[k]["img"] = svc.GetOssUrl(v["img"]) } var res = md.CloudBundleBaseResp{ AndroidLogo: svc.GetOssUrl(tmp.AndroidLogo), AndroidStartImg: tmp.IosStartImg, IosLogo: svc.GetOssUrl(tmp.IosLogo), IosStartImg: tmp.IosStartImg, } e.OutSuc(c, res, nil) return } func UpdateState(c *gin.Context) { var req *md.CloudBundleUpdateStateReq if err := c.ShouldBindJSON(&req); err != nil { e.OutErr(c, e.ERR_INVALID_ARGS, err) return } NewCloudBundleDb := implement.NewCloudBundleDb(db.Db) data, _ := NewCloudBundleDb.GetCloudBundle(req.Id) if data == nil { e.OutErr(c, 400, e.NewErr(400, "记录不存在")) return } if req.State != "" { data.State = utils.StrToInt(req.State) } if req.ErrorMsg != "" { data.ErrorMsg = req.ErrorMsg } if req.Src != "" { data.Src = req.Src } if req.BuildNumber != "" { data.BuildNumber = req.BuildNumber } if req.BuildId != "" { data.BuildId = req.BuildId } db.Db.Where("id=?", data.Id).Cols("build_id,build_number,error_msg,state,src").Update(data) e.OutSuc(c, "success", nil) return }