修改微信反馈框加入重复班级提示有误的问题

This commit is contained in:
yuanke 2016-07-15 09:16:37 +08:00
parent 16e029d340
commit 6ab1269c01
4 changed files with 20 additions and 11 deletions

View File

@ -393,10 +393,7 @@ module Mobile
authenticate!
course = Course.find(params[:course_id])
exercises = course.exercises
exercises.each do |v|
v[:coursename] = course.nil? ? "未知" : course.name
end
exercises = course.exercises.where("exercise_status <> 1")
present :data,exercises,with:Mobile::Entities::Exercise
present :status,0
end

View File

@ -208,8 +208,20 @@ class WechatsController < ActionController::Base
course = Course.where(invite_code: params[:invite_code]).first if params[:invite_code]
raise "班级不存在,请确认您的邀请码是否输入正确,谢谢!" unless course
#取出用户角色类型
role = 10
case user.user_extensions.identity
when 0
role = "9"
when 1
role = "10"
when 2
role = "7"
end
cs = CoursesService.new
status = cs.join_course({invite_code: course.invite_code}, user)
status = cs.join_course({role:role,invite_code: course.invite_code}, user)
logger.info status
if status[:state] != 0
raise CoursesService::JoinCourseError.message(status[:state])

View File

@ -326,8 +326,8 @@ class CoursesService
define_error [
0, '加入成功',
1, '密码错误',
2, '课程已过期 请联系课程管理员重启课程。',
3, '您已经加入了课程',
2, '班级已过期 请联系班级管理员重启班级。',
3, '您已经加入了班级',
4, '您的邀请码不正确',
5, '您还未登录',
6, '申请成功,请等待审核完毕',
@ -522,7 +522,7 @@ class CoursesService
def course_attachments params
result = []
course = Course.find(params[:course_id])
attachments = course.attachments.order("created_on ")
attachments = course.attachments.where("is_publish = 1").order("created_on desc")
if !params[:name].nil? && params[:name] != ""
attachments.each do |atta|
result << atta if atta.filename.include?(params[:name])

View File

@ -10,12 +10,12 @@
<% elsif @state == 1 %>
alert("密码错误");
<% elsif @state == 2 %>
alert("课程已过期\n请联系课程管理员重启课程。(在配置课程处)");
alert("班级已过期\n请联系班级管理员重启班级。(在配置班级处)");
<% elsif @state == 3 %>
alert("您已经加入了课程");
alert("您已经加入了班级");
window.location.href= "http://"+"<%= Setting.host_name%>"+"/courses/" + "<%= course.id%>"
<% elsif @state == 4 %>
alert("您加入的课程不存在");
alert("您加入的班级不存在");
<% elsif @state == 5 %>
alert("您还未登录");
<% elsif @state == 6 %>