瀏覽代碼

Merge branch 'feature/v4.8.30'

lizhikun 2 年之前
父節點
當前提交
ba90131664

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

@@ -16,6 +16,7 @@ import (
 	"app.yhyue.com/moapp/jypkg/public"
 
 	util "app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/date"
 
 	. "app.yhyue.com/moapp/jybase/mongodb"
 
@@ -212,6 +213,9 @@ func (s *Short) Article(stype, id string) error {
 						obj["entIds"] = winnerIdArr
 					}
 				}
+				if obj["publishtime"] != nil {
+					obj["publishtimeShorDate"] = time.Unix(util.Int64All(obj["publishtime"]), 0).Format(date.Date_Short_Layout)
+				}
 				s.T["url"] = s.Uri()
 				s.T["obj"] = obj
 
@@ -441,6 +445,10 @@ func (s *Short) Article(stype, id string) error {
 				_, _, _, objc := pcVRT(sid, indust, stype, isVip || isMember || isEntniche)
 				node = SeeDetailLimit(objc, userId, sid)
 			}
+
+			if obj["publishtime"] != nil {
+				obj["publishtimeShorDate"] = time.Unix(util.Int64All(obj["publishtime"]), 0).Format(date.Date_Short_Layout)
+			}
 			s.T["canRead"] = node
 			if stype == "advancedProject" {
 				canRead := false
@@ -526,9 +534,10 @@ func (s *Short) Article(stype, id string) error {
 				}
 			} else {
 				obj = map[string]interface{}{
-					"title":   obj["title"],
-					"_id":     obj["_id"],
-					"subtype": obj["subtype"],
+					"title":    obj["title"],
+					"_id":      obj["_id"],
+					"subtype":  obj["subtype"],
+					"stypeadd": obj["stypeadd"],
 				}
 			}
 
@@ -537,6 +546,7 @@ func (s *Short) Article(stype, id string) error {
 			if ssOpenid != nil {
 				obj["ucbsId"] = encrypt.EncodeArticleId2ByCheck("ucbs#" + ssOpenid.(string) + "#" + id)
 			}
+
 			s.T["obj"] = obj
 			s.T["url"] = s.Uri()
 			return s.Render("/pc/biddetail_rec.html", &s.T)
@@ -1008,6 +1018,9 @@ func (s *Short) NologinArticle(stype, id string) error {
 				obj = Filter(obj)
 				obj["description"] = fmt.Sprintf("%s,%s。", obj["title"], baseInfo(obj))
 			}
+			if obj["publishtime"] != nil {
+				obj["publishtimeShorDate"] = time.Unix(util.Int64All(obj["publishtime"]), 0).Format(date.Date_Short_Layout)
+			}
 			s.T["obj"] = obj
 			s.T["url"] = s.Uri()
 			s.T["newBidInfoList"] = tg.GetNewBidInfo()

+ 3 - 3
src/jfw/front/swordfish.go

@@ -375,7 +375,6 @@ func getLastNewsData(searchvalue, area, city, publishtime, subtype, industry, mi
 		}
 	}
 	limitCount := int64(bidsearch.SearchMaxPageCount_PC)
-	log.Println("######%%%", count)
 	if count > limitCount {
 		count = limitCount
 	}
@@ -971,7 +970,7 @@ func bidDataConvert(id string, datas *[]map[string]interface{}) (array []map[str
 		diff := ""
 		publishtime, _ := v["publishtime"].(float64)
 		if publishtime != 0 {
-			diff = util.TimeDiff(time.Unix(util.Int64All(publishtime), 0))
+			diff = time.Unix(util.Int64All(publishtime), 0).Format(Date_Short_Layout)
 			v["pbtime"] = util.Int64All(publishtime)
 		}
 		v["publishtime"] = diff
@@ -1607,7 +1606,8 @@ func searchresulthtml(list *[]map[string]interface{}) string {
 		}
 		publishtime, _ := listdata["publishtime"].(float64)
 		if publishtime != 0 {
-			diff := util.TimeDiff(time.Unix(util.Int64All(publishtime), 0))
+			// diff := util.TimeDiff(time.Unix(util.Int64All(publishtime), 0))
+			diff := time.Unix(util.Int64All(publishtime), 0).Format(Date_Short_Layout)
 			if diff != "" {
 				listhtml += `<span class="com-time">` + diff + `</span>`
 			}

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

@@ -14,6 +14,7 @@ import (
 	"time"
 
 	qu "app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/date"
 	"app.yhyue.com/moapp/jybase/encrypt"
 	elastic "app.yhyue.com/moapp/jybase/es"
 	"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
@@ -438,6 +439,7 @@ func (this *Tags) GetNewBidInfo() (list []map[string]interface{}) {
 				delete(v, "s_subscopeclass")
 				tmpdate := v["publishtime"]
 				v["publishtime"] = qu.Int64All(tmpdate.(float64))
+				v["date"] = time.Unix(qu.Int64All(tmpdate.(float64)), 0).Format(date.Date_Short_Layout)
 				if v["budget"] != nil {
 					v["budget"] = ConversionMoeny(v["budget"])
 				} else if v["bidamount"] != nil {
@@ -670,6 +672,7 @@ func (this *Tags) GetBidding(industry, area, city, stype, keyword string, reques
 			if datas != nil && len(*datas) > 0 {
 				for _, v := range *datas {
 					v["_id"] = encrypt.CommonEncodeArticle("content", qu.ObjToString(v["_id"]))
+					v["date"] = time.Unix(qu.Int64All(v["publishtime"]), 0).Format(date.Date_Short_Layout)
 				}
 				if strings.Contains(industry, "_") {
 					industry = strings.Split(industry, "_")[0]

+ 7 - 2
src/jfw/modules/app/src/app/front/shorturl.go

@@ -11,6 +11,7 @@ import (
 	"strings"
 	"time"
 
+	"app.yhyue.com/moapp/jybase/date"
 	"app.yhyue.com/moapp/jybase/encrypt"
 	"app.yhyue.com/moapp/jybase/fsw"
 
@@ -247,6 +248,9 @@ func (s *Short) Article(stype, id string) error {
 				obj = Filter(obj)
 				obj["description"] = fmt.Sprintf("%s,%s。", obj["title"], baseInfo(obj))
 			}
+			if obj["l_publishtime"] != nil {
+				obj["publishtimeShorDate"] = time.Unix(util.Int64All(obj["l_publishtime"]), 0).Format(date.Date_Short_Layout)
+			}
 		} else {
 			obj = map[string]interface{}{
 				"title":   obj["title"],
@@ -322,7 +326,9 @@ func NoLoginArticle(stype, sid string) map[string]interface{} {
 			obj["buyerperson"] = ""
 			obj["buyertel"] = ""
 		}
-
+		if obj["l_publishtime"] != nil {
+			obj["publishtimeShorDate"] = time.Unix(util.Int64All(obj["l_publishtime"]), 0).Format(date.Date_Short_Layout)
+		}
 		obj["winnerTitle"] = obj["winner"]
 		obj["buyerTitle"] = obj["buyer"]
 		obj["projectnameTitle"] = obj["projectname"]
@@ -330,7 +336,6 @@ func NoLoginArticle(stype, sid string) map[string]interface{} {
 		obj = Filter(obj)
 		redis.Put("other", catchKey, obj, 60*60*2)
 	}
-	fmt.Println("11111", obj)
 	return obj
 }
 

+ 5 - 8
src/jfw/modules/app/src/web/templates/weixin/wxinfocontent.html

@@ -466,8 +466,8 @@
                     <div class="time_label">
                       <script>
                           var l_publishtime = {{.T.obj.l_publishtime}};
-                          if(l_publishtime != ""){
-                              var tdf = utils.dateFromNow(Number(l_publishtime+"000"))
+                          if((l_publishtime != "") &&(l_publishtime !=null)){
+                              var tdf = new Date(parseInt(l_publishtime*1000)).pattern('yyyy-MM-dd');
                               if(tdf != null){
                                   // document.write("<div class='timebefore_vip'><i class='glyphicon bofangjilu'></i>"+tdf+"</div>");
                                   document.write("<div class='timebefore_vip'>"+tdf+"</div>");
@@ -576,12 +576,9 @@
                             </div>
                         </div>
                         <script>
-                            var l_publishtime = {{.T.obj.l_publishtime}};
-                            if(l_publishtime != ""){
-                                var tdf = utils.dateFromNow(Number(l_publishtime+"000"))
-                                if(tdf != null){
-                                    document.write("<span class='timebefore'>"+tdf+"</span>");
-                                }
+                            var l_publishtime = {{.T.obj.publishtimeShorDate}};
+                            if(l_publishtime != "" && l_publishtime!=null){
+                                    document.write("<span class='timebefore'>"+l_publishtime+"</span>");
                             }
                         </script>
                     </div>

+ 1 - 1
src/web/staticres/js/superSearch.js

@@ -320,7 +320,7 @@ function appendDatas(datas,flag,isNew,onlyUpdateTable){
                      + '<div class="list-title-flex  ellipsis"><em class="visited-hd">'+index+'.</em>'
                      + '<a class="visited-hd" onclick="noIn(this)" dataid="'+datas[i]._id+'" dataindustry="'+datas[i].industry+'" target="_blank"> '+title+ '</a></div>'
                      if(typeof(datas[i].publishtime) != "undefined" && datas[i].publishtime != null && datas[i].publishtime != ""){
-                      var diff = utils.dateFromNow(Number(datas[i].publishtime+"000"));
+  					 var diff =new Date(parseInt(datas[i].publishtime*1000)).pattern('yyyy-MM-dd');
                       if(diff != null){
                         listHtml += '<span class="com-time">'+diff+'</span>';
                       }

+ 4 - 3
src/web/staticres/public-pc/js/article-content.js

@@ -1127,7 +1127,7 @@ $(function(){
   $(".otherinfo .com-time").each(function(){
     var thisValue = $(this).attr("data-value");
     if(thisValue != "" && thisValue != "0" && thisValue != 0){
-      var diff = timeDiff(new Date(Number(thisValue+"000")));
+      var diff = new Date(parseInt(thisValue*1000)).pattern('yyyy-MM-dd');
       if(diff != null){
         $(this).text(diff);
       }
@@ -1841,8 +1841,8 @@ if (amount!=""){
   $(".com-statusbar").append('<span class="com-amount"><a>'+conversionMoeny(amount)+'</a></span>');
 }
 //
-if(publishtime != ""){
-  var diff = utils.dateFromNow(Number(publishtime+"000"));
+if(publishtime != "" && typeof(publishtime) != "undefined"){
+  var diff =goTemplateData.params.obj.publishtimeShorDate
   if(diff != null){
     $(".com-statusbar").append('<span class="com-time"><i class="glyphicon bofangjilu"></i>'+diff+'</span>');
   }
@@ -2591,3 +2591,4 @@ function stripscript(s){
 	}
 	return rs;
 }
+

+ 3 - 2
src/web/staticres/tags/js/no-login-detail.js

@@ -766,7 +766,7 @@ $(function(){
   $(".otherinfo .com-time").each(function(){
     var thisValue = $(this).attr("data-value");
     if(thisValue != "" && thisValue != "0" && thisValue != 0){
-      var diff = timeDiff(new Date(Number(thisValue+"000")));
+      var diff = new Date(parseInt(thisValue*1000)).pattern('yyyy-MM-dd');
       if(diff != null){
         $(this).text(diff);
       }
@@ -1467,7 +1467,7 @@ if (amount && amount!="" && amount !== '略'){
 }
 //
 if(publishtime != ""){
-  var diff = utils.dateFromNow(Number(publishtime+"000"));
+  var diff =goTemplateData.params.obj.publishtimeShorDate
   if(diff != null){
     $(".com-statusbar").append('<span class="com-time"><i class="glyphicon bofangjilu"></i>'+diff+'</span>');
   }
@@ -2202,4 +2202,5 @@ $(function() {
       vm.showSuccess = true
     },"", info.infoid)
   })
+
 })

+ 1 - 1
src/web/templates/pc/tags/template/aside-news-cards.html

@@ -9,7 +9,7 @@
                 {{range $k, $v := .T.newBidInfoList}}
                     <a class="tags-card-item" href="/nologin/content/{{$v._id}}.html" title="{{$v.title}}">
                         <div class="tags-card-item-title ellipsis">{{$v.title}}</div>
-                        <div class="tags-card-item-time"><span data-format-time={{$v.publishtime}}></span></div>
+                        <div class="tags-card-item-time">{{$v.date}}</div>
                     </a>
                 {{end}}
             </div>

+ 1 - 1
src/web/templates/pc/tags/template/search-list.html

@@ -33,7 +33,7 @@
                                     {{if $v.industry}}<span class="j-tag list-item-tags">{{$v.industry}}</span>{{end}}
                                     {{if $v.subtype}}<span class="j-tag list-item-tags">{{$v.subtype}}</span>{{end}}
                                     {{if $v.bidamount}}<span class="j-tag list-item-tags" data-format-money={{$v.bidamount}}>{{$v.bidamount}}</span>{{end}}
-                                    {{if $v.publishtime}}<span data-format-time={{$v.publishtime}} class="list-item-times">{{$v.publishtime}}</span>{{end}}
+                                    {{if $v.date}}<span  class="list-item-times">{{$v.date}}</span>{{end}}
                                 </div>
                             </li>
                         {{end}}

+ 2 - 2
src/web/templates/weixin/wxinfocontent_rec.html

@@ -1006,8 +1006,8 @@ body .loading_ p span {
 		<div class="time_label">
 			<script>
 				var l_publishtime = {{.T.obj.l_publishtime}};
-					if(l_publishtime != ""){
-						var tdf = utils.dateFromNow(Number(l_publishtime+"000"))
+					if(l_publishtime != "" && l_publishtime!=null){
+             var tdf = new Date(parseInt(l_publishtime*1000)).pattern('yyyy-MM-dd');
 						if(tdf != null){
 							document.write("<div class='timebefore_vip'>"+tdf+"</div>");
 						}