Browse Source

Merge branch 'dev2.0.1.1' of ssh://192.168.3.207:10022/qmx/jy into dev2.0.1.1

wangchuanjin 7 years ago
parent
commit
3ebe45715f

+ 3 - 0
src/jfw/front/entsearch.go

@@ -30,6 +30,9 @@ func init() {
 func (e *Entsearch) Bidsearchforentindex() error {
 	defer util.Catch()
 	var shareid = e.GetString("id")
+	if len(shareid) == 0 {
+		shareid = "10"
+	}
 	e.T["logid"] = config.Seoconfig["jyzbqyss"].(string)
 	var supstatus = ""
 	if e.GetSession("openid") != nil {

+ 15 - 0
src/jfw/front/front.go

@@ -131,6 +131,9 @@ func init() {
 //广告服务
 func (f *Front) Advservices() error {
 	var shareid = f.GetString("id")
+	if len(shareid) == 0 {
+		shareid = "10" //fmt.Sprintf("%s%d", config.Seoconfig["jyggfwy"].(string)+fmt.Sprintf("%d", time.Now().UnixNano())[7:14], rand.Intn(9))
+	}
 	f.T["logid"] = config.Seoconfig["jyggfwy"].(string)
 	f.T["shareid"] = se.EncodeString(shareid)
 	return f.Render("/pc/advservices.html", &f.T)
@@ -153,6 +156,9 @@ func (f *Front) Extension(page string) error {
 //SEM推广
 func (f *Front) Topics() error {
 	var shareid = f.GetString("id")
+	if len(shareid) == 0 {
+		shareid = "10" //fmt.Sprintf("%s%d", config.Seoconfig["jySEMtgy"].(string)+fmt.Sprintf("%d", time.Now().UnixNano())[7:14], rand.Intn(9))
+	}
 	f.T["logid"] = config.Seoconfig["jySEMtgy"].(string)
 	f.T["shareid"] = se.EncodeString(shareid)
 	f.DisableHttpCache()
@@ -173,6 +179,9 @@ func (f *Front) Notin() error {
 		f.T["ref"] = ref.(string)
 	}
 	var shareid = f.GetString("id")
+	if len(shareid) == 0 {
+		shareid = "10" //fmt.Sprintf("%s%d", config.Seoconfig["jysskzy"].(string)+fmt.Sprintf("%d", time.Now().UnixNano())[7:14], rand.Intn(9))
+	}
 	f.T["logid"] = config.Seoconfig["jysskzy"].(string)
 	f.T["shareid"] = se.EncodeString(shareid)
 	return f.Render("/pc/notin.html", &f.T)
@@ -970,6 +979,9 @@ func (f *Front) Aboutus() error {
 		return f.SetBody([]byte(ret.(string)))
 	} else {
 		var shareid = f.GetString("id")
+		if len(shareid) == 0 {
+			shareid = "10" //fmt.Sprintf("%s%d", config.Seoconfig["jygywmy"].(string)+fmt.Sprintf("%d", time.Now().UnixNano())[7:14], rand.Intn(9))
+		}
 		f.T["logid"] = config.Seoconfig["jygywmy"].(string)
 		f.T["shareid"] = se.EncodeString(shareid)
 		content, _ := f.Render4Cache("/pc/aboutus.html", &f.T)
@@ -981,6 +993,9 @@ func (f *Front) Aboutus() error {
 //商务合作
 func (f *Front) Busicooperation() error {
 	var shareid = f.GetString("id")
+	if len(shareid) == 0 {
+		shareid = "10" //fmt.Sprintf("%s%d", config.Seoconfig["jyswhzy"].(string)+fmt.Sprintf("%d", time.Now().UnixNano())[7:14], rand.Intn(9))
+	}
 	f.T["logid"] = config.Seoconfig["jyswhzy"].(string)
 	f.T["shareid"] = se.EncodeString(shareid)
 	content, _ := f.Render4Cache("/pc/businesscooperation.html", &f.T)

+ 3 - 0
src/jfw/front/shorturl.go

@@ -139,6 +139,9 @@ func (s *Short) Article(stype, id string) error {
 		industry := s.GetString("industry")
 		res := redis.Get("other", "jypcdetail_"+sid)
 		var shareid = s.GetString("id")
+		if len(shareid) == 0 {
+			shareid = "10"
+		}
 		s.T["logid"] = config.Seoconfig["jysskzy"].(string)
 		s.T["shareid"] = se.EncodeString(shareid)
 		if res == nil || res == "" {

+ 6 - 0
src/jfw/front/supsearch.go

@@ -43,6 +43,9 @@ func init() {
 func (p *Pcsearch) ProposedProject() error {
 	defer util.Catch()
 	var shareid = p.GetString("id")
+	if len(shareid) == 0 {
+		shareid = "10"
+	}
 	p.T["logid"] = config.Seoconfig["jynjxmy"].(string)
 	b_word, _, s_word := InterceptSearchKW(p.GetString("keywords"), false, true)
 	area := p.GetString("area")               //地区
@@ -138,6 +141,9 @@ func (p *Pcsearch) GetNewBids() error {
 func (p *Pcsearch) PcSearchIndex() error {
 	defer util.Catch()
 	var shareid = p.GetString("id")
+	if len(shareid) == 0 {
+		shareid = "10"
+	}
 	p.T["logid"] = config.Seoconfig["jysslby"].(string)
 	var supstatus = ""
 	if p.GetSession("openid") != nil {

+ 21 - 1
src/jfw/front/swordfish.go

@@ -125,7 +125,9 @@ func (m *Front) Getpraise() error {
 func (m *Front) NewSordfish() error {
 	ispc, _ := m.GetInteger("ispc")
 	var shareid = m.GetString("id")
-	if len(shareid) != 0 {
+	if len(shareid) == 0 {
+		shareid = "10" //fmt.Sprintf("%s%d", config.Seoconfig["jysy"].(string)+fmt.Sprintf("%d", time.Now().UnixNano())[8:14], rand.Intn(9))
+	} else {
 		redis.Del("other", "jypcindex")
 	}
 	m.T["logid"] = config.Seoconfig["jysy"].(string)
@@ -284,6 +286,9 @@ func (m *Front) Searchinfolist(p string) error {
 	defer util.Catch()
 	return m.Redirect("/jylab/supsearch/index.html")
 	var shareid = m.GetString("id")
+	if len(shareid) == 0 {
+		shareid = "10" //fmt.Sprintf("%s%d", config.Seoconfig["jysslby"].(string)+fmt.Sprintf("%d", time.Now().UnixNano())[8:14], rand.Intn(9))
+	}
 	m.T["logid"] = config.Seoconfig["jysslby"].(string)
 	m.T["shareid"] = se.EncodeString(shareid)
 	keywords := m.GetString("keywords")
@@ -1123,6 +1128,9 @@ func (m *Front) PcVisitRedirect(sid string) {
 	sid = strings.Split(sid, "_")[0]
 	//sid = util.DecodeArticleId(sid)[0]
 	var shareid = m.GetString("id")
+	if len(shareid) == 0 {
+		shareid = "10" //fmt.Sprintf("%s%d", config.Seoconfig["jysskzy"].(string)+fmt.Sprintf("%d", time.Now().UnixNano())[8:14], rand.Intn(9))
+	}
 	m.T["logid"] = config.Seoconfig["jysskzy"].(string)
 	m.T["shareid"] = se.EncodeString(shareid)
 	if ret := redis.Get("other", "jypcdetail_"+sid+kds); ret != nil {
@@ -1786,6 +1794,9 @@ func (f *Front) Jyblog(param /*参数*/ string) error {
 
 	}
 	var shareid = f.GetString("id")
+	if len(shareid) == 0 {
+		shareid = fmt.Sprintf("%s%d", config.Seoconfig["jybky"].(string)+fmt.Sprintf("%d", time.Now().UnixNano())[8:14], rand.Intn(9))
+	}
 	f.T["logid"] = config.Seoconfig["jybky"].(string)
 	f.DisableHttpCache()
 	shareid = se.EncodeString(shareid)
@@ -1934,6 +1945,9 @@ func MakePagination(perPage, currentPage, total int, param map[string]string, ur
 //博客三级页
 func (f *Front) Jybdetail(_id string) error {
 	var shareid = f.GetString("id")
+	if len(shareid) == 0 {
+		shareid = "10" //fmt.Sprintf("%s%d", config.Seoconfig["jybky"].(string)+fmt.Sprintf("%d", time.Now().UnixNano())[8:14], rand.Intn(9))
+	}
 	f.T["logid"] = config.Seoconfig["jybky"].(string)
 	shareid = se.EncodeString(shareid)
 	if ret := redis.Get("other", "jyblog_"+_id); ret != nil {
@@ -2092,6 +2106,9 @@ func (f *Front) SearchResult(at, name string) error {
 	}
 	f.T["supstatus"] = supstatus
 	var shareid = f.GetString("id")
+	if len(shareid) == 0 {
+		shareid = "10" //fmt.Sprintf("%s%d", config.Seoconfig["jybqy"].(string)+fmt.Sprintf("%d", time.Now().UnixNano())[8:14], rand.Intn(9))
+	}
 	f.T["logid"] = config.Seoconfig["jybqy"].(string)
 	if at == "area" {
 		areamp, _ := config.Seoconfig["area"].(map[string]interface{})
@@ -2311,6 +2328,9 @@ func getHistorypush(lasttime int64, sid string, res []map[string]interface{}, co
 //电脑端招标订阅
 func (m *Front) Subscribe() error {
 	var shareid = m.GetString("id")
+	if len(shareid) == 0 {
+		shareid = "10" //fmt.Sprintf("%s%d", config.Seoconfig["jydyy"].(string)+fmt.Sprintf("%d", time.Now().UnixNano())[7:14], rand.Intn(9))
+	}
 	m.T["logid"] = config.Seoconfig["jydyy"].(string)
 	m.T["noshareid"] = shareid
 	m.T["shareid"] = se.EncodeString(shareid)

+ 10 - 3
src/jfw/jyutil/jyutil.go

@@ -7,6 +7,7 @@ import (
 	"log"
 	"qfw/util"
 	"qfw/util/redis"
+	"regexp"
 	//"strconv"
 	"strings"
 	"time"
@@ -31,11 +32,17 @@ func init() {
 //
 func FindMyShareId(activecode, openid string) string {
 	defer util.Catch()
-	ret, bres := mongodb.FindOne("person_share", "{'s_openid':'"+openid+"','s_businesscode':'"+activecode+"'}")
+	ret, bres := mongodb.Find("person_share", "{'s_openid':'"+openid+"','s_businesscode':'"+activecode+"'}", `{"l_timestamp":-1}`, nil, true, -1, -1)
 	var shareid string
 	if bres {
 		var shareData = make(map[string]interface{})
-		if (*ret)["i_shareid"] == nil {
+		var str = ""
+		for _, v := range *ret {
+			str = util.ObjToString(v["i_shareid"])
+		}
+		var tt = `^\d+$`
+		a, _ := regexp.Compile(tt)
+		if str == "" || a.MatchString(str) {
 			data := make(map[string]interface{})
 			data["s_openid"] = openid
 			data["s_businesscode"] = activecode
@@ -44,7 +51,7 @@ func FindMyShareId(activecode, openid string) string {
 			mongodb.Save("person_share", data)
 			shareid = openid + "---" + activecode
 		} else {
-			shareid = se.DecodeString((*ret)["i_shareid"].(string))
+			shareid = se.DecodeString(str)
 		}
 		odata := redis.Get("sso", "p_shareData_"+shareid)
 		if odata == nil {

+ 1 - 1
src/jfw/modules/weixin/src/wx/wx.go

@@ -453,7 +453,7 @@ func Subscribe(w ResponseWriter, r *Request) {
 	var pccodepre = ""
 	if len(strings.Split(r.EventKey, "_")) == 2 {
 		source = strings.Split(r.EventKey, "_")[1]
-	} else if len(strings.Split(r.EventKey, "_")) == 3 {
+	} else if len(strings.Split(r.EventKey, "_")) >= 3 {
 		source = strings.SplitN(r.EventKey, "_", 2)[1]
 	}
 	shareData := redis.Get("sso", "p_shareData_"+source)