wangchuanjin пре 4 година
родитељ
комит
11ea75f9e2
2 измењених фајлова са 24 додато и 16 уклоњено
  1. 23 15
      src/jfw/front/shorturl.go
  2. 1 1
      src/web/templates/pc/biddetail_rec.html

+ 23 - 15
src/jfw/front/shorturl.go

@@ -54,7 +54,6 @@ func (s *Short) Article(stype, id string) error {
 		aboutUrl += "?source=" + source
 	}
 	bm := false
-	isVip := false
 	userId, _ := s.GetSession("userId").(string)
 	if !Map_stype[stype] {
 		s.Redirect("/not/nottype", 302)
@@ -158,21 +157,16 @@ func (s *Short) Article(stype, id string) error {
 		}
 	}
 	ssOpenid := s.Session().Get("s_m_openid")
-
+	var res *map[string]interface{}
 	if userId == "" && ssOpenid != "" {
-		data1, _ := mongodb.FindOneByField("user", bson.M{"s_m_openid": ssOpenid}, `{"_id":1}`)
-		userId = BsonIdToSId((*data1)["_id"])
-	}
-	//判断用户是否是vip
-	res, _ := public.MQFW.FindById("user", userId, nil)
-	if util.IntAll((*res)["i_vip_status"]) == 1 || util.IntAll((*res)["i_vip_status"]) == 2 {
-		isVip = true
+		res, _ = mongodb.FindOneByField("user", bson.M{"s_m_openid": ssOpenid}, nil)
+		userId = BsonIdToSId((*res)["_id"])
+	} else {
+		//判断用户是否是vip
+		res, _ = public.MQFW.FindById("user", userId, nil)
 	}
+	isVip := util.IntAll((*res)["i_vip_status"]) == 1 || util.IntAll((*res)["i_vip_status"]) == 2
 	s.T["isVip"] = isVip
-	vip := ""
-	if isVip {
-		vip = "_vip_"
-	}
 	if bm {
 		//判断有没有取关,取关的话,跳转到关于剑鱼标讯页面
 		if ssOpenid != nil && ssOpenid != "" {
@@ -261,6 +255,20 @@ func (s *Short) Article(stype, id string) error {
 			s.Redirect("/notin/page", 302)
 			return nil
 		}
+		vip, entniche := "", ""
+		if isVip {
+			vip = "_vip_"
+		}
+		//
+		phone := util.ObjToString((*res)["s_phone"])
+		if phone == "" {
+			phone = util.ObjToString((*res)["s_m_phone"])
+		}
+		isEntniche := phone != "" && public.Mysql.CountBySql(`SELECT count(1) from entniche_user a INNER JOIN entniche_info b on (a.phone=? and a.power=1 and a.ent_id=b.id and b.status>0)`, phone) > 0
+		s.T["isEntniche"] = isEntniche
+		if isEntniche {
+			entniche = "_entniche_"
+		}
 		isForceShare := false
 		sid := sids[0]
 		//log.Println("sid", sid)
@@ -279,7 +287,7 @@ func (s *Short) Article(stype, id string) error {
 		}
 		var res interface{}
 		if !isForceShare {
-			res = redis.Get("other", "jypcdetail_"+rec+vip+sid)
+			res = redis.Get("other", "jypcdetail_"+rec+vip+entniche+sid)
 		}
 		if res == nil || res == "" {
 			industry := s.GetString("industry")
@@ -322,7 +330,7 @@ func (s *Short) Article(stype, id string) error {
 				}
 				content, _ := s.Render4Cache("/pc/biddetail"+rec+".html", &s.T)
 				if !isForceShare {
-					redis.Put("other", "jypcdetail_"+rec+vip+sid, string(content), 60*60*2)
+					redis.Put("other", "jypcdetail_"+rec+vip+entniche+sid, string(content), 60*60*2)
 				}
 				return s.SetBody(content)
 			}

+ 1 - 1
src/web/templates/pc/biddetail_rec.html

@@ -456,7 +456,7 @@ function isWechat() {
             <tr class="winnertel" style="display:none">
 							<td class="tab-type">联系方式</td>
 							<td class="tab-cont">
-                {{if .T.isVip}}
+                {{if or .T.isVip .T.isEntniche}}
 								<div class="cont-cont"><span  id="winnertel"></span><span style="font-size: 14px;float: right;display: inline-block; margin-right: -35px;color:#888;" id="tel_source"></span></div>
 								<div></div>
 								<div></div>