diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index 402702659..575048211 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -208,9 +208,10 @@ module Mobile authenticate! cs = CoursesService.new - reviewer = cs.get_reviewer_info(params) - present :data, reviewer, with: Mobile::Entities::User - present :status, 0 + result = cs.get_reviewer_info(params) + + present :data, result[:reviewer], with: Mobile::Entities::User + present :status,result[:status] end desc "处理教师或助教的身份申请" diff --git a/app/api/mobile/apis/projects.rb b/app/api/mobile/apis/projects.rb index 8f6e7d96d..05d4036f9 100644 --- a/app/api/mobile/apis/projects.rb +++ b/app/api/mobile/apis/projects.rb @@ -207,9 +207,9 @@ module Mobile authenticate! ps = ProjectsService.new - reviewer = ps.get_reviewer_info params - present :data, reviewer, with: Mobile::Entities::User - present :status, 0 + result = ps.get_reviewer_info(params,current_user) + present :data, result[:reviewer], with: Mobile::Entities::User + present :status, result[:status] end desc "处理管理或开发的身份申请" diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 2f5745892..c6854f3dd 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -152,12 +152,14 @@ class CoursesService end def get_reviewer_info params + status = -1 info = nil c = Course.find(params[:course_id]) if c - messages = CourseMessage.where("course_id=? and course_message_id = ? and course_message_type = 'JoinCourseRequest' and status = 0 ",params[:course_id],params[:user_id]).first - + messages = CourseMessage.where("course_id=? and course_message_id = ? and course_message_type = 'JoinCourseRequest' ",params[:course_id],params[:user_id]).last if messages + #status 0未处理 1同意 2 通过 + status = messages.status user = User.find(params[:user_id]) if user img_url = url_to_avatar(user) @@ -175,7 +177,7 @@ class CoursesService end end - info + {status:status,reviewer:info} end def deal_join_apply params,current_user diff --git a/app/services/projects_service.rb b/app/services/projects_service.rb index b1d917b08..1b342c122 100644 --- a/app/services/projects_service.rb +++ b/app/services/projects_service.rb @@ -198,12 +198,16 @@ class ProjectsService review_members end - def get_reviewer_info params + def get_reviewer_info params,current_user + status = -1 info = nil project = Project.find(params[:project_id]) if project - messages = AppliedProject.where(:project_id=> project.id, :user_id=>params[:user_id]).first - if messages + # messages = AppliedProject.where(:project_id=> project.id, :user_id=>params[:user_id]).first + #status 1未处理 5拒绝 7同意 + applied_message = AppliedMessage.where(:user_id => current_user.id, :project_id => project.id, :applied_user_id=>params[:user_id],:applied_type => "AppliedProject").last + if applied_message + status = applied_message.status user = User.find(params[:user_id]) if user img_url = url_to_avatar(user) @@ -214,13 +218,13 @@ class ProjectsService :work_unit => work_unit, :mail => user.mail, :location => location, role_name: "", name: user.show_name, - roles_id: messages.role, + roles_id: applied_message.role, :brief_introduction => user.user_extensions.brief_introduction,:realname=>user.realname} end end end - info + {status:status,reviewer:info} end def deal_join_apply params,current_user diff --git a/public/assets/wechat/join_class.html b/public/assets/wechat/join_class.html index 41dcd6e0e..b5733e584 100644 --- a/public/assets/wechat/join_class.html +++ b/public/assets/wechat/join_class.html @@ -11,7 +11,7 @@
- 提示 + 提示