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