Prechádzať zdrojové kódy

Merge branch 'release' into develop

liumiaomiao 9 rokov pred
rodič
commit
b89dbdec27

+ 3 - 2
common/src/main.go

@@ -2,7 +2,6 @@ package main
 
 import (
 	"fmt"
-	"gopkg.in/mgo.v2/bson"
 	"log"
 	"os"
 	util "qfw/util"
@@ -10,12 +9,14 @@ import (
 	. "qfw/util/mongodbutil"
 	"strconv"
 	"strings"
+
+	"gopkg.in/mgo.v2/bson"
 )
 
 var N = 200
 
 //生enterprise表
-func main() {
+func mainS() {
 	//src.exe 192.168.3.18:27080 192.168.3.18:27090 http://192.168.3.18:9800 enterprise all enterprise enterprise 2000
 	// 参数 mongodb(网站库) mongodb(公示库) elastic collection area index-db inde-type N
 	log.Println("-------------开始-----------------")

+ 18 - 8
common/src/mainIndex.go

@@ -8,30 +8,38 @@ import (
 	"strconv"
 )
 
-var NN = 200
+var NN = 1000
+var T = "qfw"
 
-//生content。service
-func mainS() {
+//生content。service
+func main() {
 	//6 参数 mongodb elastic collection index-db inde-type N
+	if len(os.Args) < 7 {
+		log.Println("程序 mgoIp elasticIp mgoCollection elasticIndex elasticType saveSize table")
+		return
+	}
+	if len(os.Args) > 7 {
+		T = os.Args[7]
+	}
 	n1, _ := strconv.Atoi(os.Args[6])
 	if n1 > 0 {
 		NN = n1
 	}
-	mongodb.InitMongodbPool(1, os.Args[1], "qfw")
-	elastic.InitElastic(os.Args[2])
+	mongodb.InitMongodbPool(1, os.Args[1], T)
+	elastic.InitElasticSize((os.Args[2]), 5)
 	session := mongodb.GetMgoConn()
 	var m map[string]interface{} = nil
-	query := session.DB("qfw").C(os.Args[3]).Find(m).Iter()
+	query := session.DB(T).C(os.Args[3]).Find(m).Iter()
 	arr := make([]map[string]interface{}, NN)
 	var n int
 	i := 0
 	for tmp := make(map[string]interface{}); query.Next(tmp); i = i + 1 {
 		n++
-		log.Printf("current index:=%d \n", n)
 		arr[i] = tmp
 		tmp = make(map[string]interface{})
 		if i == NN-1 {
-			elastic.BulkSave(os.Args[4], os.Args[5], &arr, true)
+			tmp := arr
+			elastic.BulkSave(os.Args[4], os.Args[5], &tmp, true)
 			i = 0
 			arr = make([]map[string]interface{}, NN)
 		}
@@ -42,4 +50,6 @@ func mainS() {
 	if i > 0 {
 		elastic.BulkSave(os.Args[4], os.Args[5], &arr, true)
 	}
+	mongodb.DestoryMongoConn(session)
+	log.Println("over....", n)
 }

+ 13 - 6
common/src/qfw/util/date.go

@@ -2,6 +2,7 @@
 package util
 
 import (
+	"fmt"
 	"time"
 )
 
@@ -20,14 +21,20 @@ func FormatDate(src *time.Time, layout string) string {
 //兼容从Java转换过来的数据,java生成的时间戳是按微秒算的,Go中只能按毫秒或纳秒算
 func formatDateWithInt64(src *int64, layout string) string {
 	var tmp int64
-	if (*src) > 6000000000 {
-		tmp = (*src) / 1000
-	} else if (*src) < 1 {
-		return ""
+	if *src > 0 {
+		if len(fmt.Sprint(*src)) > 10 {
+			tmp = (*src) / 1000
+		} else {
+			tmp = (*src)
+		}
+
 	} else {
-		tmp = (*src)
+		if len(fmt.Sprint(*src)) > 11 {
+			tmp = (*src) / 1000
+		} else {
+			tmp = (*src)
+		}
 	}
-
 	date := time.Unix(tmp, 0)
 	return FormatDate(&date, layout)
 }

+ 151 - 3
common/src/qfw/util/elastic/elasticutil.go

@@ -8,13 +8,14 @@ import (
 	//	"bytes"
 	"encoding/json"
 	"fmt"
-	es "gopkg.in/olivere/elastic.v1"
 	"log"
 	"qfw/util"
 	"qfw/util/mongodb"
 	mongodbutil "qfw/util/mongodbutil"
 	"reflect"
 
+	es "gopkg.in/olivere/elastic.v1"
+
 	"strconv"
 	"strings"
 )
@@ -189,6 +190,7 @@ func Get(index, itype, query string) *[]map[string]interface{} {
 
 //分页查询
 //{"name":"张三","$and":[{"age":{"$gt":10}},{"age":{"$lte":20}}]}
+//fields直接是 `"_id","title"`
 func GetPage(index, itype, query, order, field string, start, limit int) *[]map[string]interface{} {
 	return Get(index, itype, MakeQuery(query, order, field, start, limit))
 }
@@ -739,10 +741,156 @@ func Count(index, itype string, query interface{}) int64 {
 		if err != nil {
 			log.Println("统计出错", err.Error())
 		}
-		if n > 5000 {
-			n = 5000
+		if n > 500 {
+			n = 500
 		}
 		return n
 	}
 	return 0
 }
+
+//ngram精确查询
+/*
+{
+  "query": {
+    "bool": {
+      "should": [
+        {
+	"bool":{
+	  "must":[
+	  {     "multi_match": {
+            "query": "智能",
+            "type": "phrase",
+            "fields": [
+              "title"
+            ],
+           "analyzer": "my_ngram"
+          }
+        },{
+          "multi_match": {
+            "query": "机器",
+            "type": "phrase",
+            "fields": [
+              "title"
+            ],
+           "analyzer": "my_ngram"
+          }
+        },{
+          "multi_match": {
+            "query": "2016",
+            "type": "phrase",
+            "fields": [
+              "title"
+            ],
+           "analyzer": "my_ngram"
+          }
+	  }
+	  ]
+	}
+        },
+
+{
+	"bool":{
+	  "must":[
+	  {          "multi_match": {
+            "query": "河南",
+            "type": "phrase",
+            "fields": [
+              "title"
+            ],
+           "analyzer": "my_ngram"
+          }
+        },{
+          "multi_match": {
+            "query": "工商",
+            "type": "phrase",
+            "fields": [
+              "title"
+            ],
+           "analyzer": "my_ngram"
+          }
+        },{
+          "multi_match": {
+            "query": "2016",
+            "type": "phrase",
+            "fields": [
+              "title"
+            ],
+           "analyzer": "my_ngram"
+          }
+	  }
+	  ]
+	}
+        }
+      ],"minimum_should_match": 1
+    }
+  },
+  "_source": [
+    "_id",
+    "title"
+  ],
+  "from": 0,
+  "size": 10,
+  "sort": [{
+      "publishtime": "desc"
+    }]
+}
+
+*/
+//"2016+智能+办公,"河南+工商"
+//["2016+智能+办公","河南+工商"]
+//QStr = `{"query":{"bool":{should":[$or],"minimum_should_match" : 1}}}`
+//{"bool":{"must":[]}}
+//{"multi_match": {"query": "$word","type": "phrase", "fields": [$field],"analyzer": "my_ngram"}}
+const (
+	NgramStr  = `{"query":{"bool":{"must":[%s],"should":[%s],"minimum_should_match" : 1}}}`
+	NgramMust = `{"bool":{"must":[%s]}}`
+	minq      = `{"multi_match": {"query": "%s","type": "phrase", "fields": [%s],"analyzer": "my_ngram"}}`
+)
+
+func GetNgramQuery(query interface{}, mustquery, findfields string) (qstr string) {
+	var words []string
+	if q, ok := query.(string); ok {
+		words = strings.Split(q, ",")
+	} else if q, ok := query.([]string); ok {
+		words = q
+	} else if q, ok := query.([]interface{}); ok {
+		words = util.ObjArrToStringArr(q)
+	}
+	if words != nil {
+		new_minq := fmt.Sprintf(minq, "%s", findfields)
+		musts := []string{}
+		for _, qs_words := range words {
+			qws := strings.Split(qs_words, "+")
+			mq := []string{}
+			for _, qs_word := range qws {
+				mq = append(mq, fmt.Sprintf(new_minq, qs_word))
+			}
+			musts = append(musts, fmt.Sprintf(NgramMust, strings.Join(mq, ",")))
+		}
+		qstr = fmt.Sprintf(NgramStr, mustquery, strings.Join(musts, ","))
+		log.Println("ngram-query", qstr)
+	}
+	return
+}
+
+func GetByNgram(index, itype string, query interface{}, mustquery, findfields, order, fields string, start, limit int) *[]map[string]interface{} {
+	defer util.Catch()
+	qstr := GetNgramQuery(query, mustquery, findfields)
+	if qstr != "" {
+		if len(fields) > 0 {
+			qstr = qstr[:len(qstr)-1] + `,"_source":[` + fields + "]}"
+		}
+		if len(order) > 0 {
+			qstr = qstr[:len(qstr)-1] + `,"sort":[` + SR(SR(SR(SR(order, ",", "},{", -1), " ", "", -1), ":-1", `:"desc"`, -1), ":1", `:"asc"`, -1) + `]}`
+		}
+		if start > -1 {
+			qstr = qstr[:len(qstr)-1] + `,"from":` + strconv.Itoa(start) + `,"size":` + strconv.Itoa(limit) + "}"
+		}
+		log.Println("ngram-find", qstr)
+		return Get(index, itype, qstr)
+	} else {
+		return nil
+	}
+
+}

+ 8 - 0
common/src/qfw/util/elastic/elasticutil_test.go

@@ -206,3 +206,11 @@ func Test_q(t *testing.T) {
 	//log.Println(MakeQuery(`{"_id":"556349a6a442ab325177ade0"}`, "", `"_id"`, -1, -1))
 	//Count("enterprise","enterprise",)
 }
+
+func Test_bidding(t *testing.T) {
+	InitElasticSize("http://192.168.3.18:9800", 1)
+	//log.Println(Count("bidding_v1", "bidding", GetNgramQuery("河南+工商", `"title"`)))
+	//log.Println(GetByNgram("bidding_v1", "bidding", "河南省", `"title"`, `{"publishtime":-1}`, `"title"`, 0, 10))
+	res := GetPage("bidding", "bidding", "", `{"comeintime":-1}`, `"_id"`, 0, 1)
+	log.Println((*res)[0]["_id"])
+}

+ 1 - 0
common/src/qfw/util/encrypt_test.go

@@ -29,6 +29,7 @@ func Test_sim(t *testing.T) {
 	log.Println("=====", se.EncodeString(",1349385977,ASD"))
 	//log.Println("---", se.DecodeString("GyUlIhEDSGheAzEpJl8kHB9oVEwmLRkDPTN/CB1AHQtcX1RFHkNGWgYLFgcWHFNTRVwbAQ=="))
 	log.Println("---", se.DecodeString("GycHKzoDMykjDSEOMz0gLzI6FTtANCBNAiseVkkBHQtcX1FCRlpCV1JDR0MHFhUBBwccBxYA"))
+	log.Println("==---==", se.DecodeString("Gw01HikBOSI0OzwhOUIKAh83Fj5AIwcBJSAKDUlYRVtGWVRCQFhGVkkHAwACCgMdBwcRDREdGwE="))
 
 	now := time.Now()
 	tom := time.Date(now.Year(), now.Month(), now.Day(), 18, 0, 0, 0, time.Local)

+ 3 - 2
common/src/qfw/util/redis/redisutil.go

@@ -4,19 +4,20 @@ import (
 	"encoding/json"
 	"errors"
 	"fmt"
-	redigo "github.com/garyburd/redigo/redis"
 	"log"
 	"qfw/util/mongodb"
 	"runtime"
 	"strings"
 	"time"
+
+	redigo "github.com/garyburd/redigo/redis"
 )
 
 var RedisPool map[string]*redigo.Pool
 
 //初始化redis 1为多个连接池,2为共用一个连接池
 func InitRedis(addrs string) {
-	InitRedisBySize(addrs, 1000, 500, 240)
+	InitRedisBySize(addrs, 300, 30, 240)
 }
 
 func InitRedisBySize(addrs string, maxSize, maxIdle, timeout int) {

+ 1 - 1
core/src/message.json

@@ -1,6 +1,6 @@
 {
 	"weixinrpc":"127.0.0.1:82",
-	"swordfishaction":"/swordfish/page",
+	"swordfishaction":"/swordfish/excessive",
 	"signature":"/member/credit/myCredit",
 	"entsearchaction":"/wx/search/enterprise/index.html",
 	"lawsearchaction":"/law/qfw/index",

+ 1 - 0
core/src/qfw/mobile/mobile.go

@@ -24,6 +24,7 @@ type Mobile struct {
 	wxpushAjaxReq  xweb.Mapper `xweb:"/wxpush/bid/ajaxReq"`
 	wxpushView     xweb.Mapper `xweb:"/wxpush/bid/wxpushview/(.*)"` //推送结果预览
 	mobileindex    xweb.Mapper `xweb:"/mobile/mobileindex"`
+	wxex           xweb.Mapper `xweb:"/swordfish/excessive"`
 }
 
 func init() {

+ 35 - 1
core/src/qfw/mobile/wxmenu.go

@@ -4,6 +4,7 @@ import (
 	"encoding/json"
 	"fmt"
 	"github.com/go-xweb/xweb"
+	. "gopkg.in/mgo.v2/bson"
 	"log"
 	"math/rand"
 	"net/rpc"
@@ -47,6 +48,40 @@ func (m *Mobile) Share(shareid string) error {
 	return m.Render("/swordfish/wxshare.html", &m.T)
 }
 
+//过度页面
+func (m *Mobile) Wxex() error {
+	var newsubscribe = "N"
+	if m.Session().Get("userId") != nil {
+		userInfo := mongodb.FindById("user", m.GetSession("userId").(string), nil)
+		if *userInfo != nil {
+			if (*userInfo)["s_unionid"] != nil || (*userInfo)["s_unionid"] != "" {
+				var unid = (*userInfo)["s_unionid"]
+				query := make(M)
+				query["s_unionid"] = unid
+				userdata := mongodb.Find("user", query, `{"l_date":-1}`, `{"s_m_openid":1}`, false, 0, 2)
+				if len(*userdata) > 0 {
+					for _, opendata := range *userdata {
+						if opendata["s_m_openid"] != (*userInfo)["s_m_openid"] {
+							var opid = opendata["s_m_openid"]
+							queryop := make(M)
+							queryop["s_m_openid"] = opid
+							jysb := mongodb.Find("jy_subscribe", queryop, `{"l_date":-1}`, `{"s_event":1}`, false, 0, 1)
+							if (*jysb)[0]["s_event"] == "subscribe" {
+								newsubscribe = "Y"
+							}
+						}
+					}
+
+				}
+			}
+		}
+		m.T["newsubscribe"] = newsubscribe
+		return m.Render("/swordfish/wxex.html", &m.T)
+	} else {
+		return m.Redirect("/swordfish/share/-1")
+	}
+}
+
 //进入订阅页面
 func (m *Mobile) Wxrssset() error {
 	searchname := m.GetString("searchnametwo")
@@ -110,7 +145,6 @@ func (m *Mobile) Wxrssset() error {
 			//取Shareid
 			m.T["shareid"] = cutil.FindMyShareId("topjy", m.Session().Get("s_m_openid").(string))
 		}
-
 		return m.Render("/swordfish/wxrssset.html", &m.T)
 	} else {
 		return m.Redirect("/swordfish/share/-1")

+ 5 - 5
core/src/qfw/search/searchService.go

@@ -348,7 +348,7 @@ func searhWebContentent(querymap map[string]string, n *Search, reqType string) (
 							  "must":[{"prefix":{"OpLocDistrict":"` + ipcity + `"}}]
 						    }
 						}
-						,"_source":["_id","EntName","RegOrgName","RegNo","EntType","LeRep","EstDate","OpLocDistrictName","RegCap","OpStateName","OpState","s_servicenames","s_action","OpLocDistrict","s_submitid","RegCapCurName","s_avatar","excDirect"]
+						,"_source":["_id","EntName","RegOrgName","RegNo","EntType","LeRep","EstDate","OpLocDistrictName","RegCap","OpStateName","OpState","s_servicenames","s_action","OpLocDistrict","s_submitid","RegCapCurName","s_avatar","Ycml"]
 						,"from":0,
 						"size":` + fmt.Sprintf("%v", perPage) + `,
 						  "sort": [{"_score": "desc"},{"OpSint":"desc"},{"RegCap":"desc"}]
@@ -512,7 +512,7 @@ func searhWebContentent(querymap map[string]string, n *Search, reqType string) (
 			"s_synopsis":{"force_source": true},
 			"stock":{"force_source": true}
         }
-    },"_source":["_id","EntName","RegOrgName","RegNo","EntType","LeRep","EstDate","OpLocDistrictName","RegCap","OpStateName","OpState","s_servicenames","s_action","OpLocDistrict","s_submitid","RegCapCurName","s_avatar","excDirect"]
+    },"_source":["_id","EntName","RegOrgName","RegNo","EntType","LeRep","EstDate","OpLocDistrictName","RegCap","OpStateName","OpState","s_servicenames","s_action","OpLocDistrict","s_submitid","RegCapCurName","s_avatar","Ycml"]
 	,"from":` + fmt.Sprintf("%v", ((currentPage-1)*perPage)) + `,
 	"size":` + fmt.Sprintf("%v", perPage) +
 			`,"sort":[` + sort + `] }`
@@ -545,6 +545,7 @@ func searhWebContentent(querymap map[string]string, n *Search, reqType string) (
 
 			EntName, _ := res[i]["EntName"].(string)
 			tmpNo := res[i]["EntType"]
+			res[i]["EntTypeCopy"] = tmpNo
 			res[i]["RegCapEntType"] = tmpNo
 			if tmpNo != nil {
 				switch tmpNo.(string) {
@@ -613,12 +614,11 @@ func searhWebContentent(querymap map[string]string, n *Search, reqType string) (
 			tmpdate, _ := res[i]["EstDate"]
 
 			//res[i]["OperatorLabel"] = getDiffName(EntType)[0]
-			if tmpdate != nil {
+			if tmpdate != nil && IntAll(tmpdate) != 0 {
 				res[i]["EstDate"] = FormatDateWithObj(&tmpdate, Date_Short_Layout)
 			} else {
 				res[i]["EstDate"] = ""
 			}
-
 		}
 	}
 	//log.Println(total)
@@ -741,7 +741,7 @@ func searhWebContententMp(querymap map[string]string, n *Search, reqType string,
 				res[i]["stock"] = template.HTML(stock)
 			}
 			tmpdate, _ := res[i]["EstDate"]
-			if tmpdate != nil {
+			if tmpdate != nil && IntAll(tmpdate) != 0 {
 				res[i]["EstDate"] = FormatDateWithObj(&tmpdate, Date_Short_Layout)
 			} else {
 				res[i]["EstDate"] = ""

+ 6 - 5
core/src/qfw/search/wxsearchservice.go

@@ -89,7 +89,7 @@ func FormatData(data *[]map[string]interface{}, action *xweb.Action) string {
 			"EstDate":       estDate,
 			"OpStateName":   fmt.Sprint(v["OpStateName"]),
 			"status":        "n",
-			"excDirect":     fmt.Sprint(v["excDirect"]),
+			"Ycml":          fmt.Sprint(v["Ycml"]),
 		}
 		//是否关注
 		entId := tmp["_id"]
@@ -152,7 +152,7 @@ func wxsearhWebContentent(querymap map[string]string, n *Wxsearch, reqType strin
 						      }
 						    }
 						  }
-						,"_source":["_id","EntName","RegOrgName","RegNo","EntType","LeRep","EstDate","OpLocDistrictName","RegCap","OpStateName","OpState","s_servicenames","s_action","OpLocDistrict","RegCapCurName","s_avatar","excDirect"]
+						,"_source":["_id","EntName","RegOrgName","RegNo","EntType","LeRep","EstDate","OpLocDistrictName","RegCap","OpStateName","OpState","s_servicenames","s_action","OpLocDistrict","RegCapCurName","s_avatar","Ycml"]
 						,"from": ` + fmt.Sprintf("%v", ((currentPage-1)*perPage)) + `,
 						"size":` + fmt.Sprintf("%v", perPage) + `,
 						  "sort": [{"_score": "desc"},{"OpSint":"desc"},{"RegCap":"desc"}]
@@ -293,7 +293,7 @@ func wxsearhWebContentent(querymap map[string]string, n *Wxsearch, reqType strin
 			"s_synopsis":{"force_source": true},
 			"stock":{"force_source": true}
         }
-    },"_source":["_id","EntName","RegOrgName","RegNo","EntType","LeRep","EstDate","OpLocDistrictName","RegCap","OpStateName","OpState","s_servicenames","s_action","OpLocDistrict","s_submitid","RegCapCurName","s_avatar","excDirect"]
+    },"_source":["_id","EntName","RegOrgName","RegNo","EntType","LeRep","EstDate","OpLocDistrictName","RegCap","OpStateName","OpState","s_servicenames","s_action","OpLocDistrict","s_submitid","RegCapCurName","s_avatar","Ycml"]
 	,"from":` + fmt.Sprintf("%v", ((currentPage-1)*perPage)) + `,
 	"size":` + fmt.Sprintf("%v", perPage) +
 			`,"sort":[` + sort + `] }`
@@ -321,6 +321,7 @@ func wxsearhWebContentent(querymap map[string]string, n *Wxsearch, reqType strin
 
 			EntName, _ := res[i]["EntName"].(string)
 			tmpNo := res[i]["EntType"]
+			res[i]["EntTypeCopy"] = tmpNo
 			res[i]["RegCapEntType"] = tmpNo
 			if tmpNo != nil {
 				switch tmpNo.(string) {
@@ -423,7 +424,7 @@ func wxsearhWebContententMp(querymap map[string]string, n *Wxsearch, reqType str
 	    "_source": [
 	        "_id","EntName","RegOrgName","RegNo","EntType",
 	        "LeRep","EstDate","OpLocDistrictName","OpStateName",
-	        "s_servicenames","s_action","OpLocDistrict","s_submitid","excDirect"
+	        "s_servicenames","s_action","OpLocDistrict","s_submitid","Ycml"
 	    ],
 	    "from": 0,"size": 10,
 	    "sort": [{"OpSint": "desc","RegCap": "desc"}]
@@ -501,7 +502,7 @@ func wxsearhWebContententMp(querymap map[string]string, n *Wxsearch, reqType str
 				res[i]["stock"] = template.HTML(stock)
 			}
 			tmpdate, _ := res[i]["EstDate"]
-			if tmpdate != nil {
+			if tmpdate != nil && IntAll(tmpdate) != 0 {
 				res[i]["EstDate"] = FormatDateWithObj(&tmpdate, Date_Short_Layout)
 			} else {
 				res[i]["EstDate"] = ""

+ 65 - 19
core/src/qfw/yellowpage/yellowpagemanager.go

@@ -48,7 +48,7 @@ func FormatDate(src *interface{}) string {
 }
 
 func GetEntInfo(id string) map[string]interface{} {
-	res := mongodbutil.FindById("enterprise", cf.SysConfig.EntMongodbAlias, cf.SysConfig.EntMongodbName, id, `{"RegNo":1, "EntName":1, "EntType":1, "EntTypeName":1, "OpLocDistrict":1, "LeRep":1, "LegCerNO":1, "Tel":1, "Dom":1, "OpScope":1, "OpFrom":1, "OpTo":1, "RegCap":1, "EstDate":1, "CompForm":1, "CompFormName":1, "OpState":1, "OpStateName":1, "RegOrgName":1, "IssBLicDate":1, "Timestamp":1,"SourceType":1, "Nb_email":1,"IndustryPhyName":1,"investor":1,"alterInfo":1,"staffinfo":1,"RegCapCurName":1,"excDirect":1}`)
+	res := mongodbutil.FindById("enterprise", cf.SysConfig.EntMongodbAlias, cf.SysConfig.EntMongodbName, id, `{"RegNo":1, "EntName":1, "EntType":1, "EntTypeName":1, "OpLocDistrict":1, "LeRep":1, "LegCerNO":1, "Tel":1, "Dom":1, "OpScope":1, "OpFrom":1, "OpTo":1, "RegCap":1, "EstDate":1, "CompForm":1, "CompFormName":1, "OpState":1, "OpStateName":1, "RegOrgName":1, "IssBLicDate":1, "Timestamp":1,"SourceType":1, "Nb_email":1,"IndustryPhyName":1,"investor":1,"alterInfo":1,"staffinfo":1,"RegCapCurName":1,"Ycml":1,"i_scale":1}`)
 	if res != nil && len(*res) > 0 {
 		opl, _ := (*res)["OpLocDistrict"].(string)
 		if len(opl) >= 2 {
@@ -67,17 +67,18 @@ func GetEntInfo(id string) map[string]interface{} {
 			(*res)["OpFrom"] = FormatDate(&OpFrom)
 		}
 		OpTo := (*res)["OpTo"]
-		if OpFrom != nil {
+		if OpTo != nil {
 			(*res)["OpTo"] = FormatDate(&OpTo)
 		}
 		IssBLicDate := (*res)["IssBLicDate"]
-		if OpFrom != nil {
+		if IssBLicDate != nil {
 			(*res)["IssBLicDate"] = FormatDate(&IssBLicDate)
 		}
 		EstDate := (*res)["EstDate"]
-		if OpFrom != nil {
+		if EstDate != nil {
 			(*res)["EstDate"] = FormatDate(&EstDate)
 		}
+		(*res)["EntTypeCopy"] = (*res)["EntType"]
 		var EntType string
 		if (*res)["EntType"] != nil && (*res)["EntType"].(string) != "" {
 			EntType = (*res)["EntType"].(string)
@@ -323,22 +324,67 @@ func findRelation(certype, cerno, name, rtype string, level int, ls *list.List,
 
 //存储节点,只关心3个元素,节点名称、节点id、关系节点id
 func storeNode(data *map[string]interface{}, ls *list.List, dir /*方向反转*/ bool, level int) {
-	invtype := fmt.Sprint((*data)["invtype"])
+	invtype := ""
+	if (*data)["invtype"] != nil {
+		invtype = fmt.Sprint((*data)["invtype"])
+	}
 	//invcertype, _ := (*data)["invcertype"].(string)
-	invcerno := fmt.Sprint((*data)["invcerno"])
-	invname := fmt.Sprint((*data)["invname"])
-	entregno := fmt.Sprint((*data)["entregno"])
-	entname := fmt.Sprint((*data)["entname"])
-	invweight := fmt.Sprint((*data)["weight"])
-	invacconam := fmt.Sprint((*data)["invacconam"])
-	regcap := fmt.Sprint((*data)["regcap"])
-	invregcap := fmt.Sprint((*data)["invregcap"])
-	legcerno := fmt.Sprint((*data)["legcerno"])
-	opstate := fmt.Sprint((*data)["opstate"])
-	invopstate := fmt.Sprint((*data)["invopstate"])
-	regcapcurname := fmt.Sprint((*data)["regcapcurname"])
-	shortname := fmt.Sprint((*data)["shortname"])
-	entmid := util.BsonIdToSId((*data)["entmid"])
+	invcerno := ""
+	if (*data)["invcerno"] != nil {
+		invcerno = fmt.Sprint((*data)["invcerno"])
+	}
+	invname := ""
+	if (*data)["invname"] != nil {
+		invname = fmt.Sprint((*data)["invname"])
+	}
+	entregno := ""
+	if (*data)["entregno"] != nil {
+		entregno = fmt.Sprint((*data)["entregno"])
+	}
+	entname := ""
+	if (*data)["entname"] != nil {
+		entname = fmt.Sprint((*data)["entname"])
+	}
+	invweight := "0"
+	if (*data)["weight"] != nil {
+		invweight = fmt.Sprint((*data)["weight"])
+	}
+	invacconam := "0"
+	if (*data)["invacconam"] != nil {
+		invacconam = fmt.Sprint((*data)["invacconam"])
+	}
+	regcap := "0"
+	if (*data)["regcap"] != nil {
+		regcap = fmt.Sprint((*data)["regcap"])
+	}
+	invregcap := "0"
+	if (*data)["invregcap"] != nil {
+		invregcap = fmt.Sprint((*data)["invregcap"])
+	}
+	legcerno := ""
+	if (*data)["legcerno"] != nil {
+		legcerno = fmt.Sprint((*data)["legcerno"])
+	}
+	opstate := ""
+	if (*data)["opstate"] != nil {
+		opstate = fmt.Sprint((*data)["opstate"])
+	}
+	invopstate := ""
+	if (*data)["invopstate"] != nil {
+		invopstate = fmt.Sprint((*data)["invopstate"])
+	}
+	regcapcurname := ""
+	if (*data)["regcapcurname"] != nil {
+		regcapcurname = fmt.Sprint((*data)["regcapcurname"])
+	}
+	shortname := ""
+	if (*data)["shortname"] != nil {
+		shortname = fmt.Sprint((*data)["shortname"])
+	}
+	entmid := ""
+	if (*data)["entmid"] != nil {
+		entmid = util.BsonIdToSId((*data)["entmid"])
+	}
 	ls.PushBack([]string{invtype, invcerno, invname, entregno, entname, strconv.Itoa(level), invweight, invacconam, regcap, invregcap, legcerno, opstate, invopstate, regcapcurname, util.BsonIdToSId((*data)["_id"]), shortname, entmid})
 }
 

+ 1 - 1
core/src/timetask.json

@@ -1 +1 @@
-{"comment":{"c_rate":720,"commentrate":900},"market":{"demand":{"attr":["i_hits","i_bids","i_status"],"timepoint":"2016-06-13 10:20:06"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-06-13 10:20:06"}},"marketisstart":true,"marketrate":300}
+{"comment":{"c_rate":720,"commentrate":900},"market":{"demand":{"attr":["i_hits","i_bids","i_status"],"timepoint":"2016-07-01 08:21:25"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-07-01 08:21:25"}},"marketisstart":true,"marketrate":300}

BIN
core/src/web/staticres/images/swordfish/sf_01.jpg


+ 7 - 0
core/src/web/staticres/js/qfw.js

@@ -751,6 +751,13 @@ function processAlterInfo(alterInfo){
 			altDate = $.trim(altDate);
 			if(altDate == "" || altDate == "null" || altDate == "空"){
 				altDate = null;
+			}else{
+				var altDateTmp = altDate;
+				try{
+					altDate = new Date(altDate).FormatEnhance("yyyy-mm-dd HH:MM:ss");
+				 }catch(e){
+					altDate = altDateTmp;
+				 }
 			}
 		}
 		object.AltDate = altDate;

+ 45 - 1
core/src/web/staticres/wxswordfish/style.css

@@ -706,4 +706,48 @@ img{
 	top: 0px;
 	bottom: 0px;
 	display: none;
-}
+}
+.hidden{
+	display:none;
+}
+.text-center{
+	text-align:center;
+}
+.sf_promptone{
+	padding:40px 20px 0px 10px;
+}
+.sf_promptone div{
+	width:100%;
+}
+.sf_font1{
+	color:#999;
+	text-align:left;
+}
+.sf_promptone img{
+	width: 60%;
+}
+.sf_button span{
+    border: 1px solid #24C0D7;
+    display: inline-block;
+    width: 20%;
+    padding: 7px;
+    border-radius: 6px;
+	margin-bottom:20px;
+}
+.sf_tis{
+	text-align:center;
+	padding:20px;
+}
+.sf_tis img{
+	text-align:center;
+	width:60%;
+}
+.sf_mc a{
+	text-decoration:none;
+	color:blue;
+}
+
+
+
+
+

+ 3 - 3
core/src/web/templates/enterprise/detail.html

@@ -204,7 +204,7 @@
 							<span>
 								<div>
 									<span id="entinfo-status" class="entinfo-status">
-										{{if .T.res.excDirect}}
+										{{if .T.res.Ycml}}
 										<span class="ent-exception">经营异常</span>
 										{{end}}
 									</span>
@@ -284,8 +284,8 @@
 					  	<div class="entinfo-entscale">
 							<img src="{{Msg "seo" "cdn"}}/images/entcommunity/rens.png">
 							<div>
-								<span class="entinfo-disabled">公司规模</span>
-								<span></span>
+								<span{{if not .T.res.i_scale}} class="entinfo-disabled"{{end}}>公司规模</span>
+								<span>{{if .T.res.i_scale}}{{.T.res.i_scale}}人{{end}}</span>
 							</div>
 						</div>
 						<a class="entinfo-entscale-round"></a>

+ 5 - 5
core/src/web/templates/member/incmobile/baseinfo.html

@@ -91,13 +91,13 @@
 			</div>
 			<span class="col-xs-7 entvar ">{{if .T.res.RegOrgName}}{{.T.res.RegOrgName}}{{else}}空{{end}}</span>
 		</li>
-<!--		<li>
+		<li>
 			<div class="col-xs-5">
-				<span class="glyphicon glyphicon-flag colorc"></span>
-				<span class="ent entnull">公司规模</span>
+				<img src="{{Msg "seo" "cdn"}}/images/entcommunity/rens.png"  width=23 />
+				<span class="ent {{if not .T.res.i_scale}}entnull{{end}}">公司规模</span>
 			</div>
-			<span class="col-xs-7 entvar">空</span>
-		</li>-->
+			<span class="col-xs-7 entvar">{{if .T.res.i_scale}}{{.T.res.i_scale}}人{{else}}{{end}}</span>
+		</li>
 		<li>
 			<div class="col-xs-12">
 				<img src="{{Msg "seo" "cdn"}}/images/entcommunity/ren.png"  width=23 />

+ 1 - 1
core/src/web/templates/member/incmobile/detailindex.html

@@ -129,7 +129,7 @@
 					
 				</script>
 				</div>
-				{{if .T.res.excDirect}}<span class="excDirect">经营异常</span>{{end}}
+				{{if .T.res.Ycml}}<span class="excDirect">经营异常</span>{{end}}
 			</div>
 		</div>
 		<div class="col-xs-12 index-middle">

+ 4 - 4
core/src/web/templates/member/incmobile/list.html

@@ -154,7 +154,7 @@
 		var data={{.T.data}}
 		var entcard={{.T.querymap.entcard}};
 		var strVar = "";
-		strVar += "<li class=\"col-xs-12\"><table align=\"center\"><caption><div class=\"left\"><a href=\"/enterprise/$Id.html\">$EntName</a><b class=\"$status\" style='display:inline-block;'>$OpStateName<\/b><b class=\"$excClass\" style='display:inline-block;'>$excDirect<\/b><\/div><div style='float:right;margin-right:10px;' data-id='$Id' onclick='follow(this)'><i class='glyphicon $gz' style=\"font-size:11px;\">&nbsp;<\/i><span>$gzt</span><\/div><\/caption><tr><td class=\"left\">注册号:<span>$RegNo<\/span><\/td><td align='right'>法定代表人:<span>$LeRep<\/span><\/td><\/tr><tr><td class=\"left\">成立时间:<span>$EstDate<\/span><\/td><td align='right'>所在地:<span>$OpLocDistrict<\/span><\/td><\/tr><tr><td colspan=\"2\"><hr class=\"list\"><\/td><\/tr><\/table><\/li>";
+		strVar += "<li class=\"col-xs-12\"><table align=\"center\"><caption><div class=\"left\"><a href=\"/enterprise/$Id.html\">$EntName</a><b class=\"$status\" style='display:inline-block;'>$OpStateName<\/b><b class=\"$excClass\" style='display:inline-block;'>$Ycml<\/b><\/div><div style='float:right;margin-right:10px;' data-id='$Id' onclick='follow(this)'><i class='glyphicon $gz' style=\"font-size:11px;\">&nbsp;<\/i><span>$gzt</span><\/div><\/caption><tr><td class=\"left\">注册号:<span>$RegNo<\/span><\/td><td align='right'>法定代表人:<span>$LeRep<\/span><\/td><\/tr><tr><td class=\"left\">成立时间:<span>$EstDate<\/span><\/td><td align='right'>所在地:<span>$OpLocDistrict<\/span><\/td><\/tr><tr><td colspan=\"2\"><hr class=\"list\"><\/td><\/tr><\/table><\/li>";
 		function loadData(){
 			   var li="";
 				var len=i+5;
@@ -178,8 +178,8 @@
 											 .replace("$RegNo",data[i]["RegNo"])
 											 .replace("$LeRep",data[i]["LeRep"])
 											 .replace("$OpLocDistrict",data[i]["OpLocDistrict"])
-											 .replace("$EstDate",data[i]["EstDate"]=="1970-01-01"?"":data[i]["EstDate"])
-											 .replace("$excDirect",data[i]["excDirect"]=="true"?"经营异常":"$excDirect")
+											 .replace("$EstDate",data[i]["EstDate"])
+											 .replace("$Ycml",data[i]["Ycml"]=="true"?"经营异常":"$Ycml")
 											 .replace("$Id",data[i]["_id"])
 											 .replace("$Id",data[i]["_id"])
 											 .replace("$OpStateName",data[i]["OpStateName"]=="<nil>"?"":data[i]["OpStateName"].substr(0,2));
@@ -188,7 +188,7 @@
 					}else{
 						tmp=tmp.replace("$status","ent-status-g");
 					}
-					tmp=tmp.replace("<b class=\"$excClass\" style='display:inline-block;'>$excDirect<\/b>","");
+					tmp=tmp.replace("<b class=\"$excClass\" style='display:inline-block;'>$Ycml<\/b>","");
 					tmp=tmp.replace("$excClass","excDirect");
 					if(data[i]["status"]=="y"){
 						tmp=tmp.replace("$gz","yiguanzhu").replace("$gzt","已关注");	

+ 1 - 1
core/src/web/templates/search/enterpriseList.html

@@ -89,7 +89,7 @@
 									</script>
 									</span>
 									{{end}}
-									{{if $v.excDirect}}
+									{{if $v.Ycml}}
 									<span class="margin-l-5 ent-exception">经营异常</span>
 									{{end}}
 									{{ if index $v "s_action"}}

+ 39 - 0
core/src/web/templates/swordfish/wxex.html

@@ -0,0 +1,39 @@
+<html>
+<head>
+<title>企明星-剑鱼-提醒页面</title>
+<meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1" />
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<meta name="renderer" content="webkit">
+<link href="{{Msg "seo" "cdn"}}/wxswordfish/style.css" rel="stylesheet">
+<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
+<script src="{{Msg "seo" "cdn"}}/js/jquery.js"></script>
+<script>
+	var newsubscribe = {{.T.newsubscribe}};
+	$(function(){
+		if (newsubscribe == "Y"){	
+		window.location.href="http://mp.weixin.qq.com/s?__biz=MzIyNTM1NDUyNw==&mid=100000024&idx=1&sn=c2f4271a361bfb90b22abb1d6818accc#rd";
+		return false;
+		}else{
+			$(".sf_promptone").removeClass("hidden");
+		};
+		$(".sf_button").click(function(){
+			window.location.href="/swordfish/page";
+		});
+	})
+</script>
+</head>
+<body>
+<div class="sf_promptone text-center hidden">
+
+<div class="sf_font1">  为了提供更好的服务,剑鱼招标订阅开通了独立的微信公众号,企明星公众号中的剑鱼很快将不再更新。</div>
+<br>
+<div>请长按下面的图片、选择“识别二维码”。</div>
+<div><img src="/images/swordfish/sf_01.jpg" alt="剑鱼招标订阅微信公众号"></div>
+<div>关注“剑鱼招标订阅”</div>
+<br>
+<div class="sf_font1">  您不用担心原订阅记录会消失,只要扫码关注新服务号,订阅关键词依然还在,招标信息将会通过新号继续向您推送,使用剑鱼将不再消耗积分。您在启用新服务号并成功订阅后,原“企明星”的订阅服务将会自动关闭。</div>
+<br>
+<div class="sf_button text-center"><span>跳 过</span></div>
+</div>
+</body>
+</html>

+ 11 - 0
core/src/web/templates/swordfish/wxpush.html

@@ -177,6 +177,17 @@ a{
 </style>
 </head>
 <body>
+<div class="sf_tis">
+<div>长按图片、选择“识别二维码”</div>
+<br>
+<div>关注“剑鱼招标订阅”</div>
+<div><img src="/images/swordfish/sf_01.jpg"/></div>
+<br>
+<div style="text-align:left;">  您不用担心原订阅记录会消失,只要扫码关注新服务号,订阅关键词依然还在,招标信息将会通过新号继续向您推送,使用剑鱼将不再消耗积分。您在启用新服务号并成功订阅后,原“企明星”的订阅服务将会自动关闭。</div>
+
+
+
+</div>
 {{include "/swordfish/wxtoolbar.html"}}
 {{include "/common/baiducc.html"}}
 </body>

+ 2 - 2
core/src/web/templates/swordfish/wxrssset.html

@@ -21,8 +21,8 @@ if(sessionStorage&&sessionStorage.version=="1"){
 <script>
 	var msgset= {{.T.msgset}};
 	initShare({{.T.signature}},{{.T.shareid}});
-	var searchname = {{.T.searchname}}
-	var s_type = {{.T.s_type}}
+	var searchname = {{.T.searchname}};
+	var s_type = {{.T.s_type}};
 </script>
 </head>
 <body>

+ 1 - 2
push/src/config.json

@@ -1,2 +1 @@
-{"bid":{"interval":60,"lastpushtime":"2015-10-10 10:10:10"},"bidStartTime":"2015-12-30 17:28:48","bidTitle":"亲!剑鱼为您速报最新鲜的中标信息啦","bidViewDomain":"192.168.3.132","durationMinutes":10,"fixPush":"oJULtwzXo6EFV1Ah-XeyRBimXGM8","mail_bid":"\u003cdiv\u003e%s\u003c/div\u003e,想了解更多信息,请访问http://www.qimingxing.info。","maxPushSize":50,"mgoAddr":"192.168.3.18:27080","mgoSize":10,"province":{"上海":9,"云南":25,"内蒙古":5,"北京":1,"台湾":32,"吉林":7,"四川":13,"天津":2,"宁夏":30,"安徽":12,"山东":15,"山西":4,"广东":19,"广西":20,"新疆":31,"江苏":10,"江西":14,"河北":3,"河南":16,"浙江":11,"海南":21,"湖北":17,"湖南":18,"澳门":34,"甘肃":28,"福建":13,"西藏":26,"贵州":24,"辽宁":6,"重庆":22,"陕西":27,"青海":29,"香港":33,"黑龙江":8},"pushInfoScopeDays":50,"rpcPort":"8766","smtpAddr":"smtp.exmail.qq.com","smtpFromUser":"企明星","smtpPort":465,"smtpPwd":"qy123456","smtpUser":"qyfw@topnet.net.cn","tenderStartTime":"2016-05-25 18:10:19","tenderTitle":"亲!剑鱼为您速报最新鲜的招标信息啦","weixinRpcServer":"127.0.0.1:82","weixin_bid":"\u003cdiv\u003e%s最新招标信息\u003c/div\u003e\u003cdiv\u003e%s\u003c/div\u003e","wxRpcRemark":"请到网站个人中心查看详细."}
-
+{"bid":{"interval":60,"lastpushtime":"2015-10-10 10:10:10"},"bidStartTime":"2016-05-26 00:00:00","bidTitle":"亲!剑鱼为您速报最新鲜的中标信息啦","bidViewDomain":"192.168.3.132","durationMinutes":10,"fixPush":"oJULtwzXo6EFV1Ah-XeyRBimXGM8","mail_bid":"\u003cdiv\u003e%s\u003c/div\u003e,想了解更多信息,请访问http://www.qimingxing.info。","maxPushSize":50,"mgoAddr":"192.168.3.18:27080","mgoSize":10,"province":{"上海":9,"云南":25,"内蒙古":5,"北京":1,"台湾":32,"吉林":7,"四川":13,"天津":2,"宁夏":30,"安徽":12,"山东":15,"山西":4,"广东":19,"广西":20,"新疆":31,"江苏":10,"江西":14,"河北":3,"河南":16,"浙江":11,"海南":21,"湖北":17,"湖南":18,"澳门":34,"甘肃":28,"福建":13,"西藏":26,"贵州":24,"辽宁":6,"重庆":22,"陕西":27,"青海":29,"香港":33,"黑龙江":8},"pushInfoScopeDays":50,"rpcPort":"8766","smtpAddr":"smtp.exmail.qq.com","smtpFromUser":"企明星","smtpPort":465,"smtpPwd":"qy123456","smtpUser":"qyfw@topnet.net.cn","tenderStartTime":"2016-05-30 17:07:34","tenderTitle":"亲!剑鱼为您速报最新鲜的招标信息啦","weixinRpcServer":"127.0.0.1:82","weixin_bid":"\u003cdiv\u003e%s最新招标信息\u003c/div\u003e\u003cdiv\u003e%s\u003c/div\u003e","wxRpcRemark":"请到网站个人中心查看详细."}

+ 2 - 1
push/src/qfw/push/dopush/dopush.go

@@ -392,7 +392,8 @@ func SendWeixin(k *push.MemberInterest, TITLE, ShortTitle, str, stype string, no
 		wxDate = time.Now().Local().Add(time.Duration(-n2) * time.Second).Add(time.Duration(-n1*24) * time.Hour).Format(util.Date_Full_Layout)
 	}
 
-	wxstr := "\n点击下方“详情”查看详细信息。\n以上" + ShortTitle + "信息,是剑鱼根据关键字“" + strings.Join(k.Interest, ";") + "”奋力查找并推送,如不合您心意,请猛戳企明星菜单“剑鱼”进行修改。"
+	//wxstr := "\n点击下方“详情”查看详细信息。\n以上" + ShortTitle + "信息,是剑鱼根据关键字“" + strings.Join(k.Interest, ";") + "”奋力查找并推送,如不合您心意,请猛戳企明星菜单“剑鱼”进行修改。"
+	wxstr := "\n为了提供更好的服务,剑鱼招标订阅开通了独立的微信公众号,企明星公众号中的剑鱼很快将不再更新,点击“详情”可关注公众号“剑鱼招标订阅”。感谢您的支持!"
 	push.SendWinXin(&qrpc.NotifyMsg{
 		Openid:  k.Openid,
 		Title:   push.PushConfig[stype+"Title"].(string),

+ 1 - 1
weixin/src/qfw/weixin/dao/userdao.go

@@ -92,7 +92,7 @@ func AddUser(openid, unionid, bindweixin, userphoto string) (err error, flag int
 	} else {
 		log.Println("update user:", userphoto)
 		//已经注册过
-		Update("user", M{"s_unionid": unionid, "i_type": 3}, `{"$set":{"s_m_openid":"`+openid+`","s_avatar":"`+userphoto+`"}}`, true, false)
+		Update("user", M{"s_m_openid": openid}, `{"$set":{"s_avatar":"`+userphoto+`"}}`, true, false)
 		return errors.New("该微信号已经注册过"), 0
 	}
 }

+ 1 - 2
weixin/src/qfw/weixin/distinguishwork.go

@@ -49,8 +49,7 @@ func init() {
 }
 
 func InitDgWork() {
-	client, _ = util.StartClient(processevent, wf.SysConfig.Msgserver, []int{util.SERVICE_DISTINGUISH}, 20)
-	client.ResetMyName("识别验证码")
+	client, _ = util.StartClient(processevent, wf.SysConfig.Msgserver, "识别验证码", []int{util.SERVICE_DISTINGUISH})
 }
 func processevent(p *util.Packet) {
 	event := int(p.Event)