diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index b83431a82..9c5087399 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -768,7 +768,7 @@ class GamesController < ApplicationController # REDO:需要添加详细的说明 def cost_time #return if @game.status >= 2 - cost_time = (params[:time].to_i < 0 ? 0 : params[:time].to_i) + @game.cost_time.to_i + cost_time = params[:time].to_i < @game.cost_time ? (@game.cost_time+params[:time]) : params[:time].to_i @game.update_attribute(:cost_time, cost_time) end diff --git a/app/views/games/cost_time.json.jbuilder b/app/views/games/cost_time.json.jbuilder new file mode 100644 index 000000000..76e908307 --- /dev/null +++ b/app/views/games/cost_time.json.jbuilder @@ -0,0 +1 @@ +json.identifier @game.identifier \ No newline at end of file