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" "time" ) func Base(c *gin.Context) { appCloudBundleData := svc.GetSysCfgStr("app_cloud_bundle_data") tmp := md.CloudBundleBase{} json.Unmarshal([]byte(appCloudBundleData), &tmp) var launchScreen = map[string]string{ "640_960": svc.GetOssUrl(tmp.Build640960), "640_1136": svc.GetOssUrl(tmp.Build6401136), "1242_2208": svc.GetOssUrl(tmp.Build12422208), "750_1334": svc.GetOssUrl(tmp.Build7501334), "1125_2436": svc.GetOssUrl(tmp.Build11252436), "720_1280": svc.GetOssUrl(tmp.Build7201280), "1080_2280": svc.GetOssUrl(tmp.Build10802280), } var res = md.CloudBundleBaseResp{ AndroidLogo: svc.GetOssUrl(tmp.AndroidLogo), IosLogo: svc.GetOssUrl(tmp.IosLogo), LaunchScreen: launchScreen, } 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 } if data.State == 999 { data.FinishAt = int(time.Now().Unix()) } db.Db.Where("id=?", data.Id).Cols("finish_at,build_id,build_number,error_msg,state,src").Update(data) e.OutSuc(c, "success", nil) return }