package hdl import ( "applet/app/db" "applet/app/e" "applet/app/md" "applet/app/utils" "applet/app/utils/cache" "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" "code.fnuoos.com/EggPlanet/egg_system_rules.git/svc" "github.com/gin-gonic/gin" ) // GetModuleSetting // @Summary 页面样式 // @Tags 页面样式 // @Description 页面样式 // @Accept json // @Produce json // @param Authorization header string true "验证参数Bearer和token空格拼接" // @Param mod_name_value query string true "页面名称类型值(1:首页 2:会员中心 3:底部导航 4:邀请下载落地页 5:邀请海报 7:下载渠道 8:贡献值 9:蛋蛋分 10:商务合作 11:资质证书 12:提现页 13:提现到账户 14实名认证)" // @Success 200 {object} md.GetModuleSettingResp "具体数据" // @Failure 400 {object} md.Response "具体错误" // @Router /api/v1/getModuleSetting [GET] func GetModuleSetting(c *gin.Context) { modName := c.Query("mod_name_value") modNameMap := map[string]string{ "1": "home_page", "2": "member_center", "3": "bottom_bar", "4": "invitation_download_landing_page", "5": "invitation_poster", "6": "about_us", "7": "down_channel", "8": "contribution", "9": "egg_score", "10": "business_cooperation", "11": "qualification_certificate", "12": "withdraw", "13": "withdraw_account", "14": "user_real_name", } val, ok := modNameMap[modName] if !ok { e.OutErr(c, e.ERR_BAD_REQUEST, nil) return } moduleStyleDb := implement.NewModuleStyleDb(db.Db) moduleStyle, err := moduleStyleDb.ModuleStyleGetOneByParams(map[string]interface{}{ "key": "mod_name", "value": val, }) if err != nil { e.OutErr(c, e.ERR_DB_ORM, err.Error()) return } if moduleStyle == nil { e.OutErr(c, e.ERR_NO_DATA, nil) return } var dataMap interface{} redisConn := cache.GetPool().Get() scheme, domain := svc.ImageBucket(db.Db, redisConn) moduleStyle.Data = svc.ImageFormatWithBucketForDataInfo(scheme, domain, moduleStyle.Data) utils.Unserialize([]byte(moduleStyle.Data), &dataMap) resp := md.GetModuleSettingResp{ ModName: moduleStyle.ModName, Position: moduleStyle.Position, SkipIdentifier: moduleStyle.SkipIdentifier, Title: moduleStyle.Title, Subtitle: moduleStyle.Subtitle, Data: dataMap, } e.OutSuc(c, resp, nil) }