|
|
|
@ -8,6 +8,7 @@ class WechatsController < ActionController::Base
|
|
|
|
|
# default text responder when no other match
|
|
|
|
|
on :text do |request, content|
|
|
|
|
|
#邀请码
|
|
|
|
|
begin
|
|
|
|
|
uw = user_binded?(request[:FromUserName])
|
|
|
|
|
if !uw
|
|
|
|
|
sendBind()
|
|
|
|
@ -25,6 +26,9 @@ class WechatsController < ActionController::Base
|
|
|
|
|
else
|
|
|
|
|
request.reply.text "您的意见已收到,感谢您的反馈!" # Just echo
|
|
|
|
|
end
|
|
|
|
|
rescue => e
|
|
|
|
|
request.reply.text e
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# When receive 'help', will trigger this responder
|
|
|
|
@ -183,9 +187,12 @@ class WechatsController < ActionController::Base
|
|
|
|
|
|
|
|
|
|
def join_class(content, user)
|
|
|
|
|
cs = CoursesService.new
|
|
|
|
|
status = cs.join_course({invite_code: content.strip}, current_user)
|
|
|
|
|
status = cs.join_course({invite_code: content.upcase.strip}, current_user)
|
|
|
|
|
logger.info status
|
|
|
|
|
status[:state] == 0 ? status[:course] : nil
|
|
|
|
|
if status[:state] != 0
|
|
|
|
|
raise CoursesService::JoinCourseError.message(status[:state])
|
|
|
|
|
end
|
|
|
|
|
status[:course]
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
### controller method
|
|
|
|
|