This commit is contained in:
parent
0929d2ac28
commit
40217d5c56
|
@ -8,6 +8,7 @@ class WechatsController < ActionController::Base
|
||||||
# default text responder when no other match
|
# default text responder when no other match
|
||||||
on :text do |request, content|
|
on :text do |request, content|
|
||||||
#邀请码
|
#邀请码
|
||||||
|
begin
|
||||||
uw = user_binded?(request[:FromUserName])
|
uw = user_binded?(request[:FromUserName])
|
||||||
if !uw
|
if !uw
|
||||||
sendBind()
|
sendBind()
|
||||||
|
@ -25,6 +26,9 @@ class WechatsController < ActionController::Base
|
||||||
else
|
else
|
||||||
request.reply.text "您的意见已收到,感谢您的反馈!" # Just echo
|
request.reply.text "您的意见已收到,感谢您的反馈!" # Just echo
|
||||||
end
|
end
|
||||||
|
rescue => e
|
||||||
|
request.reply.text e
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# When receive 'help', will trigger this responder
|
# When receive 'help', will trigger this responder
|
||||||
|
@ -183,9 +187,12 @@ class WechatsController < ActionController::Base
|
||||||
|
|
||||||
def join_class(content, user)
|
def join_class(content, user)
|
||||||
cs = CoursesService.new
|
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
|
logger.info status
|
||||||
status[:state] == 0 ? status[:course] : nil
|
if status[:state] != 0
|
||||||
|
raise CoursesService::JoinCourseError.message(status[:state])
|
||||||
|
end
|
||||||
|
status[:course]
|
||||||
end
|
end
|
||||||
|
|
||||||
### controller method
|
### controller method
|
||||||
|
|
Loading…
Reference in New Issue