Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
d947a914cc
|
@ -72,6 +72,20 @@ module Mobile
|
|||
present :status, 0
|
||||
end
|
||||
|
||||
desc ' 意见反馈'
|
||||
params do
|
||||
requires :token, type: String
|
||||
requires :subject,type: String,desc: '意见'
|
||||
end
|
||||
post do
|
||||
cs_params = {
|
||||
memo: {:subject => params[:subject],:content => '该贴来自手机App意见反馈'},
|
||||
}
|
||||
cs = CommentService.new
|
||||
memo = cs.create_feedback cs_params, current_user
|
||||
raise "commit failed #{memo.errors.full_messages}" if memo.new_record?
|
||||
present :status, 0
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -15,12 +15,14 @@ class ForumsController < ApplicationController
|
|||
PageLimit = 20
|
||||
def create_feedback
|
||||
if User.current.logged?
|
||||
@memo = Memo.new(params[:memo])
|
||||
@memo.forum_id = "1"
|
||||
@memo.author_id = User.current.id
|
||||
#@memo = Memo.new(params[:memo])
|
||||
#@memo.forum_id = "1"
|
||||
#@memo.author_id = User.current.id
|
||||
#@forum = @memo.forum
|
||||
cs = CommentService.new
|
||||
@memo = cs.create_feedback params,User.current
|
||||
respond_to do |format|
|
||||
if @memo.save
|
||||
if !@memo.new_record?
|
||||
format.html { redirect_to forum_path(@memo.forum) }
|
||||
else
|
||||
sort_init 'updated_at', 'desc'
|
||||
|
|
|
@ -78,4 +78,13 @@ class CommentService
|
|||
@jfm
|
||||
end
|
||||
|
||||
#发贴,用于意见反馈
|
||||
def create_feedback params,current_user
|
||||
@memo = Memo.new(params[:memo])
|
||||
@memo.forum_id = "1"
|
||||
@memo.author_id = current_user.id
|
||||
@memo.save
|
||||
@memo
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in New Issue