package hdl import ( "applet/app/admin/lib/validate" "applet/app/admin/md" "applet/app/db" "applet/app/e" "applet/app/enum" "github.com/gin-gonic/gin" ) func SetCenter(c *gin.Context) { var req md.SetCenterReq err := c.ShouldBindJSON(&req) if err != nil { err = validate.HandleValidateErr(err) err1 := err.(e.E) e.OutErr(c, err1.Code, err1.Error()) return } sysCfgDb := db.SysCfgDb{} sysCfgDb.Set() sysCfgDb.SysCfgUpdate(enum.BigDataScreenAccount, req.BigDataScreenAccount) sysCfgDb.SysCfgUpdate(enum.BigDataScreenPassword, req.BigDataScreenPassword) sysCfgDb.SysCfgUpdate(enum.ProductionWorkshopAccount, req.ProductionWorkshopAccount) sysCfgDb.SysCfgUpdate(enum.ProductionWorkshopPassword, req.ProductionWorkshopPassword) sysCfgDb.SysCfgUpdate("file_bucket", req.FileBucket) sysCfgDb.SysCfgUpdate("file_bucket_region", req.FileBucketRegion) sysCfgDb.SysCfgUpdate("file_secret_key", req.FileSecretKey) sysCfgDb.SysCfgUpdate("file_bucket_host", req.FileBucketHost) sysCfgDb.SysCfgUpdate("file_access_key", req.FileAccessKey) e.OutSuc(c, "success", nil) return } func GetCenter(c *gin.Context) { sysCfgDb := db.SysCfgDb{} sysCfgDb.Set() res := sysCfgDb.SysCfgFindWithDb(enum.BigDataScreenAccount, enum.BigDataScreenPassword, enum.ProductionWorkshopAccount, enum.ProductionWorkshopPassword, "file_bucket", "file_bucket_region", "file_secret_key", "file_bucket_host", "file_access_key") e.OutSuc(c, res, nil) return }