|
- 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:home_page 2:member_center 3:bottom_bar 4:invitation_download_landing_page 5:invitation_poster)"
- // @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",
- }
- 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
- }
- var dataMap map[string]interface{}
- redisConn := cache.GetPool().Get()
- scheme, domain := svc.ImageBucket(db.Db, redisConn)
- moduleStyle.Data = svc.ImageFormatWithBucketNew(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)
- }
|