This commit is contained in:
guange 2016-06-22 17:20:34 +08:00
parent 1470cafe57
commit d466b09f3f
1 changed files with 4 additions and 4 deletions

View File

@ -11,11 +11,11 @@ class WechatsController < ActionController::Base
begin
uw = user_binded?(request[:FromUserName])
if !uw
sendBind()
return sendBind()
elsif (course = join_class(content, uw.user)) && course
news = (1..1).each_with_object([]) { |n, memo| memo << { title: '恭喜您成功加入班级,开始学习吧!',
content: "课程名称: #{course.name}\n班级名称: #{course.name}\n任课老师: #{course.teacher.show_name}\n进入班级,和小伙伴愉快的学习吧!"} }
request.reply.news(news) do |article, n, index| # article is return object
return 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=#{ROOT_URL+'/wechat/user_activities?id='+course.id.to_s}&response_type=code&scope=snsapi_base&state=myclass#wechat_redirect"
pic_url = "#{ROOT_URL}/images/wechat/class.jpg"
article.item title: "#{n[:title]}",
@ -24,10 +24,10 @@ class WechatsController < ActionController::Base
url: url
end
else
request.reply.text "您的意见已收到,感谢您的反馈!" # Just echo
return request.reply.text "您的意见已收到,感谢您的反馈!" # Just echo
end
rescue => e
request.reply.text e
return request.reply.text e
end
end