|
- package website
-
- import (
- "applet/app/db"
- "applet/app/e"
- "applet/app/md"
- "applet/app/svc"
- "applet/app/utils"
- "applet/app/utils/cache"
- "code.fnuoos.com/EggPlanet/egg_models.git/src/implement"
- svc2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/svc"
- "github.com/gin-gonic/gin"
- )
-
- // WebsiteInfo
- // @Summary 官网-基本信息
- // @Tags 官网
- // @Description 官网-基本信息
- // @Accept json
- // @Produce json
- // @param Authorization header string true "验证参数Bearer和token空格拼接"
- // @Success 200 {object} md.WebsiteInfoResp "具体数据"
- // @Failure 400 {object} md.Response "具体错误"
- // @Router /api/website/info [get]
- func WebsiteInfo(c *gin.Context) {
- res := md.WebsiteInfoResp{
- SeoTitle: svc.GetSysCfgStr("seo_title"),
- SeoLogo: svc.GetOssUrl(svc.GetSysCfgStr("seo_logo")),
- WebLogo: svc.GetOssUrl(svc.GetSysCfgStr("web_logo")),
- AndroidDownUrl: svc.GetSysCfgStr("android_down_url"),
- IosDownUrl: svc.GetSysCfgStr("ios_down_url"),
- }
- e.OutSuc(c, res, nil)
- return
- }
-
- // GetModuleSetting
- // @Summary 页面样式
- // @Tags 官网
- // @Description 页面样式
- // @Accept json
- // @Produce json
- // @param Authorization header string true "验证参数Bearer和token空格拼接"
- // @Param mod_name_value query string true "页面名称类型值(15:官网 联系我们)"
- // @Success 200 {object} md.GetModuleSettingResp "具体数据"
- // @Failure 400 {object} md.Response "具体错误"
- // @Router /api/v1/website/getModuleSetting [GET]
- func GetModuleSetting(c *gin.Context) {
- modName := c.Query("mod_name_value")
- modNameMap := map[string]string{
- "15": "website_about_us",
- }
- 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 := svc2.ImageBucket(db.Db, redisConn)
- moduleStyle.Data = svc2.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)
- }
|