Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun
commit
167c98daa2
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,16 @@
|
|||||||
|
/**
|
||||||
|
* Simplified Chinese translation for bootstrap-datetimepicker
|
||||||
|
* Yuan Cheung <advanimal@gmail.com>
|
||||||
|
*/
|
||||||
|
;(function($){
|
||||||
|
$.fn.datetimepicker.dates['zh-CN'] = {
|
||||||
|
days: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"],
|
||||||
|
daysShort: ["周日", "周一", "周二", "周三", "周四", "周五", "周六", "周日"],
|
||||||
|
daysMin: ["日", "一", "二", "三", "四", "五", "六", "日"],
|
||||||
|
months: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
|
||||||
|
monthsShort: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
|
||||||
|
today: "今天",
|
||||||
|
suffix: [],
|
||||||
|
meridiem: ["上午", "下午"]
|
||||||
|
};
|
||||||
|
}(jQuery));
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,51 @@
|
|||||||
|
class Weapps::VerificationCodesController < Weapps::BaseController
|
||||||
|
before_action :require_wechat_login!
|
||||||
|
|
||||||
|
def create
|
||||||
|
params[:type] == 'register' ? check_can_register : check_can_reset_password
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def check_can_register
|
||||||
|
login = params[:login].to_s.strip
|
||||||
|
if login =~ /^[a-zA-Z0-9]+([._\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/
|
||||||
|
user = User.find_by(mail: login)
|
||||||
|
return render_error('该邮箱已注册') if user.present?
|
||||||
|
elsif login =~ /^1\d{10}$/
|
||||||
|
user = User.find_by(phone: params[:login])
|
||||||
|
return render_error('该手机号已注册') if user.present?
|
||||||
|
else
|
||||||
|
return render_error('请输入正确的邮箱或手机号')
|
||||||
|
end
|
||||||
|
|
||||||
|
code = %W(0 1 2 3 4 5 6 7 8 9)
|
||||||
|
verification_code = code.sample(6).join
|
||||||
|
send_type = login =~ /^1\d{10}$/ ? 1 : 8
|
||||||
|
# 记录验证码
|
||||||
|
check_verification_code(verification_code, send_type, login)
|
||||||
|
|
||||||
|
render_ok
|
||||||
|
end
|
||||||
|
|
||||||
|
def check_can_reset_password
|
||||||
|
login = params[:login].to_s.strip
|
||||||
|
if login =~ /^[a-zA-Z0-9]+([._\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/
|
||||||
|
user = User.find_by(mail: login)
|
||||||
|
return render_error('该邮箱尚未注册') if user.blank?
|
||||||
|
elsif login =~ /^1\d{10}$/
|
||||||
|
user = User.find_by(phone: login)
|
||||||
|
return render_error('该手机号尚未注册') if user.blank?
|
||||||
|
else
|
||||||
|
return render_error('请输入正确的邮箱或手机号')
|
||||||
|
end
|
||||||
|
|
||||||
|
code = %W(0 1 2 3 4 5 6 7 8 9)
|
||||||
|
verification_code = code.sample(6).join
|
||||||
|
send_type = login =~ /^1\d{10}$/ ? 2 : 3
|
||||||
|
# 记录验证码
|
||||||
|
check_verification_code(verification_code, send_type, login)
|
||||||
|
|
||||||
|
render_ok
|
||||||
|
end
|
||||||
|
end
|
@ -1,2 +1,3 @@
|
|||||||
class WeappSettings::Advert < WeappSetting
|
class WeappSettings::Advert < WeappSetting
|
||||||
|
default_scope { order(position: :asc) }
|
||||||
end
|
end
|
@ -0,0 +1,27 @@
|
|||||||
|
class Admins::CompetitionStageCreateService < ApplicationService
|
||||||
|
attr_reader :competition, :params
|
||||||
|
|
||||||
|
def initialize(competition, params)
|
||||||
|
@params = params
|
||||||
|
@competition = competition
|
||||||
|
end
|
||||||
|
|
||||||
|
def call
|
||||||
|
ActiveRecord::Base.transaction do
|
||||||
|
stage = CompetitionStage.create!(competition_id: competition.id, name: params[:stage_name], score_rate: (params[:score_rate].to_i / 100).round(2))
|
||||||
|
|
||||||
|
params[:stage].each do |section|
|
||||||
|
stage_section = CompetitionStageSection.create!(competition_id: competition.id, competition_stage_id: stage.id,
|
||||||
|
start_time: section["start_time"], end_time: section["end_time"],
|
||||||
|
mission_count: section["mission_count"], entry: section["entry"],
|
||||||
|
score_source: section["score_source"])
|
||||||
|
section["identifiers"].each do |identifier|
|
||||||
|
CompetitionEntry.create!(competition_stage_section_id: stage_section.id, competition_stage_id: stage.id,
|
||||||
|
shixun_identifier: identifier)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
stage
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,30 @@
|
|||||||
|
class Admins::CompetitionStageUpdateService < ApplicationService
|
||||||
|
attr_reader :competition, :params, :stage
|
||||||
|
|
||||||
|
def initialize(competition, params, stage)
|
||||||
|
@params = params
|
||||||
|
@competition = competition
|
||||||
|
@stage = stage
|
||||||
|
end
|
||||||
|
|
||||||
|
def call
|
||||||
|
ActiveRecord::Base.transaction do
|
||||||
|
stage.update_attributes!(name: params[:stage_name], score_rate: (params[:score_rate].to_i / 100.0).round(2))
|
||||||
|
|
||||||
|
stage.competition_stage_sections.destroy_all
|
||||||
|
|
||||||
|
params[:stage].each do |section|
|
||||||
|
stage_section = CompetitionStageSection.create!(competition_id: competition.id, competition_stage_id: stage.id,
|
||||||
|
start_time: section["start_time"], end_time: section["end_time"],
|
||||||
|
mission_count: section["mission_count"], entry: section["entry"],
|
||||||
|
score_source: section["score_source"])
|
||||||
|
section["identifiers"].each do |identifier|
|
||||||
|
CompetitionEntry.create!(competition_stage_section_id: stage_section.id, competition_stage_id: stage.id,
|
||||||
|
shixun_identifier: identifier)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
stage
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1 @@
|
|||||||
|
window.location.reload();
|
@ -1,6 +1,6 @@
|
|||||||
json.count @users.total_count
|
json.count @users.total_count
|
||||||
json.users do
|
json.users do
|
||||||
json.array! @users.each do |user|
|
json.array! @users.each do |user|
|
||||||
json.extract! user, :id, :login, :real_name, :identity, :school_name
|
json.extract! user, :id, :login, :real_name, :identity, :school_name, :hidden_phone
|
||||||
end
|
end
|
||||||
end
|
end
|
@ -1,6 +1,6 @@
|
|||||||
json.count @users.total_count
|
json.count @users.total_count
|
||||||
json.users do
|
json.users do
|
||||||
json.array! @users.each do |user|
|
json.array! @users.each do |user|
|
||||||
json.extract! user, :id, :login, :real_name, :identity, :school_name
|
json.extract! user, :id, :login, :real_name, :identity, :school_name, :hidden_phone
|
||||||
end
|
end
|
||||||
end
|
end
|
@ -1,10 +0,0 @@
|
|||||||
class AddColumnToStageSections < ActiveRecord::Migration[5.2]
|
|
||||||
def change
|
|
||||||
def change
|
|
||||||
add_column :competition_stage_sections, :mission_count, :integer, default: 0
|
|
||||||
add_column :competition_stage_sections, :score_source, :integer, default: 0
|
|
||||||
|
|
||||||
add_column :competition_entries, :shixun_identifier, :string
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
@ -0,0 +1,26 @@
|
|||||||
|
class MigrateComModuleResource < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
Competition.all.each do |competition|
|
||||||
|
competition.competition_modules.each do |com_module|
|
||||||
|
mod_type = ""
|
||||||
|
case com_module.name.strip
|
||||||
|
when '首页'
|
||||||
|
mod_type = "home"
|
||||||
|
when '报名'
|
||||||
|
mod_type = "enroll"
|
||||||
|
when '通知公告'
|
||||||
|
mod_type = "inform"
|
||||||
|
when '参赛手册'
|
||||||
|
mod_type = "manual"
|
||||||
|
when '排行榜'
|
||||||
|
mod_type = "chart"
|
||||||
|
when '资料下载'
|
||||||
|
mod_type = "resource"
|
||||||
|
else
|
||||||
|
mod_type = "md"
|
||||||
|
end
|
||||||
|
com_module.update_attributes!(module_type: mod_type)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,5 @@
|
|||||||
|
class MigrateCompetitionModuleManual < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
CompetitionModule.where(module_type: "manual").update_all(module_type: "md")
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,17 @@
|
|||||||
|
class MigrateCompetitionModuleContent < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
Competition.all.each do |competition|
|
||||||
|
competition.informs.each do |inform|
|
||||||
|
if inform.status == 1
|
||||||
|
com_module = competition.competition_modules.find_by(module_type: "inform")
|
||||||
|
elsif inform.status == 2
|
||||||
|
com_module = competition.competition_modules.find_by(name: "参赛手册")
|
||||||
|
end
|
||||||
|
if com_module
|
||||||
|
new_md = CompetitionModuleMdContent.create!(competition_module_id: com_module.id, content: inform.description, name: inform.name)
|
||||||
|
Attachment.where(container_id: inform.id, container_type: "Inform").update_all(container_id: new_md.id, container_type: "CompetitionModuleMdContent")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,14 @@
|
|||||||
|
class MigrateCompetitionChartRules < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
add_column :competition_module_md_contents, :competition_stage_id, :integer, default: 0
|
||||||
|
|
||||||
|
ChartRule.all.each do |rule|
|
||||||
|
if rule.competition
|
||||||
|
com_module = rule.competition.competition_modules.find_by(module_type: "chart")
|
||||||
|
if com_module
|
||||||
|
CompetitionModuleMdContent.create!(content: rule.content, competition_module_id: com_module.id, competition_stage_id: rule.competition_stage_id ? rule.competition_stage_id : 0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,11 @@
|
|||||||
|
class CreateCompetitionSchools < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
create_table :competition_schools do |t|
|
||||||
|
t.references :competition, index: true
|
||||||
|
t.references :school, index: true
|
||||||
|
t.string :source
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,8 @@
|
|||||||
|
class AddColumnToStageSections < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
add_column :competition_stage_sections, :mission_count, :integer, default: 0
|
||||||
|
add_column :competition_stage_sections, :score_source, :integer, default: 0
|
||||||
|
|
||||||
|
add_column :competition_entries, :shixun_identifier, :string
|
||||||
|
end
|
||||||
|
end
|
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Before Width: | Height: | Size: 169 KiB After Width: | Height: | Size: 102 KiB |
After Width: | Height: | Size: 59 KiB |
After Width: | Height: | Size: 2.2 KiB |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue