Browse Source

FIX 优化点赞、关注等功能

tags/v1
Jasder 6 years ago
parent
commit
7ffc99b9d2
2 changed files with 9 additions and 4 deletions
  1. +7
    -2
      app/controllers/praise_tread_controller.rb
  2. +2
    -2
      app/controllers/watchers_controller.rb

+ 7
- 2
app/controllers/praise_tread_controller.rb View File

@@ -11,7 +11,7 @@ class PraiseTreadController < ApplicationController
begin
return normal_status(2, "你已点过赞了") if current_user.liked?(@project)
current_user.like!(@project)
render_ok
render_ok({praises_count: @project.praises_count, praised: current_user.liked?(@project)})
rescue Exception => e
uid_logger_error(e.message)
tip_exception(e.message)
@@ -23,7 +23,7 @@ class PraiseTreadController < ApplicationController
begin
return normal_status(2, "你还没有点过赞噢") unless current_user.liked?(@project)
current_user.unlike!(@project)
render_ok
render_ok({praises_count: @project.praises_count, praised: current_user.liked?(@project)})
rescue Exception => e
uid_logger_error(e.message)
tip_exception(e.message)
@@ -39,4 +39,9 @@ class PraiseTreadController < ApplicationController
tip_exception(e.message)
end
private
def render_result
end
end

+ 2
- 2
app/controllers/watchers_controller.rb View File

@@ -11,7 +11,7 @@ class WatchersController < ApplicationController
begin
return normal_status(2, "你还没有关注哦") unless current_user.watched?(@project)
current_user.unwatch!(@project)
render_ok
render_ok({watchers_count: @project.watchers_count, watched: current_user.watched?(@project)})
rescue Exception => e
uid_logger_error(e.message)
tip_exception(e.message)
@@ -23,7 +23,7 @@ class WatchersController < ApplicationController
begin
return normal_status(2, "你已关注了") if current_user.watched?(@project)
current_user.watch!(@project)
render_ok
render_ok({watchers_count: @project.watchers_count, watched: current_user.watched?(@project)})
rescue Exception => e
uid_logger_error(e.message)
tip_exception(e.message)


Loading…
Cancel
Save