修正作业留言接口
This commit is contained in:
parent
d6813e5996
commit
ef203ff40c
|
@ -22,19 +22,20 @@ module Mobile
|
|||
desc '作业留言(教师布置的作业)'
|
||||
params do
|
||||
requires :token, type: String
|
||||
requires :id, type: Integer,desc: '老师布置的作业id'
|
||||
#requires :id, type: Integer,desc: '老师布置的作业id'
|
||||
requires :message,type: String, desc: '留言'
|
||||
optional :reference_content, type: String ,desc: '引用的内容'
|
||||
optional :reference_user_id, type: Integer,desc: '被引用的人'
|
||||
#optional :reference_content, type: String ,desc: '引用的内容'
|
||||
#optional :reference_user_id, type: Integer,desc: '被引用的人'
|
||||
end
|
||||
post 'create_homework_message' do
|
||||
post ':id/create_homework_message' do
|
||||
cs_params = {
|
||||
id: params[:id],
|
||||
token: params[:token],
|
||||
reference_content: params[:reference_content],
|
||||
bid_message: params.reject{|k,v| [:id,:token,:reference_content].include?(k)}}
|
||||
cs = CommentService.new
|
||||
cs.homework_message cs_params,current_user
|
||||
message = cs.homework_message cs_params,current_user
|
||||
present :data, message, with: Mobile::Entities::Jours
|
||||
present :status, 0
|
||||
end
|
||||
|
||||
|
|
|
@ -93,7 +93,9 @@ class Bid < ActiveRecord::Base
|
|||
# 'deadline'
|
||||
def add_jour(user, notes, reference_user_id = 0, options = {})
|
||||
if options.count == 0
|
||||
self.journals_for_messages << JournalsForMessage.new(:user_id => user.id, :notes => notes, :reply_id => reference_user_id)
|
||||
jfm = JournalsForMessage.new(:user_id => user.id, :notes => notes, :reply_id => reference_user_id)
|
||||
self.journals_for_messages << jfm
|
||||
jfm
|
||||
else
|
||||
jfm = self.journals_for_messages.build(options)
|
||||
jfm.save
|
||||
|
|
|
@ -28,12 +28,13 @@ class CommentService
|
|||
@m = message
|
||||
end
|
||||
refer_user_id = params[:bid_message][:reference_user_id].to_i
|
||||
@bid.add_jour(current_user, message, refer_user_id)
|
||||
jfm = @bid.add_jour(current_user, message, refer_user_id)
|
||||
end
|
||||
#@user = @bid.author
|
||||
#@jours = @bid.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
|
||||
#@jour = paginateHelper @jours,10
|
||||
@bid.set_commit(@feedback_count)
|
||||
jfm
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in New Issue