package controller import ( "fmt" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/net/ghttp" "jyseo/internal/service" ) // FwIndexHandler 服务专栏首页 func FwIndexHandler(r *ghttp.Request) { service.HtmlRender.Render(r, "fuwu_index.html", g.Map{ "hotFw": service.JySeoFwKeyWordRoot.GetHotNode(), "ziMuGroup": service.JySeoFwKeyWordRoot.GetZimuGroup(), "indexTopShow": service.JySeoFwKeyWordRoot.GetIndexShowTop(), "tdk": service.JySeoTdk.GetFuWuTdk(r.Context()), }) } // FwKeywordIndexHandler 服务专栏关键词首页 func FwKeywordIndexHandler(r *ghttp.Request) { fuWuCode := r.Get("fuWuCode").String() fwNode := service.JySeoFwKeyWordRoot.GetNodeByCode(fuWuCode) if fwNode == nil { service.HtmlRender.NotFound(r) return } service.HtmlRender.Render(r, "fuwu_keyword_index.html", g.Map{ "hotFw": service.JySeoFwKeyWordRoot.GetHotNode(), "fwNode": fwNode, "commonKeyword": service.JySeoFwKeyWordRoot.GetCommonKeyword(), "tdk": service.JySeoTdk.GetFuWuTdk(r.Context(), fwNode.KeyWord), }) } // FwKeywordAreaListHandler 服务专栏关键词地区列表页 func FwKeywordAreaListHandler(r *ghttp.Request) { areaCode := r.Get("areaCode").String() fuWuCode := r.Get("fuWuCode").String() var areaNode *service.AreaNode areaNode = service.JySeoAreaRoot.GetNodeByFCode(areaCode) if areaNode == nil { areaNode = service.JySeoAreaRoot.GetNodeByRCode(areaCode) if areaNode == nil { service.HtmlRender.NotFound(r) return } } fwNode := service.JySeoFwKeyWordRoot.GetNodeByCode(fuWuCode) if fwNode == nil { service.HtmlRender.NotFound(r) return } query := service.NewBiddingQuery().EquipKeyWord(fwNode.KeyWord).EquipArea(areaNode) rData, err := query.GetOnceData(r.Context(), 50, "FwKeywordAreaListHandler", service.JySeoFwKeyWordRoot.GetData) if err != nil { g.Log().Errorf(r.Context(), err.Error()) service.HtmlRender.RenderError(r, fmt.Errorf("获取列表数据异常")) return } service.HtmlRender.Render(r, "fuwu_list.html", g.Map{ "fwNode": fwNode, "areaNode": areaNode, "list": rData, "hotFw": service.JySeoFwKeyWordRoot.GetHotNode(), "tdk": service.JySeoTdk.GetFuWuTdk(r.Context(), fwNode.KeyWord, areaNode.Name), }) }