wangshan преди 2 години
родител
ревизия
1b685230b4
променени са 1 файла, в които са добавени 4 реда и са изтрити 3 реда
  1. 4 3
      jyBXBase/rpc/model/newestBidding.go

+ 4 - 3
jyBXBase/rpc/model/newestBidding.go

@@ -60,10 +60,11 @@ func GetNewestInfo(userId, userType string, newUserId int64) *NewestInfo {
 // 根据GetPushHistoryCount 返回值 作为列表缓存key中一个参数
 func (n *NewestInfo) GetPushHistoryCount() int64 {
 	countKey := fmt.Sprintf("push_count_%s_%s", n.TableName, n.UserId)
-	if b := redis.GetInt("other", countKey); b > 0 {
-		return int64(b)
+	if b, err := redis.Exists("other", countKey); err == nil && b {
+		return 1
 	}
-	countSql := "select count(1) from %s  a  where a.userid=%d order by a.id desc"
+	countSql := "SELECT COUNT(1) FROM (SELECT 1 FROM %s WHERE s_userid = %d LIMIT 1) AS ph"
+	//countSql := "select count(1) from %s  a  where a.userid=%d order by a.id desc"
 	countSql = fmt.Sprintf(countSql, n.TableName, n.NewUserId)
 	if c := n.MysqlDb.CountBySql(countSql); c > 0 {
 		redis.Put("other", countKey, c, 60) //过期时间走配置,比最新标讯列表缓存时间 要短1/10 尽量不超过两分钟