diff --git a/app/api/mobile/apis/users.rb b/app/api/mobile/apis/users.rb index 508d95200..96b788dab 100644 --- a/app/api/mobile/apis/users.rb +++ b/app/api/mobile/apis/users.rb @@ -107,7 +107,7 @@ module Mobile present :status,0 end - desc "给用户留言或回复用户留言" + desc "回复用户留言" params do requires :token, type: String requires :user_id, type: Integer,desc: '被留言的用户id' @@ -116,12 +116,23 @@ module Mobile requires :parent_id,type:Integer,desc:'留言父id' requires :ref_message_id,type:Integer,desc:'引用消息id' end - post ':user_id/leave_message' do + post ':user_id/reply_message' do us = UsersService.new jours = us.reply_user_messages params,current_user present :status,0 end + desc "给用户留言" + params do + requires :token, type: String + requires :user_id, type: Integer,desc:'被留言的用户id' + requires :content, type: String,desc:'留言内容' + end + post ':user_id/leave_message' do + us = UsersService.new + us.leave_message params,current_user + present :data,0 + end end end end diff --git a/app/services/users_service.rb b/app/services/users_service.rb index 1ae477d74..7d7976bb5 100644 --- a/app/services/users_service.rb +++ b/app/services/users_service.rb @@ -184,7 +184,11 @@ class UsersService user.add_jour(nil, nil,nil,options) end - + # 给用户留言 + def leave_message params,current_user + obj = User.find(params[:user_id]).add_jour(current_user, params[:content], 0) + obj + end #关注列表