wangshan 8 жил өмнө
parent
commit
92fba52cd2

+ 8 - 0
.gitignore

@@ -0,0 +1,8 @@
+pkg
+bin
+*/pkg
+*.exe
+*.log
+*/src/src
+*.data
+*/bin

+ 18 - 10
src/jfw/modules/followent/src/followent/followent.go

@@ -7,11 +7,13 @@ import (
 	"qfw/util/elastic"
 	"qfw/util/redis"
 	"strconv"
+	"strings"
 	"time"
 	"tools"
 
-	"github.com/go-xweb/xweb"
 	"jfw/jylabutil"
+
+	"github.com/go-xweb/xweb"
 )
 
 var mongodb = tools.MQFW
@@ -21,7 +23,7 @@ type FollowEnt struct {
 
 	entList  xweb.Mapper `xweb:"/jylab/followent/entList"`        //获取关注企业列表
 	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"`        //获取推荐企业列表
 	saveEnt  xweb.Mapper `xweb:"/jylab/followent/saveEnt"`        //保存关注企业
 	qgFollow xweb.Mapper `xweb:"/jylab/followent/qgFollow"`       //取消关注
@@ -34,11 +36,11 @@ func init() {
 
 func (f *FollowEnt) EntList() error {
 	defer util.Catch()
-	if f.Session().Get("s_m_openid") == nil{
+	if f.Session().Get("s_m_openid") == nil {
 		return f.Redirect("/swordfish/about")
 	}
 	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
 	if ok && datas != nil && len(*datas) > 0 {
 		for _, v := range *datas {
@@ -56,9 +58,9 @@ func (f *FollowEnt) AddEnt() error {
 
 func (f *FollowEnt) RecList() {
 	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 {
 			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()
-	if f.Session().Get("s_m_openid") == nil{
+	if f.Session().Get("s_m_openid") == nil {
 		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
 	var follow = "n"
 	s_id := ""
@@ -123,7 +131,7 @@ func (f *FollowEnt) NewInfo(winner, id string) error {
 //取消企业关注
 func (f *FollowEnt) QgFollow() error {
 	defer util.Catch()
-	if f.Session().Get("s_m_openid") == nil{
+	if f.Session().Get("s_m_openid") == nil {
 		return f.Redirect("/swordfish/about")
 	}
 	status := "n"

+ 1 - 1
src/jfw/modules/followent/src/web/templates/weixin/list.html

@@ -62,7 +62,7 @@ if(sessionStorage){
                 sessionStorage.version="0";
             }
 
-            window.location.href = "/jylab/followent/newInfo/"+$(this).attr("data-entname")+"/"+$(this).attr("data-id");
+            window.location.href = "/jylab/followent/newInfo/"+$(this).attr("data-entname")+"___"+$(this).attr("data-id");
         });
 	    //
         $("#addDiv").click(function(){