Переглянути джерело

Merge branch 'develop' into release

wangchuanjin 9 роки тому
батько
коміт
315d21ee27

+ 34 - 20
core/src/qfw/member/yellowpage.go

@@ -94,25 +94,7 @@ func (yp *Yellowpage) Save() error {
 		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)
+		setAttrWeight(entid, data, false)
 		dataSet := map[string]interface{}{
 			"$set": data,
 		}
@@ -219,7 +201,11 @@ func (yp *Yellowpage) UpLoadEntImg() error {
 	} else {
 		field = "s_qrcode"
 	}
-	bol := mongodb.Update("enterprise", "{'_id':'"+entid+"'}", map[string]interface{}{"$set": map[string]interface{}{field: yp.GetString("url")}}, false, false)
+	data := bson.M{field: yp.GetString("url")}
+	if field == "s_avatar" {
+		setAttrWeight(entid, data, true)
+	}
+	bol := mongodb.Update("enterprise", "{'_id':'"+entid+"'}", map[string]interface{}{"$set": data}, false, false)
 	redis.Del("enterprise", "enterpriseInfo_"+entid, "newIndentEnts")
 	if field == "s_avatar" {
 		redis.DelByCodePattern("enterprise", "ipcity_*")
@@ -307,3 +293,31 @@ func (yp *Yellowpage) IsFollowed() error {
 	yp.ServeJson(bson.M{"status": status})
 	return nil
 }
+
+//权重
+func setAttrWeight(entid string, data bson.M, flag bool) {
+	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 {
+		if !flag && k == "s_avatar" {
+			continue
+		} else if flag && k != "s_avatar" {
+			continue
+		}
+		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)
+}

+ 10 - 3
core/src/qfw/microwebsite/microwebsite.go

@@ -239,7 +239,7 @@ func (m *MicroWebsite) AjaxPorcess() error {
 			entObj["s_synopsis"] = fsw.Repl(m.GetStringComm("s_synopsis")) //修改企业简介
 			break
 		}
-		setAttrWeight(entId, entObj)
+		setAttrWeight(entId, entObj, false)
 		//修改企业信息
 		if len(entObj) > 0 && Update("enterprise", "{'_id':'"+entId+"'}", M{"$set": entObj}, false, false) {
 			redis.Del("enterprise", "enterpriseInfo_"+entId) //清除该企业的redis缓存
@@ -311,7 +311,9 @@ func (m *MicroWebsite) AjaxPorcess() error {
 			field = "s_qrcode"
 		}
 		data := M{field: m.GetString("src")}
-		setAttrWeight(entId, data)
+		if field == "s_avatar" {
+			setAttrWeight(entId, data, true)
+		}
 		b := Update("enterprise", "{'_id':'"+entId+"'}", M{"$set": data}, false, false)
 		if b {
 			redis.Del("enterprise", "enterpriseInfo_"+entId) //清除该企业的redis缓存
@@ -332,7 +334,7 @@ func (m *MicroWebsite) AjaxPorcess() error {
 }
 
 //权重
-func setAttrWeight(entid string, data M) {
+func setAttrWeight(entid string, data M, flag bool) {
 	atrrTitle := coreconfig.SysConfig.AtrrTitle
 	web := FindById("enterprise", entid, `{"_id":-1,"attrWeight":1}`)
 	var attrWeight []byte
@@ -342,6 +344,11 @@ func setAttrWeight(entid string, data M) {
 		attrWeight = make([]byte, 30)
 	}
 	for k, v := range atrrTitle {
+		if !flag && k == "s_avatar" {
+			continue
+		} else if flag && k != "s_avatar" {
+			continue
+		}
 		arr, _ := v.([]interface{})
 		index := IntAll(arr[0])
 		weight := IntAll(arr[1])

+ 1 - 2
core/src/web/staticres/css/mobile/incmobile.css

@@ -246,9 +246,8 @@ span#camera {
 	text-align:center;
 }
 .index-header{
-	height:185px;
 	width:100%;
-	padding:25px 0px 30px 15px !important;
+	padding:25px 0px 15px 15px !important;
 	text-align:left;
 	background:#16A086;
 }

+ 1 - 1
core/src/web/staticres/js/relation.js

@@ -835,7 +835,7 @@ Relation.prototype.makeTextBg = function(){
 			
 		text.each(function() {
             var box = this.getBBox();
-			box.x = 0;
+			//box.x = 0;
             if (first || box.x < bounds.x1) {
                 bounds.x1 = box.x;
             }

+ 9 - 1
core/src/web/templates/enterprise/detail.html

@@ -15,7 +15,15 @@
 	<!--企业名片-->
 	<div class="b-com-head">
 		<div class="ent-logo" id="entLogo">
-			<img src="{{if .T.res.s_avatar}}{{Msg "seo" "cdn"}}{{.T.res.s_avatar}}{{else}}null{{end}}" onerror="this.src='{{Msg "seo" "cdn"}}/images/ent-logo.png'">
+			<script type="text/javascript">
+				var src = {{.T.res.s_avatar}};
+				if(src == ""){
+					src = null;
+				}else if(!src.startWith("http://")){
+					src = {{Msg "seo" "cdn"}}+src;
+				}
+				document.write('<img src="'+src+'" onerror="this.src=\'{{Msg "seo" "cdn"}}/images/ent-logo.png\'">');
+			</script>
 			{{if eq .T.editFlag 2}}
 			<div id="uploadLogo" class="ent-uploadLogo">
 				上传企业LOGO

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

@@ -98,7 +98,15 @@
 	<div id="header">
 	
 		<div class="col-xs-12 index-header" style="text-align:center;">
-			<img src="{{if .T.res.s_avatar}}{{Msg "seo" "cdn"}}{{.T.res.s_avatar}}{{else}}null{{end}}" onerror="this.src='{{Msg "seo" "cdn"}}/images/ent-logo.png'" height=85 width=85>
+			<script type="text/javascript">
+				var src = {{.T.res.s_avatar}};
+				if(src == ""){
+					src = null;
+				}else if(!src.startWith("http://")){
+					src = {{Msg "seo" "cdn"}}+src;
+				}
+				document.write('<img src="'+src+'" onerror="this.src=\'{{Msg "seo" "cdn"}}/images/ent-logo.png\'" height="85" width="85">');
+			</script>
 			<div class="col-xs-12 title"> 
 				{{if .T.res.EntName}}{{.T.res.EntName}}{{end}}
 			</div > 

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

@@ -48,7 +48,15 @@
 				{{range $k,$v:=.T.data}}
 					<div class="borderB">
 						<div class="qfw-entcontent-padding">
-							<img src="{{if index $v "s_avatar"}}{{Msg "seo" "cdn"}}{{index $v "s_avatar"}}{{else}}null{{end}}" onerror="this.src='/images/ent-logo.png'">
+							<script type="text/javascript">
+								var src = {{index $v "s_avatar"}};
+								if(src == ""){
+									src = null;
+								}else if(!src.startWith("http://")){
+									src = {{Msg "seo" "cdn"}}+src;
+								}
+								document.write('<img src="'+src+'" onerror="this.src=\'{{Msg "seo" "cdn"}}/images/ent-logo.png\'">');
+							</script>
 							<div>
 								<div class="lineb " >
 									<a target="_blank" href="/enterprise/{{index $v "_id"}}.html"><b>