Skip to content

Commit

Permalink
If message is already the Wechat::Message, still using old way, fix #234
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric-Guo committed Jul 1, 2018
1 parent 565e6eb commit 0707bb4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/wechat/concern/common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def material_delete(media_id)
end

def custom_message_send(message)
post 'message/custom/send', JSON.generate(message), content_type: :json
post 'message/custom/send', message.is_a?(Wechat::Message) ? message.to_json : JSON.generate(message), content_type: :json
end

def customservice_getonlinekflist
Expand Down
2 changes: 1 addition & 1 deletion lib/wechat/corp_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def message_send(userid, message)
end

def custom_message_send(message)
post 'message/send', JSON.generate(message.agent_id(agentid)), content_type: :json
post 'message/send', message.is_a?(Wechat::Message) ? message.agent_id(agentid).to_json : JSON.generate(message.merge(agent_id: agentid)), content_type: :json
end
end
end

0 comments on commit 0707bb4

Please sign in to comment.