|
|
@ -243,6 +243,7 @@ class UsersController < ApplicationController
|
|
|
|
#status 1 同意 2 拒绝
|
|
|
|
#status 1 同意 2 拒绝
|
|
|
|
def dealwith_apply_request
|
|
|
|
def dealwith_apply_request
|
|
|
|
@msg = CourseMessage.find(params[:msg_id])
|
|
|
|
@msg = CourseMessage.find(params[:msg_id])
|
|
|
|
|
|
|
|
|
|
|
|
case params[:agree]
|
|
|
|
case params[:agree]
|
|
|
|
when 'Y'
|
|
|
|
when 'Y'
|
|
|
|
apply_user = User.find(@msg.course_message_id)
|
|
|
|
apply_user = User.find(@msg.course_message_id)
|
|
|
@ -260,18 +261,18 @@ class UsersController < ApplicationController
|
|
|
|
member.course_group_id = 0
|
|
|
|
member.course_group_id = 0
|
|
|
|
member.save
|
|
|
|
member.save
|
|
|
|
CourseMessage.create(:user_id => @msg.course_message_id, :course_id => @msg.course_id, :viewed => false,:content=> @msg.content,:course_message_id=>User.current.id,:content=>@msg.content,:course_message_type=>'CourseRequestDealResult',:status=>1)
|
|
|
|
CourseMessage.create(:user_id => @msg.course_message_id, :course_id => @msg.course_id, :viewed => false,:content=> @msg.content,:course_message_id=>User.current.id,:content=>@msg.content,:course_message_type=>'CourseRequestDealResult',:status=>1)
|
|
|
|
@msg.update_attributes(:status=>1)
|
|
|
|
@msg.update_attributes(:status=>1,:viewed=>1)
|
|
|
|
else
|
|
|
|
else
|
|
|
|
members = []
|
|
|
|
members = []
|
|
|
|
members << Member.new(:role_ids => [@msg.content.to_i], :user_id => @msg.course_message_id)
|
|
|
|
members << Member.new(:role_ids => [@msg.content.to_i], :user_id => @msg.course_message_id)
|
|
|
|
Course.find(@msg.course_id).members << members
|
|
|
|
Course.find(@msg.course_id).members << members
|
|
|
|
CourseMessage.create(:user_id => @msg.course_message_id, :course_id => @msg.course_id, :viewed => false,:content=> @msg.content,:course_message_id=>User.current.id,:content=>@msg.content,:course_message_type=>'CourseRequestDealResult',:status=>1)
|
|
|
|
CourseMessage.create(:user_id => @msg.course_message_id, :course_id => @msg.course_id, :viewed => false,:content=> @msg.content,:course_message_id=>User.current.id,:content=>@msg.content,:course_message_type=>'CourseRequestDealResult',:status=>1)
|
|
|
|
@msg.update_attributes(:status=>1)
|
|
|
|
@msg.update_attributes(:status=>1,:viewed=>1)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
when 'N'
|
|
|
|
when 'N'
|
|
|
|
CourseMessage.create(:user_id => @msg.course_message_id, :course_id => @msg.course_id, :viewed => false,:content=> @msg.content,:course_message_id=>User.current.id,:content=>@msg.content,:course_message_type=>'CourseRequestDealResult',:status=>2)
|
|
|
|
CourseMessage.create(:user_id => @msg.course_message_id, :course_id => @msg.course_id, :viewed => false,:content=> @msg.content,:course_message_id=>User.current.id,:content=>@msg.content,:course_message_type=>'CourseRequestDealResult',:status=>2)
|
|
|
|
@msg.update_attributes(:status=>2)
|
|
|
|
@msg.update_attributes(:status=>2,:viewed=>1)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
respond_to do |format|
|
|
|
|
respond_to do |format|
|
|
|
|
format.js
|
|
|
|
format.js
|
|
|
|