|
@@ -7,11 +7,13 @@ import (
|
|
"qfw/util/elastic"
|
|
"qfw/util/elastic"
|
|
"qfw/util/redis"
|
|
"qfw/util/redis"
|
|
"strconv"
|
|
"strconv"
|
|
|
|
+ "strings"
|
|
"time"
|
|
"time"
|
|
"tools"
|
|
"tools"
|
|
|
|
|
|
- "github.com/go-xweb/xweb"
|
|
|
|
"jfw/jylabutil"
|
|
"jfw/jylabutil"
|
|
|
|
+
|
|
|
|
+ "github.com/go-xweb/xweb"
|
|
)
|
|
)
|
|
|
|
|
|
var mongodb = tools.MQFW
|
|
var mongodb = tools.MQFW
|
|
@@ -21,7 +23,7 @@ type FollowEnt struct {
|
|
|
|
|
|
entList xweb.Mapper `xweb:"/jylab/followent/entList"` //获取关注企业列表
|
|
entList xweb.Mapper `xweb:"/jylab/followent/entList"` //获取关注企业列表
|
|
addEnt xweb.Mapper `xweb:"/jylab/followent/addEnt"` //添加关注企业页面
|
|
addEnt xweb.Mapper `xweb:"/jylab/followent/addEnt"` //添加关注企业页面
|
|
- newInfo xweb.Mapper `xweb:"/jylab/followent/newInfo/(.*)/(.*)"` //企业最新信息
|
|
|
|
|
|
+ newInfo xweb.Mapper `xweb:"/jylab/followent/newInfo/(.*)"` //企业最新信息
|
|
recList xweb.Mapper `xweb:"/jylab/followent/recList"` //获取推荐企业列表
|
|
recList xweb.Mapper `xweb:"/jylab/followent/recList"` //获取推荐企业列表
|
|
saveEnt xweb.Mapper `xweb:"/jylab/followent/saveEnt"` //保存关注企业
|
|
saveEnt xweb.Mapper `xweb:"/jylab/followent/saveEnt"` //保存关注企业
|
|
qgFollow xweb.Mapper `xweb:"/jylab/followent/qgFollow"` //取消关注
|
|
qgFollow xweb.Mapper `xweb:"/jylab/followent/qgFollow"` //取消关注
|
|
@@ -34,11 +36,11 @@ func init() {
|
|
|
|
|
|
func (f *FollowEnt) EntList() error {
|
|
func (f *FollowEnt) EntList() error {
|
|
defer util.Catch()
|
|
defer util.Catch()
|
|
- if f.Session().Get("s_m_openid") == nil{
|
|
|
|
|
|
+ if f.Session().Get("s_m_openid") == nil {
|
|
return f.Redirect("/swordfish/about")
|
|
return f.Redirect("/swordfish/about")
|
|
}
|
|
}
|
|
f.T["followLimit"] = config.Sysconfig["followentlimit"]
|
|
f.T["followLimit"] = config.Sysconfig["followentlimit"]
|
|
- datas, ok := mongodb.Find("jylab_followent", `{"s_userid":"`+f.GetSession("userId").(string)+`","s_entname":{$ne:""}}`, `{"l_createtime":-1}`, `{"_id":1,"s_entname":1,"s_userid":1,"s_openid":1,"l_createtime":1,"s_id":1,"i_ispush":1}`, false, 0, 10)
|
|
|
|
|
|
+ datas, ok := mongodb.Find("jylab_followent", `{"s_userid":"`+f.GetSession("userId").(string)+`","s_entname":{"$ne":""}}`, `{"l_createtime":-1}`, `{"_id":1,"s_entname":1,"s_userid":1,"s_openid":1,"l_createtime":1,"s_id":1,"i_ispush":1}`, false, 0, 10)
|
|
f.T["flag"] = false
|
|
f.T["flag"] = false
|
|
if ok && datas != nil && len(*datas) > 0 {
|
|
if ok && datas != nil && len(*datas) > 0 {
|
|
for _, v := range *datas {
|
|
for _, v := range *datas {
|
|
@@ -56,9 +58,9 @@ func (f *FollowEnt) AddEnt() error {
|
|
|
|
|
|
func (f *FollowEnt) RecList() {
|
|
func (f *FollowEnt) RecList() {
|
|
var entName = f.GetString("entName")
|
|
var entName = f.GetString("entName")
|
|
- limit,_ := strconv.Atoi(config.Sysconfig["recommendEntLimit"].(string))
|
|
|
|
- re := jylabutil.GetEenNameImmediate(entName,limit)
|
|
|
|
- if re!=nil && len(re) != 0{
|
|
|
|
|
|
+ limit, _ := strconv.Atoi(config.Sysconfig["recommendEntLimit"].(string))
|
|
|
|
+ re := jylabutil.GetEenNameImmediate(entName, limit)
|
|
|
|
+ if re != nil && len(re) != 0 {
|
|
for _, v := range re {
|
|
for _, v := range re {
|
|
v["_id"] = util.EncodeArticleId2ByCheck(v["_id"].(string))
|
|
v["_id"] = util.EncodeArticleId2ByCheck(v["_id"].(string))
|
|
}
|
|
}
|
|
@@ -73,11 +75,17 @@ func (f *FollowEnt) SaveEnt() {
|
|
}
|
|
}
|
|
|
|
|
|
//企业最新信息
|
|
//企业最新信息
|
|
-func (f *FollowEnt) NewInfo(winner, id string) error {
|
|
|
|
|
|
+func (f *FollowEnt) NewInfo(winnerid string) error {
|
|
defer util.Catch()
|
|
defer util.Catch()
|
|
- if f.Session().Get("s_m_openid") == nil{
|
|
|
|
|
|
+ if f.Session().Get("s_m_openid") == nil {
|
|
return f.Redirect("/swordfish/about")
|
|
return f.Redirect("/swordfish/about")
|
|
}
|
|
}
|
|
|
|
+ winner := ""
|
|
|
|
+ id := ""
|
|
|
|
+ if winnerid != "" {
|
|
|
|
+ winner = strings.Split(winnerid, "___")[0]
|
|
|
|
+ id = strings.Split(winnerid, "___")[1]
|
|
|
|
+ }
|
|
userId := f.GetSession("userId").(string) //用户id
|
|
userId := f.GetSession("userId").(string) //用户id
|
|
var follow = "n"
|
|
var follow = "n"
|
|
s_id := ""
|
|
s_id := ""
|
|
@@ -123,7 +131,7 @@ func (f *FollowEnt) NewInfo(winner, id string) error {
|
|
//取消企业关注
|
|
//取消企业关注
|
|
func (f *FollowEnt) QgFollow() error {
|
|
func (f *FollowEnt) QgFollow() error {
|
|
defer util.Catch()
|
|
defer util.Catch()
|
|
- if f.Session().Get("s_m_openid") == nil{
|
|
|
|
|
|
+ if f.Session().Get("s_m_openid") == nil {
|
|
return f.Redirect("/swordfish/about")
|
|
return f.Redirect("/swordfish/about")
|
|
}
|
|
}
|
|
status := "n"
|
|
status := "n"
|