|
@@ -176,6 +176,8 @@ func (s *Short) Article(stype, id string) error {
|
|
|
|
|
|
obj := wxvisitD(sid, userId, myopenid, isVip || isMember || isEntniche)
|
|
|
if len(obj) > 0 {
|
|
|
+ FieldProcessing(obj, ssOpenid, industry, id, from_userid, userId, stype, isVip || isMember || isEntniche, true)
|
|
|
+
|
|
|
//获取打赏文案
|
|
|
s.T["rewardText"], s.T["advertText"] = getRewardText()
|
|
|
//纠错随机回复
|
|
@@ -185,9 +187,7 @@ func (s *Short) Article(stype, id string) error {
|
|
|
s.T["advertImg"] = config.Sysconfig["advertImg"]
|
|
|
s.T["advertName"] = config.Sysconfig["advertName"]
|
|
|
s.T["advertUrl"] = config.Sysconfig["advertUrl"]
|
|
|
- FieldProcessing(obj, ssOpenid, industry, id, isVip || isMember || isEntniche)
|
|
|
s.T["obj"] = obj
|
|
|
- BigMemberJump(obj, from_userid, userId, stype, id, true)
|
|
|
s.T["advertcode"] = s.GetString("advertcode")
|
|
|
content, _ := s.Render4Cache("/weixin/wxinfocontent_rec.html", &s.T)
|
|
|
return s.SetBody(content)
|
|
@@ -216,11 +216,7 @@ func (s *Short) Article(stype, id string) error {
|
|
|
s.DisableHttpCache()
|
|
|
po, bo, wo, obj := pcVRT(sid, industry, isVip || isMember || isEntniche)
|
|
|
if obj != nil && len(obj) > 0 {
|
|
|
- href, _ := obj["href"].(string)
|
|
|
- href = strings.Replace(href, "\n", "", -1)
|
|
|
- if href != "" && !strings.HasPrefix(href, "http") {
|
|
|
- href = "http://" + href
|
|
|
- }
|
|
|
+
|
|
|
if len(po) > 0 {
|
|
|
s.T["projectOther"] = po
|
|
|
}
|
|
@@ -230,13 +226,12 @@ func (s *Short) Article(stype, id string) error {
|
|
|
if len(wo) > 0 {
|
|
|
s.T["winnerOther"] = wo
|
|
|
}
|
|
|
- obj["url"] = href
|
|
|
- FieldProcessing(obj, ssOpenid, industry, id, isVip || isMember || isEntniche)
|
|
|
+
|
|
|
+ FieldProcessing(obj, ssOpenid, industry, id, from_userid, userId, stype, isVip || isMember || isEntniche, false)
|
|
|
s.T["obj"] = obj
|
|
|
if obj["projectname"] != nil {
|
|
|
s.SetSession("projectname", obj["projectname"])
|
|
|
}
|
|
|
- BigMemberJump(obj, "", "", "", "", false)
|
|
|
content, _ := s.Render4Cache("/pc/biddetail_rec.html", &s.T)
|
|
|
timeout := 60 * 20
|
|
|
if stype == "indexcontent" {
|
|
@@ -263,39 +258,11 @@ func SwiDef(sid_openid []string) (string, string) {
|
|
|
return shareopenid, sid
|
|
|
}
|
|
|
|
|
|
-//大会员中标企业跳转至画像
|
|
|
-func BigMemberJump(obj map[string]interface{}, from_userid, userId, stype, id string, b bool) {
|
|
|
- if obj["entidlist"] != nil {
|
|
|
- if winner := util.ObjToString(obj["winner"]); winner != "" {
|
|
|
- //临时更改为企业名称查询企业id
|
|
|
- rData := elastic.Get("qyxy", "qyxy", fmt.Sprintf(`{"query":{"bool":{"should":[{"term":{"company_name":"%s"}},{"term":{"hname":"%s"}}],"minimum_should_match":1}},"_source":["name","_id","capital","company_phone"],"size":1}`, winner, winner))
|
|
|
- if rData != nil && len(*rData) == 1 {
|
|
|
- if entId := util.ObjToString((*rData)[0]["_id"]); entId != "" {
|
|
|
- obj["entId"] = util.EncodeArticleId2ByCheck(util.ObjToString((*rData)[0]["_id"]))
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- //移动端需要处理
|
|
|
- if b && from_userid != "" && se.Decode4Hex(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)
|
|
|
- if redis.Incr("other", key) == 1 {
|
|
|
- redis.SetExpire("other", key, 60*60*24)
|
|
|
- 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))
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
//user 权限获取
|
|
|
func UserPermission(userId string, ssOpenid interface{}) (bool, bool, bool) {
|
|
|
var (
|
|
|
- res *map[string]interface{}
|
|
|
- isVip, isMember, isEntniche bool
|
|
|
+ res *map[string]interface{}
|
|
|
+ isVip, isMember, isEntniche, privatedata bool
|
|
|
)
|
|
|
if userId == "" && ssOpenid != nil {
|
|
|
res, _ = mongodb.FindOneByField("user", bson.M{"s_m_openid": ssOpenid, "s_unionid": bson.M{"$ne": ssOpenid}}, `{"i_vip_status":1,"i_member_status":1,"s_m_phone":1,"s_phone":1}`)
|
|
@@ -307,19 +274,20 @@ func UserPermission(userId string, ssOpenid interface{}) (bool, bool, bool) {
|
|
|
|
|
|
isVip = util.IntAll((*res)["i_vip_status"]) == 1 || util.IntAll((*res)["i_vip_status"]) == 2
|
|
|
isMember = util.IntAll((*res)["i_member_status"]) > 0
|
|
|
- privatedata:=false
|
|
|
+
|
|
|
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
|
|
|
privatedata = public.Mysql.CountBySql(`select count(1) from privatedata where phone = ?`, phone) > 0
|
|
|
}
|
|
|
- if !isEntniche&&privatedata{
|
|
|
- isEntniche=true
|
|
|
+ if !isEntniche && privatedata {
|
|
|
+ isEntniche = true
|
|
|
}
|
|
|
+
|
|
|
return isVip, isMember, isEntniche
|
|
|
}
|
|
|
|
|
|
//pc 移动共用字段处理
|
|
|
-func FieldProcessing(obj map[string]interface{}, ssOpenid interface{}, industry, id string, isPayUser bool) {
|
|
|
+func FieldProcessing(obj map[string]interface{}, ssOpenid interface{}, industry, id, from_userid, userId, stype string, isPayUser, b bool) {
|
|
|
obj["industry"] = industry
|
|
|
if ssOpenid != nil {
|
|
|
obj["ucbsId"] = util.EncodeArticleId2ByCheck("ucbs#" + ssOpenid.(string) + "#" + id)
|
|
@@ -336,6 +304,39 @@ func FieldProcessing(obj map[string]interface{}, ssOpenid interface{}, industry,
|
|
|
obj["winner_enttel"] = "无权限"
|
|
|
}
|
|
|
}
|
|
|
+ if !b {
|
|
|
+ href, _ := obj["href"].(string)
|
|
|
+ href = strings.Replace(href, "\n", "", -1)
|
|
|
+ if href != "" && !strings.HasPrefix(href, "http") {
|
|
|
+ href = "http://" + href
|
|
|
+ }
|
|
|
+ obj["url"] = href
|
|
|
+ }
|
|
|
+
|
|
|
+ //大会员中标企业跳转至画像
|
|
|
+ if obj["entidlist"] != nil {
|
|
|
+ if winner := util.ObjToString(obj["winner"]); winner != "" {
|
|
|
+ //临时更改为企业名称查询企业id
|
|
|
+ rData := elastic.Get("qyxy", "qyxy", fmt.Sprintf(`{"query":{"bool":{"should":[{"term":{"company_name":"%s"}},{"term":{"hname":"%s"}}],"minimum_should_match":1}},"_source":["name","_id","capital","company_phone"],"size":1}`, winner, winner))
|
|
|
+ if rData != nil && len(*rData) == 1 {
|
|
|
+ if entId := util.ObjToString((*rData)[0]["_id"]); entId != "" {
|
|
|
+ obj["entId"] = util.EncodeArticleId2ByCheck(util.ObjToString((*rData)[0]["_id"]))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //移动端需要处理
|
|
|
+ if b && from_userid != "" && se.Decode4Hex(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)
|
|
|
+ if redis.Incr("other", key) == 1 {
|
|
|
+ redis.SetExpire("other", key, 60*60*24)
|
|
|
+ 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))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//disWord 为空时处理
|