|
- 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/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)
- }
-
- // Certificate
- // @Summary 证书查询
- // @Tags 官网
- // @Description 证书查询
- // @Accept json
- // @Produce json
- // @param Authorization header string true "验证参数Bearer和token空格拼接"
- // @Param req body md.CertificateReq true "(分页信息必填)"
- // @Success 200 {object} md.CertificateResp "具体数据"
- // @Failure 400 {object} md.Response "具体错误"
- // @Router /api/website/certificate [POST]
- func Certificate(c *gin.Context) {
- var req md.CertificateReq
- err := c.ShouldBindJSON(&req)
- if err != nil {
- err = svc.HandleValidateErr(err)
- err1 := err.(e.E)
- e.OutErr(c, err1.Code, err1.Error())
- return
- }
- NewUserCertificateDb := implement.NewUserCertificateDb(db.Db)
- data, _ := NewUserCertificateDb.GetUserCertificateByNo(req.No)
- if data == nil {
- e.OutErr(c, 400, e.NewErr(400, "查询不到该证书"))
- return
- }
- resp := md.CertificateResp{
- No: data.No,
- Name: data.Name,
- StartTime: data.StartTime,
- EndTime: data.EndTime,
- Logo: svc.GetOssUrl(md.Certificate.Logo),
- BgImg: svc.GetOssUrl(md.Certificate.BgImg),
- NameIcon: svc.GetOssUrl(md.Certificate.NameIcon),
- Medal: svc.GetOssUrl(md.Certificate.Medal),
- Seal: svc.GetOssUrl(md.Certificate.Seal),
- }
- e.OutSuc(c, resp, nil)
- return
- }
|