|
|
|
@ -131,30 +131,7 @@ class WechatsController < ActionController::Base
|
|
|
|
|
def default_msg(request)
|
|
|
|
|
uw = user_binded?(request[:FromUserName])
|
|
|
|
|
if uw && uw.user
|
|
|
|
|
|
|
|
|
|
ua = user_activity(uw.user)
|
|
|
|
|
logo = "http://wechat.trustie.net/images/trustie_logo2.png"
|
|
|
|
|
i = 0
|
|
|
|
|
news =[]
|
|
|
|
|
ua.each do |a|
|
|
|
|
|
i += 1
|
|
|
|
|
activity = process_activity(a)
|
|
|
|
|
if activity
|
|
|
|
|
news << {title: activity[0],
|
|
|
|
|
content: activity[1],
|
|
|
|
|
picurl: "#{i == 1 ? logo : 'https://www.trustie.net/'+activity[2]}",
|
|
|
|
|
url: activity[3]
|
|
|
|
|
}
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
request.reply.news(news) do |article, n, index| # article is return object
|
|
|
|
|
article.item title: "#{n[:content]}",
|
|
|
|
|
description: n[:title],
|
|
|
|
|
pic_url: "#{n[:picurl]}",
|
|
|
|
|
url: n[:url]
|
|
|
|
|
end
|
|
|
|
|
request.reply.text "欢迎回来, #{uw.user.show_name}"
|
|
|
|
|
else
|
|
|
|
|
sendBind(request)
|
|
|
|
|
end
|
|
|
|
|