From 02cf9b56e1e4acd8cb1476f8a7d757c572a12179 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Wed, 20 Jan 2016 22:25:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E7=89=87=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/wechats_controller.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/controllers/wechats_controller.rb b/app/controllers/wechats_controller.rb index 78522d1ed..85b9ba5ba 100644 --- a/app/controllers/wechats_controller.rb +++ b/app/controllers/wechats_controller.rb @@ -121,12 +121,16 @@ class WechatsController < ActionController::Base uw = user_binded?(request[:FromUserName]) if uw && uw.user ua = UserActivity.where(user_id: uw.user.id).order("id desc").limit(5) + logo = "trustie_logo2.png" 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}"} + {title: "act_type: #{ua.act_type}, act_id: #{ua.act_id}", + content: "container_id: #{ua.container_id}, container_type: #{ua.container_type}", + pic_url:"http://wechat.trustie.net/images/trustie_logo#{logo}.png" } + logo = "trustie_logo1.png" 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://wechat.trustie.net/images/trustie_logo2.png', url: 'http://www.baidu.com/' + article.item title: "#{index} #{n[:title]}", description: n[:content], pic_url: n[:pic_url], url: 'http://www.baidu.com/' end else openid = request[:FromUserName]