Browse Source

修改数量

tags/v1
sylor_huang@126.com 6 years ago
parent
commit
6b44b28c60
2 changed files with 2 additions and 2 deletions
  1. +2
    -2
      app/models/user.rb
  2. BIN
      dump.rdb

+ 2
- 2
app/models/user.rb View File

@@ -145,13 +145,13 @@ class User < ApplicationRecord

# 关注数
def follow_count
Watcher.where(user_id: 1, watchable_type: %w(User)).count
Watcher.where(user_id: self.id, watchable_type: %w(User)).count
# User.watched_by(id).count
end

# 粉丝数
def fan_count
Watcher.where(watchable_type: %w(User), watchable_id: id).count
Watcher.where(watchable_type: %w(User), watchable_id: self.id).count
# watchers.count
end



BIN
dump.rdb View File


Loading…
Cancel
Save