keywordPinyin.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package controller
  2. import (
  3. "fmt"
  4. "github.com/gogf/gf/v2/frame/g"
  5. "github.com/gogf/gf/v2/net/ghttp"
  6. "jyseo/internal/consts"
  7. "jyseo/internal/service"
  8. )
  9. func PinyinIndexHandler(r *ghttp.Request) {
  10. service.HtmlRender.Render(r, "keywordPinyin_index.html",
  11. g.Map{
  12. "nodeList": service.JySeoKeyWordPinyinRoot.GetPinyinNodeByIndustry(),
  13. "showSort": service.JySeoKeyWordPinyinRoot.GetPinyinIndustryShowSort(),
  14. })
  15. }
  16. // PinyinHandler 行业拼音关键词列表页面
  17. func PinyinHandler(r *ghttp.Request) {
  18. pinyinCode := r.Get("pinyinCode").String()
  19. pinyinNode := service.JySeoKeyWordPinyinRoot.GetPinyinNode(pinyinCode)
  20. if pinyinNode == nil {
  21. service.HtmlRender.NotFound(r)
  22. return
  23. }
  24. // 查询数据
  25. query := service.NewBiddingQuery().EquipKeyWord(pinyinNode.Name).EquipIndustry(pinyinNode.Industry, "")
  26. rData, err := query.GetOnceData(r.Context(), consts.KeyWordPinyinMaxTotal, "PinyinHandler", service.JySeoKeyWordPinyinRoot.GetData)
  27. if err != nil {
  28. g.Log().Errorf(r.Context(), err.Error())
  29. service.HtmlRender.RenderError(r, fmt.Errorf("获取列表数据异常"))
  30. return
  31. }
  32. service.HtmlRender.Render(r, "keywordPinyin_list.html",
  33. g.Map{
  34. "list": rData,
  35. "pinyinNode": pinyinNode,
  36. "tdk": service.JySeoTdk.GetKeyWordPinyinListTdk(r.Context(), pinyinNode.Name),
  37. })
  38. }