微信文字和图片的显示

This commit is contained in:
cxt 2016-05-26 17:14:52 +08:00
parent ff974d6901
commit 6fea9c2ba8
1 changed files with 6 additions and 3 deletions

View File

@ -139,13 +139,16 @@ class WechatsController < ActionController::Base
end end
def sendBind(request) def sendBind(request)
news = (1..1).each_with_object([]) { |n, memo| memo << { title: '绑定登录', content: "欢迎使用Trustie创新实践服务平台 在这里您可以随时了解您的课程和项目动态,随时点赞和回复。 news = (1..1).each_with_object([]) { |n, memo| memo << { title: '绑定登录', content: "欢迎使用Trustie创新实践服务平台
" } }
" } }
request.reply.news(news) do |article, n, index| # article is return object request.reply.news(news) do |article, n, index| # article is return object
url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{Wechat.config.appid}&redirect_uri=#{login_wechat_url}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect" url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{Wechat.config.appid}&redirect_uri=#{login_wechat_url}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
article.item title: "#{n[:title]}", article.item title: "#{n[:title]}",
description: n[:content], description: n[:content],
pic_url: 'https://www.trustie.net/images/weixin_pic.jpg', pic_url: 'https://test.course.trustie.net/images/weixin_pic.jpg',
url: url url: url
end end
end end