Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_forum
jingquan huang 6 years ago
commit 9534a5a8f8

@ -70,7 +70,7 @@ end
# 手机类型的发送
sigle_para = {phone: value}
status = Educoder::Sms.send(mobile: value, code: code)
tip_exception(code_msg(status)) if status != 0
tip_exception(-2, code_msg(status)) if status != 0
when 8, 3, 5
# 邮箱类型的发送
sigle_para = {email: value}
@ -79,7 +79,7 @@ end
# Mailer.run.email_register(code, value)
rescue Exception => e
logger_error(e)
tip_exception("邮件发送失败,请稍后重试")
tip_exception(-2,"邮件发送失败,请稍后重试")
end
end
ver_params = {code_type: send_type, code: code}.merge(sigle_para)
@ -187,7 +187,9 @@ end
# 系统全局认证
def check_auth
if current_user.certification != 1
if current_user.certification != 1 && current_user.apply_actions.exists?(container_type: 'TrialAuthorization', status: 0)
tip_exception(-1, "您的试用申请正在审核中,请耐心等待")
elsif current_user.certification != 1
day_cer = UserDayCertification.find_by(user_id: current_user.id)
tip_exception(407, "系统未授权") unless (Time.now.to_i - day_cer.try(:created_at).to_i) < 86400
elsif !current_user.profile_completed?

@ -170,6 +170,7 @@ class HomeworkCommonsController < ApplicationController
end
@work_count = @student_works.size
@work_excel = @student_works.where("work_status > 0")
# 排序
rorder = params[:order].blank? ? "update_time" : params[:order]
@ -180,8 +181,6 @@ class HomeworkCommonsController < ApplicationController
@student_works = @student_works.joins(user: :user_extension).order("user_extensions.#{rorder} #{b_order}")
end
@work_excel = @student_works
# 分页参数
page = params[:page] || 1
limit = params[:limit] || 20
@ -195,11 +194,9 @@ class HomeworkCommonsController < ApplicationController
end
if params[:format] == "xlsx"
@work_excel = @work_excel.includes(:student_works_scores, user: :user_extension, myshixun: :games)
complete_works = @work_excel.present? ? @work_excel.where("work_status > 0").size : 0
if @user_course_identity >= Course::STUDENT
tip_exception(403, "无权限操作")
elsif complete_works == 0
elsif @work_excel.size == 0
normal_status(-1,"暂无用户提交!")
else
respond_to do |format|
@ -995,9 +992,11 @@ class HomeworkCommonsController < ApplicationController
@subjects = @subjects.page(page).per(limit).includes(:shixuns, user: [user_extension: :school])
else
@subjects = @subjects[offset, limit]
subject_ids = @subjects.pluck(:id)
order_ids = subject_ids.size > 0 ? subject_ids.join(',') : -1
@subjects = Subject.where(id: subject_ids).order("field(id,#{order_ids})").includes(:shixuns, user: [user_extension: :school])
unless @subjects.blank?
subject_ids = @subjects.pluck(:id)
order_ids = subject_ids.size > 0 ? subject_ids.join(',') : -1
@subjects = Subject.where(id: subject_ids).order("field(id,#{order_ids})").includes(:shixuns, user: [user_extension: :school])
end
end
end

@ -102,7 +102,9 @@ class MessagesController < ApplicationController
return normal_status(403, "您没有权限进行该操作") if current_user != @message.author && !current_user.teacher_of_course?(@message.board.course)
begin
@message.update_attributes(message_params)
h = {is_md: true}
m_params = message_params.merge(h)
@message.update_attributes(m_params)
Attachment.associate_container(params[:attachment_ids], @message.id, @message.class.name)
@message.update_content(params[:content])
rescue Exception => e

@ -109,11 +109,11 @@ class ZipsController < ApplicationController
work_status = params[:work_status]
group_id = params[:course_group]
if work_status.present?
unless work_status.blank?
@all_student_works = @all_student_works.where(work_status:work_status)
end
if group_id.present?
unless group_id.blank?
group_user_ids = @course.students.where(course_group_id: params[:course_group]).pluck(:user_id)
@all_student_works = @all_student_works.where(user_id: group_user_ids)
end

@ -1 +1,2 @@
json.extract! message, :id, :parent_id, :subject, :created_on, :total_replies_count, :total_praises_count, :praises_count, :visits, :sticky, :is_hidden, :is_public
json.extract! message, :id, :parent_id, :subject, :created_on, :total_replies_count, :total_praises_count,
:is_md, :praises_count, :visits, :sticky, :is_hidden, :is_public

@ -0,0 +1,5 @@
class AddIsMdForMessages < ActiveRecord::Migration[5.2]
def change
add_column :messages, :is_md, :boolean, :default => true
end
end

@ -0,0 +1,7 @@
class ModifyIsMdForMessages < ActiveRecord::Migration[5.2]
def change
Message.find_each do |m|
m.update_column(:is_md, false)
end
end
end
Loading…
Cancel
Save