|
|
@ -290,6 +290,7 @@ class GamesController < ApplicationController
|
|
|
|
answer_deduction = challenge.challenge_answers.where("level <= #{@answer.level}").sum(:score)
|
|
|
|
answer_deduction = challenge.challenge_answers.where("level <= #{@answer.level}").sum(:score)
|
|
|
|
@game.update_attributes!(:answer_open => answer_open, :answer_deduction => answer_deduction)
|
|
|
|
@game.update_attributes!(:answer_open => answer_open, :answer_deduction => answer_deduction)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
GameAnswer.create!(challenge_answer_id: @answer.id, user_id: current_user.id, game_id: @game.id, view_time: Time.now)
|
|
|
|
|
|
|
|
|
|
|
|
rescue Exception => e
|
|
|
|
rescue Exception => e
|
|
|
|
uid_logger_error("#######金币扣除异常: #{e.message}")
|
|
|
|
uid_logger_error("#######金币扣除异常: #{e.message}")
|
|
|
@ -317,6 +318,7 @@ class GamesController < ApplicationController
|
|
|
|
@game.update_attributes!(:answer_open => 1, :answer_deduction => 100)
|
|
|
|
@game.update_attributes!(:answer_open => 1, :answer_deduction => 100)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
@challenge_chooses = @challenge.challenge_chooses
|
|
|
|
@challenge_chooses = @challenge.challenge_chooses
|
|
|
|
|
|
|
|
GameAnswer.create!(user_id: current_user.id, game_id: @game.id, view_time: Time.now)
|
|
|
|
rescue Exception => e
|
|
|
|
rescue Exception => e
|
|
|
|
uid_logger_error("#######金币扣除异常: #{e.message}")
|
|
|
|
uid_logger_error("#######金币扣除异常: #{e.message}")
|
|
|
|
raise ActiveRecord::Rollback
|
|
|
|
raise ActiveRecord::Rollback
|
|
|
|