Merge branch 'dev' into x/gorm

pull/398/head
Michael Li 1 year ago
commit b6505d7e07
No known key found for this signature in database

@ -5,6 +5,8 @@
package jinzhu package jinzhu
import ( import (
"time"
"github.com/rocboss/paopao-ce/internal/core" "github.com/rocboss/paopao-ce/internal/core"
"github.com/rocboss/paopao-ce/internal/core/cs" "github.com/rocboss/paopao-ce/internal/core/cs"
"github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr"
@ -71,6 +73,7 @@ func (s *userMetricSrvA) UpdateUserMetric(userId int64, action uint8) (err error
UserId: userId, UserId: userId,
} }
} }
metric.LatestTrendsOn = time.Now().Unix()
switch action { switch action {
case cs.MetricActionCreateTweet: case cs.MetricActionCreateTweet:
metric.TweetsCount++ metric.TweetsCount++

@ -27,7 +27,7 @@ func (s *trendsSrvA) GetIndexTrends(userId int64, limit int, offset int) (res []
if offset >= 0 && limit > 0 { if offset >= 0 && limit > 0 {
db = db.Limit(limit).Offset(offset) db = db.Limit(limit).Offset(offset)
} }
if err = db.Order("r.style ASC").Select("username", "nickname", "avatar").Find(&res).Error; err == nil { if err = db.Order("r.style ASC, m.latest_trends_on DESC").Select("username", "nickname", "avatar").Find(&res).Error; err == nil {
res = cs.DistinctTrends(res) res = cs.DistinctTrends(res)
} }
return return

Loading…
Cancel
Save