소스 검색

企业社区

wangchuanjin 9 년 전
부모
커밋
2453c2f646

+ 1 - 1
core/src/qfw/front/webcentent.go

@@ -759,7 +759,7 @@ func (e *Newscont) GetLatestNews() {
 	    "bool": {
 		  "must":[{"term":{"s_contenttype":"qykb"}}]
 	    }},"_source":["s_title","releasetime","_id"]
-		,"from":0,"size":5,"sort":[{"releasetime":{"order":"desc"}}]}`
+		,"from":0,"size":6,"sort":[{"releasetime":{"order":"desc"}}]}`
 		//查询列表数据
 		client := elastic.GetEsConn()
 		defer elastic.DestoryEsConn(client)

+ 1 - 2
core/src/qfw/yellowpage/yellowpage.go

@@ -17,8 +17,7 @@ type Yellowpage struct {
 	enterpriseInfo xweb.Mapper `xweb:"/enterprise/(\\w+).html"`
 	//根据企业注册号进入企业黄页
 	enterpriseInfoByRegNO xweb.Mapper `xweb:"/enterpriseInfoByRegNO/(\\w+).html"`
-	//获取关系网数据
-	getRelation xweb.Mapper `xweb:"/member/getRelation"`
+	getRelation           xweb.Mapper `xweb:"/member/getRelation"`
 }
 
 func (yp *Yellowpage) EnterpriseInfoByRegNO(regNO string) error {

+ 40 - 3
core/src/qfw/yellowpage/yellowpagemanager.go

@@ -41,7 +41,7 @@ func FormatDate(src *interface{}) string {
 	return str
 }
 
-func GetEntInfo(id string) interface{} {
+func GetEntInfo(id string) map[string]interface{} {
 	res := FindById("enterprise", 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, "s_synopsis":1, "SourceType":1, "Nb_email":1,"IndustryPhyName":1,"investor":1,"alterInfo":1, "s_enturl, "i_province":1, "i_city":1, "i_area":1,"s_action":1,"s_persion":1,"s_mobile":1,"s_address":1,"s_avatar":1,"s_microwebsite":1,"s_qq":1,"s_submitid":1,"s_email":1,"staffinfo":1}`)
 	if res != nil && len(*res) > 0 {
 		id := (*res)["s_submitid"]
@@ -259,6 +259,43 @@ func (yp *Yellowpage) EnterpriseInfo(id string) error {
 	} else {
 		if info := GetEntInfo(id); info != nil {
 			yp.T["res"] = info
+			regNo, _ := info["RegNo"].(string)
+			entName, _ := info["EntName"].(string)
+			relation := redis.Get("enterprise", "relation-"+regNo)
+			if relation == nil {
+				relation = makeRelation(regNo, entName)
+				redis.Put("enterprise", "relation-"+regNo, relation, 7*ONEDAY)
+			}
+			r := relation.(map[string]interface{})
+			var nodes *[]map[string]interface{}
+			var relevantEnts []map[string]interface{}
+			if d, err := json.Marshal(r["nodes"]); err == nil && json.Unmarshal(d, &nodes) == nil && len(*nodes) > 0 {
+				var regNos []string
+				for _, v := range *nodes {
+					if v["type"] == "e" {
+						regNos = append(regNos, v["name"].(string))
+						relevantEnts = append(relevantEnts, v)
+					}
+					if len(regNos) == 6 {
+						break
+					}
+				}
+				if len(regNos) > 0 {
+					ents := Find("enterprise", M{"RegNo": regNos}, nil, `{"s_avatar":1}`, false, -1, -1)
+					if ents != nil && len(*ents) > 0 {
+						for _, relevantEnt := range relevantEnts {
+							for _, ent := range *ents {
+								if ent["RegNo"] == relevantEnt["name"] {
+									ent["s_avatar"] = ent["s_avatar"]
+									ent["_id"] = util.BsonIdToSId(ent["_id"])
+									break
+								}
+							}
+						}
+					}
+				}
+			}
+			yp.T["relevantEnts"] = relevantEnts
 			contentuser, erruser := yp.Render4Cache("/yellowpage/enterpriseinfo.html", &yp.T)
 			if erruser == nil {
 				redis.PutBytes("enterprise", "enterpriseInfo_"+id, &contentuser, 7*ONEDAY)
@@ -396,10 +433,10 @@ func (yp *Yellowpage) GetRelation() error {
 		if regNo == "" || entName == "" {
 			return nil
 		}
-		relation := redis.Get("other", "relation-"+regNo)
+		relation := redis.Get("enterprise", "relation-"+regNo)
 		if relation == nil {
 			relation = makeRelation(regNo, entName)
-			redis.Put("other", "relation-"+regNo, relation, 7*ONEDAY)
+			redis.Put("enterprise", "relation-"+regNo, relation, 7*ONEDAY)
 		}
 		yp.ServeJson(M{"flag": true, "relation": relation})
 		r := relation.(map[string]interface{})

+ 4 - 1
core/src/web/staticres/css/entcommunity.css

@@ -240,6 +240,9 @@ a:focus, a:hover{
 .ent-indexpage .carousel{
 	padding-bottom: 50px;
 }
+.ent-indexpage .b-scroll-list .b-adver-content{
+	max-height: 750px;
+}
 /*********企业画像***************/
 .entinfo-page .b-com-head{
 	background-color: #FFFFFF;
@@ -444,7 +447,7 @@ a:focus, a:hover{
 	text-overflow: ellipsis;
 	overflow: hidden;
 	white-space: nowrap;
-	width: 350px;
+	width: 240px;
 	display: inline-block;
 }
 .entinfo-basicinfo .entinfo-round>a{

+ 6 - 5
core/src/web/staticres/js/entportrait.js

@@ -245,12 +245,13 @@ function ServiceList(){
 			}
 			$("#serviceListPaging").parent().prevAll().remove();
 			$("#serviceListPaging").parent().before(html);
-			/*$(".ent-serviceintroduction").each(function(){
-				console.info($(this).height() +"------"+ $(this).children("div").height());
-				if($(this).height() < $(this).children("div").height()){
-					$(this).parent().append("......");
+			$(".ent-serviceintroduction").each(function(){
+				var text = $(this).text();
+				if(text.length > 200){
+					text = text.substring(0,150)+"...";
 				}
-			});*/
+				$(this).html(text);
+			});
 		});
 	});
 }

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

@@ -39,7 +39,7 @@
 				{{range $k,$v := .T.newIndentEnts}}
 					<li{{if eq $k 0}} class="border-t-0"{{end}}>
 						<div>
-							<img src="{{$v.s_avatar}}" onerror="this.src='/images/ent-logo.png'">
+							<img src="{{if $v.s_avatar}}{{$v.s_avatar}}{{else}}null{{end}}" onerror="this.src='/images/ent-logo.png'">
 							<a href="/enterprise/{{$v.s_enterpriseid}}.html">{{$v.s_enterprisename}}</a>
 						</div>
 					</li>

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

@@ -191,7 +191,7 @@
 				{{range $k,$v := $s}}
 					<li{{if eq $k 0}} class="border-t-0"{{end}}>
 						<div>
-							<img src="{{$v.s_pic}}" onerror="this.src='/images/ent-logo.png'">
+							<img src="{{if $v.s_avatar}}{{$v.s_avatar}}{{else}}null{{end}}" onerror="this.src='/images/ent-logo.png'">
 							<a href="/enterprise/{{$v.s_id}}.html">{{$v.s_remark}}</a>
 						</div>
 					</li>

+ 6 - 5
core/src/web/templates/yellowpage/enterpriseinfo.html

@@ -397,16 +397,16 @@
 		</div>
 	</div>
 	<div class="b-right">
+		{{if gt (len .T.relevantEnts) 0}}
 		<div class="b-adver b-scroll-list">
 			<div class="b-adver-title">相关企业</div>
 			<div class="b-adver-content">
-				{{$s:=(Ad "ent-recommend" 5)}}
 				<ul>
-				{{range $k,$v := $s}}
+				{{range $k,$v := .T.relevantEnts}}
 					<li{{if eq $k 0}} class="margin-0 border-t-0"{{end}}>
 						<div>
-							<img src="{{$v.s_pic}}" onerror="this.src='/images/ent-logo.png'">
-							<a href="/enterprise/{{$v.s_id}}.html">{{$v.s_remark}}</a>
+							<img src="{{if $v.s_avatar}}{{$v.s_avatar}}{{else}}null{{end}}" onerror="this.src='/images/ent-logo.png'">
+							<a href="/enterprise/{{$v._id}}.html">{{$v.text}}</a>
 						</div>
 					</li>
 				{{end}}
@@ -414,7 +414,8 @@
 				<div class="clearfix"></div>
 			</div>
 		</div>
-		<div class="margin-t-10 b-adver">
+		{{end}}
+		<div class="{{if gt (len .T.relevantEnts) 0}}margin-t-10 {{end}}b-adver">
 			<div class="b-adver-title">新闻动态</div>
 			<div class="b-adver-content newsInfo"></div>
 		</div>