Merge branches 'dev_aliyun' and 'develop' of https://bdgit.educoder.net/Hjqreturn/educoder into develop

sso
杨树明 5 years ago
commit a7dd83d533

@ -25,7 +25,7 @@ class ShixunsController < ApplicationController
before_action :special_allowed, only: [:send_to_course, :search_user_courses]
before_action :shixun_marker, only: [:new, :create]
before_action :validate_wachat_support, only: [:shixun_exec]
#before_action :validate_wachat_support, only: [:shixun_exec]
skip_before_action :check_sign, only: [:download_file]
## 获取课程列表
@ -1186,11 +1186,11 @@ private
md5.hexdigest
end
def validate_wachat_support
if (params[:wechat].present? && !@shixun.is_wechat_support?)
tip_exception(-5, "..")
end
end
# def validate_wachat_support
#
# if (params[:wechat].present? && !@shixun.is_wechat_support?)
# tip_exception(-5, "..")
# end
# end
end

@ -0,0 +1,23 @@
class Weapps::ChallengesController < Weapps::BaseController
before_action :require_login
before_action :set_challenge
def is_play
# 关卡有展示效果 || 选择题 || jupyter实训 || 隐藏代码窗口 || html+css实训
play = @challenge.show_type != -1 || @challenge.st == 1 || @shixun.is_jupyter? ||
@shixun.hide_code? || (@shixun.small_mirror_name & ["Css", "Html", "Web"]).present?
if play
normal_status(-5, "该关卡暂不支持小程序")
else
render_ok
end
end
private
def set_challenge
@challenge = Challenge.find_by!(id: params[:id])
@shixun = @challenge.shixun
end
end

@ -0,0 +1,15 @@
class Weapps::UnbindAccountsController < Weapps::BaseController
before_action :require_login
def show
@user = current_user
end
def destroy
open_user = OpenUsers::Wechat.find_by!(user_id: current_user.id)
open_user.update!(user_id: nil)
UserAction.create(action_id: current_user.id, action_type: "UnbindWechat", user_id: current_user.id, :ip => request.remote_ip)
logout_user
render_ok
end
end

@ -8,6 +8,7 @@ class MirrorRepository < ApplicationRecord
scope :published_mirror, -> { where(status: [1,2,3,5]) }
scope :published_main_mirror, -> { published_mirror.where(main_type: 1) }
scope :published_small_mirror, -> { published_mirror.where(main_type: 0) }
scope :small_mirror, -> { where(main_type: 0) }
def deletable?
status != 1 && !shixun_mirror_repositories.exists?

@ -171,7 +171,8 @@ class Shixun < ApplicationRecord
# 实训对应的镜像小类别名(已选)
def small_mirror_name
mirror_repositories.published_small_mirror.map(&:type_name)
names = mirror_repositories.small_mirror.map(&:type_name)
names.blank? ? [] : names
end
def small_mirror_id

@ -0,0 +1 @@
json.user_account @user.phone.present? ? @user.phone : @user.mail

@ -1019,6 +1019,7 @@ Rails.application.routes.draw do
resource :code_session, only: [:create]
resource :verify, only: [:create]
resource :check_account, only: [:create]
resource :unbind_accounts, only: [:show, :destroy]
resources :searchs, only: [:index]
resources :course_stickies, only: [:create] do
@ -1027,6 +1028,9 @@ Rails.application.routes.draw do
resources :shixun_lists, only: [:index]
resources :subjects, path: :paths, only: [:index, :create, :update, :edit, :show]
resources :challenges do
get :is_play, on: :member
end
resources :courses, only: [:create, :update, :edit, :show] do
member do

Loading…
Cancel
Save