Merge remote-tracking branch 'origin/develop' into develop

dev_aliyun
杨树明 6 years ago
commit 1898f2ad1e

@ -59,6 +59,8 @@ module Mobile
error!('403 forbidden', 403) error!('403 forbidden', 403)
end end
current_package.increment_visit_count!
present current_package, with: Mobile::Entities::ProjectPackage, type: :show, user: user present current_package, with: Mobile::Entities::ProjectPackage, type: :show, user: user
end end

@ -6,6 +6,7 @@ module Mobile
expose :id expose :id
expose :title expose :title
expose :content
expose :category expose :category
expose :status expose :status
expose :visit_count, if: { type: :index } expose :visit_count, if: { type: :index }

@ -787,7 +787,7 @@ class AccountController < ApplicationController
else else
req[:status] = 2 req[:status] = 2
end end
elsif params[:type] == 9 elsif type == 9
if params[:value] =~ /^1\d{10}$/ if params[:value] =~ /^1\d{10}$/
begin begin
verification_code = code.sample(6).join verification_code = code.sample(6).join

@ -206,7 +206,7 @@ class CompetitionTeamsController < ApplicationController
teacher_staff = @competition.competition_staffs.where(category: 'teacher').first teacher_staff = @competition.competition_staffs.where(category: 'teacher').first
if teacher_staff.blank? if teacher_staff.blank?
@status, @message = -1, '该竞赛不能配备导师' @status, @message = -1, '老师不能参加该竞赛'
return return
end end
@ -217,7 +217,10 @@ class CompetitionTeamsController < ApplicationController
team.team_members.create!(user_id: User.current.id, role: 3, competition_id: @competition.id, is_teacher: true) team.team_members.create!(user_id: User.current.id, role: 3, competition_id: @competition.id, is_teacher: true)
else else
max_member_count = @competition.competition_staffs.where('category != "teacher"').sum(:maximum) max_member_count = @competition.competition_staffs.where('category != "teacher"').sum(:maximum)
if team.members.count + 1 > max_member_count if max_member_count.zero?
@status, @message = -1, '学生不能参加该竞赛'
return
elsif team.members.count + 1 > max_member_count
@status, @message = -1, '该战队成员人数已满' @status, @message = -1, '该战队成员人数已满'
return return
end end
@ -279,7 +282,7 @@ class CompetitionTeamsController < ApplicationController
teacher_count += 1 if is_teacher teacher_count += 1 if is_teacher
# 检查老师数量 # 检查老师数量
if teacher_staff.blank? && teacher_count > 0 if teacher_staff.blank? && teacher_count > 0
@status, @message = -1, '该竞赛不能配备导师' @status, @message = -1, '老师不能参与该竞赛'
return false return false
elsif teacher_staff.present? && (teacher_staff.minimum > teacher_count || teacher_staff.maximum < teacher_count) elsif teacher_staff.present? && (teacher_staff.minimum > teacher_count || teacher_staff.maximum < teacher_count)
@status = -1 @status = -1
@ -293,7 +296,10 @@ class CompetitionTeamsController < ApplicationController
member_count = params[:member_ids].try(:size) || 0 member_count = params[:member_ids].try(:size) || 0
member_count += 1 unless is_teacher member_count += 1 unless is_teacher
# 检查成员数据 # 检查成员数据
if min_member_count > member_count || member_count > max_member_count if member_relations.count.zero? && member_count > 0
@status, @message = -1, '学生不能参与该竞赛'
return false
elsif min_member_count > member_count || member_count > max_member_count
@status = -1 @status = -1
@message = min_member_count == max_member_count ? "成员数量应为#{max_member_count}" : "成员数量应为#{min_member_count}-#{max_member_count}" @message = min_member_count == max_member_count ? "成员数量应为#{max_member_count}" : "成员数量应为#{min_member_count}-#{max_member_count}"
return false return false

@ -7461,7 +7461,11 @@ def tiding_url tiding
when 'Library' when 'Library'
tiding.tiding_type == 'Apply' ? library_applies_path : library_path(tiding.container_id) tiding.tiding_type == 'Apply' ? library_applies_path : library_path(tiding.container_id)
when 'ProjectPackage' when 'ProjectPackage'
tiding.container.present? ? "/project_packages/#{tiding.container_id}" : 'javascript:void(0)' if tiding.container.present?
tiding.tiding_type == 'Apply' ? project_package_applies_path : "/project_packages/#{tiding.container_id}"
else
'javascript:void(0)'
end
end end
end end

@ -1,6 +1,6 @@
class VerificationCode < ActiveRecord::Base class VerificationCode < ActiveRecord::Base
#status发送状态 #status发送状态
#code_type发送类型type 1注册手机验证码 2找回密码手机验证码 3找回密码邮箱验证码 4绑定手机 5绑定邮箱 6手机验证码登录 7邮箱验证码登录 8邮箱注册验证码 #code_type发送类型type 1注册手机验证码 2找回密码手机验证码 3找回密码邮箱验证码 4绑定手机 5绑定邮箱 6手机验证码登录 7邮箱验证码登录 8邮箱注册验证码, 9验证手机号有效
attr_accessible :code, :code_type, :email, :phone, :status attr_accessible :code, :code_type, :email, :phone, :status
def valid_code? def valid_code?

@ -530,7 +530,7 @@ class GamesService
game = Game.select([:myshixun_id, :status, :challenge_id, :id, :evaluate_count]).find_by_identifier(params[:identifier]) game = Game.select([:myshixun_id, :status, :challenge_id, :id, :evaluate_count]).find_by_identifier(params[:identifier])
myshixun = Myshixun.select([:updated_at, :gpid, :id, :shixun_id]).find(game.myshixun_id) myshixun = Myshixun.select([:updated_at, :gpid, :id, :shixun_id]).find(game.myshixun_id)
shixun = Shixun.select([:id, :evaluate_script, :webssh, :exec_time, :sigle_training, :identifier, :status]).find(myshixun.shixun_id) shixun = Shixun.select([:id, :evaluate_script, :webssh, :exec_time, :sigle_training, :identifier, :status]).find(myshixun.shixun_id)
game_challenge = Challenge.select([:id, :position, :picture_path]).find(game.challenge_id) game_challenge = Challenge.select([:id, :position, :picture_path, :exec_time]).find(game.challenge_id)
# 更新评测次数 # 更新评测次数
game.update_column(:evaluate_count, (game.evaluate_count.to_i + 1)) game.update_column(:evaluate_count, (game.evaluate_count.to_i + 1))
@ -573,7 +573,7 @@ class GamesService
params = {:tpiID => "#{myshixun.id}", :tpiGitURL => "#{gitUrl}", :buildID => "#{taskId}",:instanceChallenge => "#{step}", params = {:tpiID => "#{myshixun.id}", :tpiGitURL => "#{gitUrl}", :buildID => "#{taskId}",:instanceChallenge => "#{step}",
:testCases => "#{testCases}", :resubmit => "#{resubmit}", :times => params[:first].to_i, :podType => shixun.webssh, :testCases => "#{testCases}", :resubmit => "#{resubmit}", :times => params[:first].to_i, :podType => shixun.webssh,
:containers => "#{Base64.urlsafe_encode64(shixun_container_limit(shixun))}", :tpmScript => "#{tpmScript}", :containers => "#{Base64.urlsafe_encode64(shixun_container_limit(shixun))}", :tpmScript => "#{tpmScript}",
:timeLimit => "#{shixun.exec_time}", :content_modified => content_modified, :persistenceName => shixun.identifier, :timeLimit => "#{game_challenge.exec_time}", :content_modified => content_modified, :persistenceName => shixun.identifier,
:isPublished => (shixun.status < 2 ? 0 : 1), :sec_key => params[:sec_key]} :isPublished => (shixun.status < 2 ? 0 : 1), :sec_key => params[:sec_key]}
# 评测有文件输出的需要特殊传字段 path表示文件存储的位置 # 评测有文件输出的需要特殊传字段 path表示文件存储的位置

Loading…
Cancel
Save