Browse Source

Merge branch 'dev/v4.8.83_dx' of qmx/jy into feature/v4.8.83

duxin 1 year ago
parent
commit
d68a7bc109
1 changed files with 3 additions and 3 deletions
  1. 3 3
      src/jfw/front/nzjProject.go

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

@@ -355,7 +355,7 @@ func nzjEquity(session *httpsession.Session) int {
 }
 
 // 新首页 热门中标
-func newHotEnt(isWinner bool) (data []map[string]interface{}) {
+func NewHotEnt(isWinner bool) (data []map[string]interface{}) {
 	seed := time.Now().UnixNano()
 	rand.Seed(seed)
 	redidsKey := common.If(isWinner, "newHotWinnerEnt", "newHotBuyerEnt").(string)
@@ -379,7 +379,7 @@ func newHotEnt(isWinner bool) (data []map[string]interface{}) {
             ORDER BY count DESC
             LIMIT 50;`, pType)
 	portraitRecord := db.Mysql.SelectBySql(sql)
-	if len(*portraitRecord) > 0 {
+	if portraitRecord != nil && len(*portraitRecord) > 0 {
 		if isWinner {
 			var winners []string
 			for _, v := range *portraitRecord {
@@ -387,7 +387,7 @@ func newHotEnt(isWinner bool) (data []map[string]interface{}) {
 			}
 			winnerMap := make(map[string]interface{})
 			winnerRes := elastic.Get("qyxy", "qyxy", fmt.Sprintf(`{"query":{"terms":{"_id":["%s"]}},"_source":[%s],"size":%d}`, strings.Join(winners, `","`), `"_id","company_name"`, len(winners)))
-			if winnerRes != nil {
+			if winnerRes != nil && len(*winnerRes) > 0 {
 				for _, v := range *winnerRes {
 					winnerMap[common.InterfaceToStr(v["v"])] = v["company_name"]
 				}