浏览代码

feat:SEM推广页面

wangshan 2 年之前
父节点
当前提交
1908d5c499
共有 2 个文件被更改,包括 16 次插入13 次删除
  1. 11 11
      src/jfw/front/front.go
  2. 5 2
      src/jfw/front/supsearch.go

+ 11 - 11
src/jfw/front/front.go

@@ -443,13 +443,13 @@ func (f *Front) Topics() error {
 	userId, _ := f.GetSession("userId").(string)
 	f.DisableHttpCache()
 	//底部最新招标数据  3*6 条信息
-	news := PCS_list("", 18, userId).([]interface{}) //Newbids("")[0].([]interface{})
+	news := PCS_list("", 18, userId) //Newbids("")[0].([]interface{})
 	listAll := [][]map[string]interface{}{}
 	i := 1
 	list := []map[string]interface{}{}
 	now := time.Now().Unix()
-	for _, v := range news {
-		if data, ok := v.(map[string]interface{}); ok {
+	if news != nil {
+		for _, data := range news {
 			if data["publishtime"] == nil && data["time"] != nil {
 				continue
 			}
@@ -463,14 +463,14 @@ func (f *Front) Topics() error {
 			data["index"] = i
 			i++
 			list = append(list, data)
-		}
-		if len(list) >= 6 {
-			listAll = append(listAll, list)
-			list = []map[string]interface{}{}
-			i = 1
-		}
-		if len(listAll) >= 3 {
-			break
+			if len(list) >= 6 {
+				listAll = append(listAll, list)
+				list = []map[string]interface{}{}
+				i = 1
+			}
+			if len(listAll) >= 3 {
+				break
+			}
 		}
 	}
 	f.T["list"] = listAll

+ 5 - 2
src/jfw/front/supsearch.go

@@ -94,7 +94,7 @@ func PCS_task() {
 }
 
 // 返回内存中列表也的数据,只获取首页,其他页面访问量暂时不多
-func PCS_list(page_type string, pageSize int, userId string) interface{} {
+func PCS_list(page_type string, pageSize int, userId string) []map[string]interface{} {
 	/*var _page_type = page_type
 	  //如果page_type为空,则是获取非拟建数据。
 	  if page_type == "" {
@@ -105,9 +105,12 @@ func PCS_list(page_type string, pageSize int, userId string) interface{} {
 	  if PCS_index[_page_type] == nil {
 	  	PCS_index[_page_type] = Newbids(page_type)[0]
 	  }*/
+	if pageSize == 0 {
+		pageSize = 50
+	}
 	newbid := Newbids(page_type, userId)
 	if len(newbid) > 0 {
-		return newbid[0:50]
+		return newbid[0:pageSize]
 	} else {
 		return nil
 	}