|
@@ -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()
|
|
seed := time.Now().UnixNano()
|
|
rand.Seed(seed)
|
|
rand.Seed(seed)
|
|
redidsKey := common.If(isWinner, "newHotWinnerEnt", "newHotBuyerEnt").(string)
|
|
redidsKey := common.If(isWinner, "newHotWinnerEnt", "newHotBuyerEnt").(string)
|
|
@@ -379,7 +379,7 @@ func newHotEnt(isWinner bool) (data []map[string]interface{}) {
|
|
ORDER BY count DESC
|
|
ORDER BY count DESC
|
|
LIMIT 50;`, pType)
|
|
LIMIT 50;`, pType)
|
|
portraitRecord := db.Mysql.SelectBySql(sql)
|
|
portraitRecord := db.Mysql.SelectBySql(sql)
|
|
- if len(*portraitRecord) > 0 {
|
|
|
|
|
|
+ if portraitRecord != nil && len(*portraitRecord) > 0 {
|
|
if isWinner {
|
|
if isWinner {
|
|
var winners []string
|
|
var winners []string
|
|
for _, v := range *portraitRecord {
|
|
for _, v := range *portraitRecord {
|
|
@@ -387,7 +387,7 @@ func newHotEnt(isWinner bool) (data []map[string]interface{}) {
|
|
}
|
|
}
|
|
winnerMap := make(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)))
|
|
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 {
|
|
for _, v := range *winnerRes {
|
|
winnerMap[common.InterfaceToStr(v["v"])] = v["company_name"]
|
|
winnerMap[common.InterfaceToStr(v["v"])] = v["company_name"]
|
|
}
|
|
}
|