Преглед на файлове

Merge branch 'develop' of 192.168.3.17:zhanghongbo/qfw into develop

wangshan преди 9 години
родител
ревизия
79f0b7bd98

+ 12 - 1
core/src/config.json

@@ -37,5 +37,16 @@
 	"entMongodbPoolSize": 5,
     "entMongodbName": "qfw",
 	"entMongodbAlias":"B",
-	"followEnterprise":10
+	"followEnterprise":10,
+	"atrrTitle": {
+        "s_persion": [0,99],
+        "s_mobile": [1,99],
+        "s_email": [2,99],
+        "s_enturl": [3,99],
+        "s_address": [4,99],
+        "i_scale": [5,99],
+        "s_descript": [6,99],
+        "s_industry": [7,99],
+		"s_avatar": [8,99]
+    }
 }

+ 28 - 27
core/src/qfw/coreconfig/SysConfig.go

@@ -5,33 +5,34 @@ package coreconfig
 
 //系统配置
 type config struct {
-	Webserverport      string      `json:"webServerPort"` //web服务器端口
-	Redisservers       string      `json:"redisServers"`  //redis缓存服务器列表
-	Useredis           bool        `json:"useRedis"`
-	Mongodbservers     string      `json:"mongodbServers"` //mongodb节点
-	MongodbPoolSize    int         `json:"mongodbPoolSize"`
-	MongodbName        string      `json:"mongodbName"`
-	Elasticsearch      string      `json:"elasticsearch"`
-	Smtp               smtp        `json:"smtp"`
-	Sms                sms         `json:"sms"`
-	Entrelation        entrelation `json:"entrelation”`
-	Allownfiletype     string      `json:"allownfiletype"`
-	Filesize           int         `json:"filesize"`
-	TemplateCache      bool        `json:"templateCache"`
-	HttpCache          bool        `json:"httpCache"`
-	MailFailureTime    int         `json:"mailFailureTime"`
-	ChatServer         string      `json:"chatServer"`
-	ChatRpc            string      `json:"chatRpc"`
-	PushRpc            string      `json:"pushRpc"`
-	ElasticPoolSize    int         `json:"elasticPoolSize"`
-	Ocr_uid            string      `json:"orc_uid"`
-	Ocr_servicekey     string      `json:"ocr_servicekey"`
-	Ocr_servicecode    string      `json:"ocr_servicecode"`
-	EntMongodbservers  string      `json:"entMongodbServers"` //mongodb节点
-	EntMongodbPoolSize int         `json:"entMongodbPoolSize"`
-	EntMongodbName     string      `json:"entMongodbName"`
-	EntMongodbAlias    string      `json:"entMongodbAlias"`
-	FollowEnterprise   int         `json:"followEnterprise"`
+	Webserverport      string                 `json:"webServerPort"` //web服务器端口
+	Redisservers       string                 `json:"redisServers"`  //redis缓存服务器列表
+	Useredis           bool                   `json:"useRedis"`
+	Mongodbservers     string                 `json:"mongodbServers"` //mongodb节点
+	MongodbPoolSize    int                    `json:"mongodbPoolSize"`
+	MongodbName        string                 `json:"mongodbName"`
+	Elasticsearch      string                 `json:"elasticsearch"`
+	Smtp               smtp                   `json:"smtp"`
+	Sms                sms                    `json:"sms"`
+	Entrelation        entrelation            `json:"entrelation”`
+	Allownfiletype     string                 `json:"allownfiletype"`
+	Filesize           int                    `json:"filesize"`
+	TemplateCache      bool                   `json:"templateCache"`
+	HttpCache          bool                   `json:"httpCache"`
+	MailFailureTime    int                    `json:"mailFailureTime"`
+	ChatServer         string                 `json:"chatServer"`
+	ChatRpc            string                 `json:"chatRpc"`
+	PushRpc            string                 `json:"pushRpc"`
+	ElasticPoolSize    int                    `json:"elasticPoolSize"`
+	Ocr_uid            string                 `json:"orc_uid"`
+	Ocr_servicekey     string                 `json:"ocr_servicekey"`
+	Ocr_servicecode    string                 `json:"ocr_servicecode"`
+	EntMongodbservers  string                 `json:"entMongodbServers"` //mongodb节点
+	EntMongodbPoolSize int                    `json:"entMongodbPoolSize"`
+	EntMongodbName     string                 `json:"entMongodbName"`
+	EntMongodbAlias    string                 `json:"entMongodbAlias"`
+	FollowEnterprise   int                    `json:"followEnterprise"`
+	AtrrTitle          map[string]interface{} `json:"atrrTitle"`
 }
 type smtp struct {
 	Addr     string `json:"addr"`

+ 21 - 0
core/src/qfw/member/yellowpage.go

@@ -5,6 +5,7 @@
 package member
 
 import (
+	"encoding/hex"
 	"fmt"
 	"github.com/go-xweb/xweb"
 	"gopkg.in/mgo.v2/bson"
@@ -92,6 +93,26 @@ func (yp *Yellowpage) Save() error {
 		area, _ := yp.GetInt("i_area")
 		data["i_area"] = area
 		data["s_address"] = Repl(yp.GetString("s_address"))
+		//权重
+		atrrTitle := coreconfig.SysConfig.AtrrTitle
+		web := mongodb.FindById(ESTYPE, entid, `{"_id":-1,"attrWeight":1}`)
+		var attrWeight []byte
+		if tmp, ok := (*web)["attrWeight"].(string); ok {
+			attrWeight, _ = hex.DecodeString(tmp)
+		} else {
+			attrWeight = make([]byte, 30)
+		}
+		for k, v := range atrrTitle {
+			arr, _ := v.([]interface{})
+			index := util.IntAll(arr[0])
+			weight := util.IntAll(arr[1])
+			if weight < int(attrWeight[index]) {
+				delete(data, k)
+			} else {
+				attrWeight[index] = byte(weight)
+			}
+		}
+		data["attrWeight"] = hex.EncodeToString(attrWeight)
 		dataSet := map[string]interface{}{
 			"$set": data,
 		}

+ 35 - 7
core/src/qfw/microwebsite/microwebsite.go

@@ -6,10 +6,12 @@ package microwebsite
 
 import (
 	"encoding/base64"
+	"encoding/hex"
 	"encoding/json"
 	"github.com/go-xweb/xweb"
 	. "gopkg.in/mgo.v2/bson"
 	. "qfw/coreconfig"
+	coreconfig "qfw/coreconfig"
 	. "qfw/util"
 	elastic "qfw/util/elastic"
 	"qfw/util/fsw"
@@ -237,11 +239,12 @@ func (m *MicroWebsite) AjaxPorcess() error {
 			entObj["s_synopsis"] = fsw.Repl(m.GetStringComm("s_synopsis")) //修改企业简介
 			break
 		}
-		if len(entObj) > 0 {
-			Update("enterprise", "{'_id':'"+entId+"'}", M{"$set": entObj}, false, false)
-		}
+		setAttrWeight(entId, entObj)
 		//修改企业信息
-		elastic.UpdateEntDoc(entId) //更新该企业的elastic数据
+		if len(entObj) > 0 && Update("enterprise", "{'_id':'"+entId+"'}", M{"$set": entObj}, false, false) {
+			redis.Del("enterprise", "enterpriseInfo_"+entId) //清除该企业的redis缓存
+			elastic.UpdateEntDoc(entId)                      //更新该企业的elastic数据
+		}
 	} else if reqType == "addService" {
 		tempId := m.GetString("tempId")
 		serviceObj := make(M)
@@ -307,9 +310,12 @@ func (m *MicroWebsite) AjaxPorcess() error {
 		} else {
 			field = "s_qrcode"
 		}
-		b := Update("enterprise", "{'_id':'"+entId+"'}", M{"$set": M{field: m.GetString("src")}}, false, false)
+		data := M{field: m.GetString("src")}
+		setAttrWeight(entId, data)
+		b := Update("enterprise", "{'_id':'"+entId+"'}", M{"$set": data}, false, false)
 		if b {
-			elastic.UpdateEntDoc(entId) //更新该企业的elastic数据
+			redis.Del("enterprise", "enterpriseInfo_"+entId) //清除该企业的redis缓存
+			elastic.UpdateEntDoc(entId)                      //更新该企业的elastic数据
 			result["status"] = "y"
 		}
 	} else if reqType == "serviceImg" { //修改服务图片
@@ -321,7 +327,29 @@ func (m *MicroWebsite) AjaxPorcess() error {
 			result["status"] = "y"
 		}
 	}
-	redis.Del("enterprise", "enterpriseInfo_"+entId) //清除该企业的redis缓存
 	m.ServeJson(result)
 	return nil
 }
+
+//权重
+func setAttrWeight(entid string, data M) {
+	atrrTitle := coreconfig.SysConfig.AtrrTitle
+	web := FindById("enterprise", entid, `{"_id":-1,"attrWeight":1}`)
+	var attrWeight []byte
+	if tmp, ok := (*web)["attrWeight"].(string); ok {
+		attrWeight, _ = hex.DecodeString(tmp)
+	} else {
+		attrWeight = make([]byte, 30)
+	}
+	for k, v := range atrrTitle {
+		arr, _ := v.([]interface{})
+		index := IntAll(arr[0])
+		weight := IntAll(arr[1])
+		if weight < int(attrWeight[index]) {
+			delete(data, k)
+		} else {
+			attrWeight[index] = byte(weight)
+		}
+	}
+	data["attrWeight"] = hex.EncodeToString(attrWeight)
+}

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

@@ -6,7 +6,6 @@ import (
 	"github.com/go-xweb/xweb"
 	"github.com/p/mahonia"
 	"html/template"
-	"log"
 	"qfw/coreutil"
 	"qfw/mobile"
 	. "qfw/util"
@@ -90,14 +89,13 @@ func FormatData(data *[]map[string]interface{}, action *xweb.Action) string {
 			"EstDate":       estDate,
 			"OpStateName":   fmt.Sprint(v["OpStateName"]),
 			"status":        "n",
+			"excDirect":     fmt.Sprint(v["excDirect"]),
 		}
 		//是否关注
 		entId := tmp["_id"]
 		userId := action.GetSession("userId").(string)
 		if userId != "" {
-			log.Println(userId)
 			if Count("follow_enterprise", `{"s_userid":"`+userId+`","s_entid":"`+entId+`"}`) > 0 {
-				log.Println("进入")
 				tmp["status"] = "y"
 			}
 		}
@@ -384,7 +382,7 @@ func wxsearhWebContentent(querymap map[string]string, n *Wxsearch, reqType strin
 			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"] = ""
@@ -425,7 +423,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"
+	        "s_servicenames","s_action","OpLocDistrict","s_submitid","excDirect"
 	    ],
 	    "from": 0,"size": 10,
 	    "sort": [{"OpSint": "desc","RegCap": "desc"}]

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

@@ -87,6 +87,9 @@
 			margin-left: 5px;
 			font-weight: normal;
 			background-color: #fff;
+			position: relative;
+			top: 5px;
+			display: inline-block;
 		}
 	</style>
  </head>

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

@@ -155,7 +155,6 @@
 		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>";
-		
 		function loadData(){
 			   var li="";
 				var len=i+5;
@@ -179,17 +178,16 @@
 											 .replace("$RegNo",data[i]["RegNo"])
 											 .replace("$LeRep",data[i]["LeRep"])
 											 .replace("$OpLocDistrict",data[i]["OpLocDistrict"])
-											 .replace("$EstDate",data[i]["EstDate"])
-											 .replace("$excDirect",data[i]["excDirect"]?"经营异常":"$excDirect")
+											 .replace("$EstDate",data[i]["EstDate"]=="1970-01-01"?"":data[i]["EstDate"])
+											 .replace("$excDirect",data[i]["excDirect"]=="true"?"经营异常":"$excDirect")
 											 .replace("$Id",data[i]["_id"])
 											 .replace("$Id",data[i]["_id"])
-											 .replace("$OpStateName",data[i]["OpStateName"].substr(0,2));
+											 .replace("$OpStateName",data[i]["OpStateName"]=="<nil>"?"":data[i]["OpStateName"].substr(0,2));
 					if (data[i].OpStateName!="存续"&&data[i].OpStateName.indexOf("在营")==-1){
 						 tmp=tmp.replace("$status","ent-status-r");
 					}else{
 						tmp=tmp.replace("$status","ent-status-g");
 					}
-					console.info(tmp);
 					tmp=tmp.replace("<b class=\"$excClass\" style='display:inline-block;'>$excDirect<\/b>","");
 					tmp=tmp.replace("$excClass","excDirect");
 					if(data[i]["status"]=="y"){