diff --git a/app/controllers/memos_controller.rb b/app/controllers/memos_controller.rb index 66adcc46b..d950fe1c8 100644 --- a/app/controllers/memos_controller.rb +++ b/app/controllers/memos_controller.rb @@ -147,16 +147,15 @@ class MemosController < ApplicationController ActiveRecord::Base.transaction do begin memo = Memo.find_by!(id: params[:parent_id]) - reply = Memo.new - reply.content = params[:content] - reply.author = current_user - reply.forum_id = memo.forum_id - reply.subject = memo.subject - reply.root_id = memo.root_id || memo.id - memo.children << reply - m = Memo.find_by!(id: reply.root_id) + @reply = Memo.new + @reply.content = params[:content] + @reply.author = current_user + @reply.forum_id = memo.forum_id + @reply.subject = memo.subject + @reply.root_id = memo.root_id || memo.id + memo.children << @reply + m = Memo.find_by!(id: @reply.root_id) m.increment!(:all_replies_count) - normal_status("回复成功") rescue Exception => e tip_exception("回复失败,原因:#{e}") raise ActiveRecord::Rollback diff --git a/app/views/games/picture_display.json.jbuilder b/app/views/games/picture_display.json.jbuilder index 770f0d71b..8b5271ec5 100644 --- a/app/views/games/picture_display.json.jbuilder +++ b/app/views/games/picture_display.json.jbuilder @@ -25,28 +25,28 @@ elsif @type == "txt" elsif @type =="qrcode" json.qrcode_str @qrcode_str elsif @type == "mp3" || @type == "mp4" - # if @type == "mp4" - # json.orignal_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378171/123.mp4"}] - # json.user_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378172/456.mp4"}] - # json.answer_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378173/789.mp4"}] - # else - # json.orignal_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378174/58099.mp3"}] - # json.user_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378175/654058514.mp3"}] - # json.answer_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378175/654058514.mp3"}] - # end - json.orignal_file do - json.array! @orignal_picture do |file| - json.file_url attachment_show_users_path(:file_name => file, :path => @original_path) - end - end - json.user_file do - json.array! @user_picture do |file| - json.file_url attachment_show_users_path(:file_name => file, :path => @user_path, :time => Time.now.to_i) - end - end - json.answer_file do - json.array! @answer_picture do |file| - json.file_url attachment_show_users_path(:file_name => file, :path => @answer_path) - end + if @type == "mp4" + json.orignal_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378171"}] + json.user_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378172"}] + json.answer_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378173"}] + else + json.orignal_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378174"}] + json.user_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378175"}] + json.answer_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378175"}] end + # json.orignal_file do + # json.array! @orignal_picture do |file| + # json.file_url attachment_show_users_path(:file_name => file, :path => @original_path) + # end + # end + # json.user_file do + # json.array! @user_picture do |file| + # json.file_url attachment_show_users_path(:file_name => file, :path => @user_path, :time => Time.now.to_i) + # end + # end + # json.answer_file do + # json.array! @answer_picture do |file| + # json.file_url attachment_show_users_path(:file_name => file, :path => @answer_path) + # end + # end end \ No newline at end of file diff --git a/app/views/memos/reply.json.jbuilder b/app/views/memos/reply.json.jbuilder new file mode 100644 index 000000000..c117d2d24 --- /dev/null +++ b/app/views/memos/reply.json.jbuilder @@ -0,0 +1,2 @@ +json.(@reply, :id, :subject, :content, :hidden, :forum_id, :author_id, :all_replies_count, :is_md, :parent_id, :root_id, + :reward, :sticky, :updated_at, :created_at, :viewed_count) \ No newline at end of file