认证后回复消息
This commit is contained in:
parent
3a0f98ebea
commit
7f5bb11a5f
|
@ -118,10 +118,15 @@ class WechatsController < ActionController::Base
|
|||
on :fallback, respond: 'fallback message'
|
||||
|
||||
on :click, with: 'MY_NEWS' do |request, key|
|
||||
if user_binded?(request[:FromUserName])
|
||||
news = (1..count.to_i).each_with_object([]) { |n, memo| memo << { title: 'News title', content: "No. #{n} news content" } }
|
||||
uw = user_binded?(request[:FromUserName])
|
||||
if uw
|
||||
ua = UserActivity.where(user_id: uw.user.id).order("id desc").limit(5)
|
||||
news = ua.map do |ua|
|
||||
{title: "act_type: #{ua.act_type}, act_id: #{ua.act_id}", content: "container_id: #{ua.container_id}, container_type: #{ua.container_type}"}
|
||||
end
|
||||
|
||||
request.reply.news(news) do |article, n, index| # article is return object
|
||||
article.item title: "#{index} #{n[:title]}", description: n[:content], pic_url: 'http://www.baidu.com/img/bdlogo.gif', url: 'http://www.baidu.com/'
|
||||
article.item title: "#{index} #{n[:title]}", description: n[:content], pic_url: 'https://www.trustie.net/images/trustie_logo1.png', url: 'http://www.baidu.com/'
|
||||
end
|
||||
else
|
||||
openid = request[:FromUserName]
|
||||
|
|
Loading…
Reference in New Issue