修改数量
This commit is contained in:
parent
fe8ad87c51
commit
6b44b28c60
|
@ -145,13 +145,13 @@ class User < ApplicationRecord
|
||||||
|
|
||||||
# 关注数
|
# 关注数
|
||||||
def follow_count
|
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
|
# User.watched_by(id).count
|
||||||
end
|
end
|
||||||
|
|
||||||
# 粉丝数
|
# 粉丝数
|
||||||
def fan_count
|
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
|
# watchers.count
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue