|
|
@ -47,7 +47,7 @@ class ShixunsService
|
|
|
|
if current_user.admin?
|
|
|
|
if current_user.admin?
|
|
|
|
disscuss_count = Discuss.where(dis_id: dis_id, dis_type: dis_type, root_id: nil).count
|
|
|
|
disscuss_count = Discuss.where(dis_id: dis_id, dis_type: dis_type, root_id: nil).count
|
|
|
|
discusses = Discuss.where(dis_id: dis_id, dis_type: dis_type, root_id: nil)
|
|
|
|
discusses = Discuss.where(dis_id: dis_id, dis_type: dis_type, root_id: nil)
|
|
|
|
.includes(:user, :praise_tread).limit(LIMIT).offset(offset)
|
|
|
|
.includes(:user, :praise_treads).limit(LIMIT).offset(offset)
|
|
|
|
else
|
|
|
|
else
|
|
|
|
disscusses = Discuss.where(
|
|
|
|
disscusses = Discuss.where(
|
|
|
|
'dis_id = :dis_id and dis_type = :dis_type and root_id is null and (hidden = :hidden or user_id = :user_id)',
|
|
|
|
'dis_id = :dis_id and dis_type = :dis_type and root_id is null and (hidden = :hidden or user_id = :user_id)',
|
|
|
@ -55,7 +55,7 @@ class ShixunsService
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
disscuss_count = disscusses.count
|
|
|
|
disscuss_count = disscusses.count
|
|
|
|
discusses = disscusses.includes(:user, :praise_tread).limit(LIMIT).offset(offset)
|
|
|
|
discusses = disscusses.includes(:user, :praise_treads).limit(LIMIT).offset(offset)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
base_data discusses, dis, current_user
|
|
|
|
base_data discusses, dis, current_user
|
|
|
@ -81,7 +81,7 @@ class ShixunsService
|
|
|
|
offset = page * LIMIT
|
|
|
|
offset = page * LIMIT
|
|
|
|
find_status = true if position
|
|
|
|
find_status = true if position
|
|
|
|
end
|
|
|
|
end
|
|
|
|
discusses = Discuss.limit(LIMIT).where(:dis_id => dis_id, :dis_type => dis_type, :root_id => nil).includes(:user, :praise_tread).offset(offset)
|
|
|
|
discusses = Discuss.limit(LIMIT).where(:dis_id => dis_id, :dis_type => dis_type, :root_id => nil).includes(:user, :praise_treads).offset(offset)
|
|
|
|
|
|
|
|
|
|
|
|
base_data discusses, dis, current_user
|
|
|
|
base_data discusses, dis, current_user
|
|
|
|
Myshixun.find(params[:myshixun_id]).update_attribute(:onclick_time, Time.now)
|
|
|
|
Myshixun.find(params[:myshixun_id]).update_attribute(:onclick_time, Time.now)
|
|
|
@ -109,8 +109,8 @@ class ShixunsService
|
|
|
|
if discusses.present?
|
|
|
|
if discusses.present?
|
|
|
|
discusses.each do |d|
|
|
|
|
discusses.each do |d|
|
|
|
|
# 总点赞数
|
|
|
|
# 总点赞数
|
|
|
|
praise_count = d.praise_tread.where(:praise_or_tread => 1).count
|
|
|
|
praise_count = d.praises_count
|
|
|
|
user_praise= d.praise_tread.select{|pt| pt.user_id == current_user.id}.length > 0 ? true : false
|
|
|
|
user_praise= d.praise_treads.select{|pt| pt.user_id == current_user.id}.length > 0 ? true : false
|
|
|
|
manager = current_user.manager_of_shixun?(dis, current_user)
|
|
|
|
manager = current_user.manager_of_shixun?(dis, current_user)
|
|
|
|
game_url =
|
|
|
|
game_url =
|
|
|
|
if manager
|
|
|
|
if manager
|
|
|
|