Ver Fonte

wip:三级页登录提交

wangkaiyue há 1 ano atrás
pai
commit
4849c60ff3

+ 2 - 2
internal/controller/detail.go

@@ -9,7 +9,6 @@ import (
 )
 
 func BiddingDetail(r *ghttp.Request) {
-	url := "https://" + r.Request.Host + r.Request.URL.String()
 	nameCode := getSubdomain(r.Request.Host)
 	isLogin := utility.JySessionLoginEd(r)
 	seoId := r.Get("seoId").String()
@@ -18,7 +17,7 @@ func BiddingDetail(r *ghttp.Request) {
 		return
 	}
 
-	detail := service.JyBxSeoDetailRoot.GetDetail(r.Context(), seoId, isLogin, url)
+	detail := service.JyBxSeoDetailRoot.GetDetail(r.Context(), seoId, isLogin)
 
 	areaNode := service.JyBxSeoAreaRoot.GetNodeByCode(nameCode)
 	if areaNode == nil {
@@ -27,6 +26,7 @@ func BiddingDetail(r *ghttp.Request) {
 		}
 	}
 	utility.HtmlRender.Render(r, "detail.html", g.Map{
+		"hasLogin": utility.JySessionLoginEd(r),
 		"Request":  r.Request,
 		"areaNode": areaNode,
 		"detail":   detail,

+ 1 - 9
internal/service/detailStruct.go

@@ -28,7 +28,7 @@ type (
 // GetDetail 根据seoId查询标讯详情
 // seoId 标讯seoId标识
 // isLogin 是否登录,未登录内容加密
-func (dRoot *DetailRoot) GetDetail(ctx context.Context, seoId string, isLogin bool, url string) map[string]interface{} {
+func (dRoot *DetailRoot) GetDetail(ctx context.Context, seoId string, isLogin bool) map[string]interface{} {
 	res, err := g.DB().GetOne(ctx, fmt.Sprintf(`SELECT col.bid_id FROM jyseo.%s col   WHERE col.seo_id = '%s'`, consts.TableName, seoId))
 	if err != nil || res.IsEmpty() {
 		return nil
@@ -41,14 +41,6 @@ func (dRoot *DetailRoot) GetDetail(ctx context.Context, seoId string, isLogin bo
 			obj = Filter(obj)
 		}
 		obj["title"] = gconv.String(fmt.Sprintf("【%s】%s", consts.TopTypeMap[gconv.String(obj["toptype"])], obj["title"]))
-		jyWebDomain := g.Cfg("global").MustGet(context.Background(), "jyWebDomain").String()
-		if isLogin {
-			obj["abstract"] = fmt.Sprintf(g.Cfg("global").MustGet(context.Background(), "loginDescribe").String(), gconv.String(obj["title"]), gconv.String(obj["area"]))
-			obj["bottomAbstract"] = fmt.Sprintf(g.Cfg("global").MustGet(context.Background(), "loginBottomDescribe").String(), gconv.String(obj["area"]))
-		} else {
-			obj["abstract"] = fmt.Sprintf(g.Cfg("global").MustGet(context.Background(), "loginDescribe").String(), gconv.String(obj["title"]), gconv.String(obj["area"])) + fmt.Sprintf(g.Cfg("global").MustGet(context.Background(), "noLoginDescribe").String(), jyWebDomain+"/notin/page?backTo="+url)
-			obj["bottomAbstract"] = fmt.Sprintf(g.Cfg("global").MustGet(context.Background(), "loginBottomDescribe").String(), gconv.String(obj["area"])) + fmt.Sprintf(g.Cfg("global").MustGet(context.Background(), "noLoginBottomDescribe").String(), jyWebDomain+"/notin/page?backTo="+url)
-		}
 		obj["time"] = time.Unix(gconv.Int64(obj["publishtime"])+3600*24, 0).Format("2006-01-02")
 		var _detail = gconv.String(obj["detail"])
 		for _, v := range []string{"table", "div"} {

+ 3 - 3
resource/template/mobile/detail.html

@@ -27,7 +27,7 @@
           </div>
         </div>
         <div class="detail-summary">
-          <p class="detail-summary-container">{{$global.detail.abstract | ConvString | ParseHtml}}</p>
+          <p class="detail-summary-container">{{$global.detail.title}}:本条项目信息由剑鱼标讯{{$global.areaNode.Name}}招标网为您提供。{{if not $global.hasLogin}}<a href='javascript:void(0);' data-quick-login='login' link-href='{{GetConfigVal "mobileWebDomain"}}{{GetConfigVal "loginUrl.mobile"}}{{concat "https://" .Request.Host .Request.URL }}' class='highlight-text cms-link'>登录</a>后即可免费查看完整信息。{{end}}</p>
         </div>
         <main class="detail-content">
           <div class="base-info">
@@ -89,9 +89,9 @@
             </div>
           </div>
         </main>
-        <p class="detail-reminder">{{$global.detail.bottomAbstract | ConvString | ParseHtml}}</p>
+        <p class="detail-reminder">剑鱼标讯{{$global.areaNode.Name}}招标网收集整理了大量的招标投标信息、各类采购信息和企业经营信息,免费向广大用户开放。{{if not $global.hasLogin}}<a href='javascript:void(0);' data-quick-login='login' link-href='{{GetConfigVal "mobileWebDomain"}}{{GetConfigVal "loginUrl.mobile"}}{{concat "https://" .Request.Host .Request.URL }}' class='highlight-text cms-link'>登录</a>后即可免费查询。{{end}}</p>
       </div>
-      
+
       {{include "mobile/components/tag-breadcrumb.html" .}}
       {{include "mobile/components/tag-footer.html" .}}
       {{include "mobile/components/tag-ad-bottom.html" .}}

+ 2 - 2
resource/template/pc/detail.html

@@ -40,7 +40,7 @@
             <span>所属地区:{{if ne $global.areaNode.Type 3}}{{$global.detail.area}}{{end}}{{$global.detail.city}}</span>
             <span>发布日期:{{$global.detail.time}} </span>
           </div>
-          <p class="detail-summary">{{$global.detail.abstract | ConvString | ParseHtml}}</p>
+          <p class="detail-summary">{{$global.detail.title}}:本条项目信息由剑鱼标讯{{$global.areaNode.Name}}招标网为您提供。{{if not $global.hasLogin}}<a href='javascript:void(0);' data-quick-login='login' link-href='{{GetConfigVal "jyWebDomain"}}{{GetConfigVal "loginUrl.jyWeb"}}{{concat "https://" .Request.Host .Request.URL }}' class='highlight-text cms-link'>登录</a>后即可免费查看完整信息。{{end}}</p>
           <main class="detail-content">
             <div class="base-info">
               <h3>基本信息</h3>
@@ -88,7 +88,7 @@
               {{$global.detail.detail | ConvString | ParseHtml}}
             </div>
           </main>
-          <p class="detail-reminder">{{$global.detail.bottomAbstract | ConvString | ParseHtml}}</p>
+          <p class="detail-reminder">剑鱼标讯{{$global.areaNode.Name}}招标网收集整理了大量的招标投标信息、各类采购信息和企业经营信息,免费向广大用户开放。{{if not $global.hasLogin}}<a href='javascript:void(0);' data-quick-login='login' link-href='{{GetConfigVal "jyWebDomain"}}{{GetConfigVal "loginUrl.jyWeb"}}{{concat "https://" .Request.Host .Request.URL }}' class='highlight-text cms-link'>登录</a>后即可免费查询。{{end}}</p>
         </section>
         <section class="page-main-aside">
           {{include "pc/components/tags-aside-ad.html" .}}

+ 1 - 0
utility/response.go

@@ -30,6 +30,7 @@ func (l *localHtmlRender) Render(r *ghttp.Request, fileName string, params ...Pa
 	if len(params) > 0 {
 		usedParams = params[0]
 	}
+	usedParams["Request"] = r.Request
 	//当移动端未找到模版,渲染pc模版
 	for _, filePath := range GetCommonRenderCachePaths(r.Request.UserAgent(), fileName) {
 		res, err = g.View().Parse(r.Context(), filePath, usedParams)