|
@@ -177,8 +177,19 @@ func (s *Short) Article(stype, id string) error {
|
|
|
//判断用户是否是vip
|
|
|
res, _ = public.MQFW.FindById("user", userId, nil)
|
|
|
}
|
|
|
- isVip := util.IntAll((*res)["i_vip_status"]) == 1 || util.IntAll((*res)["i_vip_status"]) == 2
|
|
|
+ isVip, isMember, isEntniche := false, false, false
|
|
|
+
|
|
|
+ isVip = util.IntAll((*res)["i_vip_status"]) == 1 || util.IntAll((*res)["i_vip_status"]) == 2
|
|
|
+ isMember = util.IntAll((*res)["i_vip_status"]) > 0
|
|
|
+
|
|
|
+ if phone, _ := util.If(util.ObjToString((*res)["s_phone"]) != "", util.ObjToString((*res)["s_phone"]), util.ObjToString((*res)["s_m_phone"])).(string); phone != "" {
|
|
|
+ isEntniche = 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["isVip"] = isVip
|
|
|
+ s.T["isMember"] = isMember
|
|
|
+ s.T["isEntniche"] = isEntniche
|
|
|
+
|
|
|
if bm {
|
|
|
//判断有没有取关,取关的话,跳转到关于剑鱼标讯页面
|
|
|
if ssOpenid != nil && ssOpenid != "" {
|
|
@@ -205,9 +216,7 @@ func (s *Short) Article(stype, id string) error {
|
|
|
} else {
|
|
|
sid = sid_openid[0]
|
|
|
}
|
|
|
- //if res := redis.Get("other", "jywxdetail_"+sid+kds); res != nil {
|
|
|
- // return s.SetBody([]byte(res.(string)))
|
|
|
- //} else {
|
|
|
+
|
|
|
s.T["keywords"] = kds
|
|
|
if shareopenid != "" {
|
|
|
s.T["shareopenid"] = shareopenid
|
|
@@ -241,17 +250,15 @@ func (s *Short) Article(stype, id string) error {
|
|
|
if ssOpenid != nil {
|
|
|
obj["ucbsId"] = util.EncodeArticleId2ByCheck("ucbs#" + ssOpenid.(string) + "#" + id)
|
|
|
}
|
|
|
- if obj["winnertel"] == nil && isbid(obj["subtype"]) {
|
|
|
- obj["winner_enttel"] = getwinnertel(obj["winner"])
|
|
|
+ if isVip || isMember || isEntniche {
|
|
|
+ if obj["winnertel"] == nil && isbid(obj["subtype"]) {
|
|
|
+ obj["winner_enttel"] = getwinnertel(obj["winner"])
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ delete(obj, "winnertel")
|
|
|
}
|
|
|
+
|
|
|
s.T["obj"] = obj
|
|
|
- var rec = "_rec"
|
|
|
- // if ssOpenid != nil && ssOpenid != "" {
|
|
|
- // if redis.Get("recovery", "rec-"+ssOpenid.(string)) != nil {
|
|
|
- // rec = "_rec"
|
|
|
- // }
|
|
|
- // }
|
|
|
- s.T["forceShareFlag"] = public.CheckUserNeedForceShare(userId, public.ShareType_detail) //是否强制分享
|
|
|
if from_userid != "" && from_userid != userId && util.ObjToString(obj["subtype"]) != "拟建" { //分享开打的
|
|
|
article_id := util.CommonDecodeArticle(stype, id)[0]
|
|
|
key := fmt.Sprintf("integral_article_%s_%s_%s", article_id, from_userid, userId)
|
|
@@ -260,16 +267,11 @@ func (s *Short) Article(stype, id string) error {
|
|
|
err := jy.Publish(public.Mgo_Log, config.Sysconfig["nsq"].(string), jy.Jyweb_article_open, se.Decode4Hex(from_userid), jy.Jywx_node1)
|
|
|
if err != nil {
|
|
|
log.Println("nsq队列写入失败-->", jy.Jyweb_article_open, se.Decode4Hex(from_userid))
|
|
|
- } /* else {
|
|
|
- //integral_article_ +userId+ 三级页id
|
|
|
- redis.Put("other", fmt.Sprintf("integral_article_%s_%s_%s", article_id, from_userid, userId), 1, 60*60*24)
|
|
|
- }*/
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- content, _ := s.Render4Cache("/weixin/wxinfocontent"+rec+".html", &s.T)
|
|
|
- // redis.Put("other", "jywxdetail_"+sid+kds, string(content), 60*60*2)
|
|
|
+ content, _ := s.Render4Cache("/weixin/wxinfocontent_rec.html", &s.T)
|
|
|
return s.SetBody(content)
|
|
|
- //}
|
|
|
}
|
|
|
if surl != "" {
|
|
|
return s.Redirect(surl)
|
|
@@ -280,47 +282,18 @@ 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)
|
|
|
- var rec = "_rec"
|
|
|
- //log.Println(redis.Get("recovery", "rec-"+ssOpenid.(string)), "ssOpenid:", ssOpenid)
|
|
|
- if ssOpenid != nil && ssOpenid != "" && userId != "" {
|
|
|
- if stype == "content" {
|
|
|
- //判断是否需要强制分享
|
|
|
- isForceShare = public.CheckUserNeedForceShare(userId, public.ShareType_detail)
|
|
|
- }
|
|
|
- // if !isForceShare {
|
|
|
- // if redis.Get("recovery", "rec-"+ssOpenid.(string)) != nil {
|
|
|
- // rec = "_rec"
|
|
|
- // }
|
|
|
- // }
|
|
|
- }
|
|
|
- var res interface{}
|
|
|
- if !isForceShare {
|
|
|
- res = redis.Get("other", "jypcdetail_"+rec+vip+entniche+sid)
|
|
|
- }
|
|
|
+ catchKey := fmt.Sprintf("jypcdetail_%s_%v_%v_%v", sid, isVip, isEntniche, isMember)
|
|
|
+ //缓存读取
|
|
|
+ res := redis.Get("other", catchKey)
|
|
|
+
|
|
|
if res == nil || res == "" {
|
|
|
industry := s.GetString("industry")
|
|
|
var shareid = s.GetString("id")
|
|
|
if len(shareid) == 0 {
|
|
|
shareid = "10"
|
|
|
}
|
|
|
- s.T["isForceShare"] = isForceShare
|
|
|
+
|
|
|
s.T["logid"] = config.Seoconfig["jysskzy"].(string)
|
|
|
s.T["shareid"] = se.EncodeString(shareid)
|
|
|
s.T["keywords"] = s.GetString("kds")
|
|
@@ -346,17 +319,19 @@ func (s *Short) Article(stype, id string) error {
|
|
|
if ssOpenid != nil {
|
|
|
obj["ucbsId"] = util.EncodeArticleId2ByCheck("ucbs#" + ssOpenid.(string) + "#" + id)
|
|
|
}
|
|
|
- if obj["winnertel"] == nil && isbid(obj["subtype"]) {
|
|
|
- obj["winner_enttel"] = getwinnertel(obj["winner"])
|
|
|
+ if isVip || isEntniche || isMember {
|
|
|
+ if obj["winnertel"] == nil && isbid(obj["subtype"]) {
|
|
|
+ obj["winner_enttel"] = getwinnertel(obj["winner"])
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ delete(obj, "winnertel")
|
|
|
}
|
|
|
s.T["obj"] = obj
|
|
|
if obj["projectname"] != nil {
|
|
|
s.SetSession("projectname", obj["projectname"])
|
|
|
}
|
|
|
- content, _ := s.Render4Cache("/pc/biddetail"+rec+".html", &s.T)
|
|
|
- if !isForceShare {
|
|
|
- redis.Put("other", "jypcdetail_"+rec+vip+entniche+sid, string(content), 60*60*2)
|
|
|
- }
|
|
|
+ content, _ := s.Render4Cache("/pc/biddetail_rec.html", &s.T)
|
|
|
+ redis.Put("other", catchKey, string(content), 60*60*2)
|
|
|
return s.SetBody(content)
|
|
|
}
|
|
|
} else {
|
|
@@ -366,14 +341,6 @@ func (s *Short) Article(stype, id string) error {
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-/*func TimeProcessing(hour interface{}, duration int) time.Time {
|
|
|
- todayZero, _ := time.ParseInLocation(qu.Date_Full_Layout, fmt.Sprint(hour), time.Local)
|
|
|
- mm, _ := time.ParseDuration(fmt.Sprint(duration) + "m")
|
|
|
- t := todayZero.Add(mm)
|
|
|
- //t := todayZero.Add(time.Second * 89)
|
|
|
- return t
|
|
|
-}*/
|
|
|
-
|
|
|
//检查用户是否关注
|
|
|
func CheckUserIsSubscribe(openid string) bool {
|
|
|
user, ok := mongodb.FindOneByField("user", map[string]interface{}{
|