dev_haigong
daiao 6 years ago
commit 53bf69e4b4

@ -1132,7 +1132,7 @@ class AccountController < ApplicationController
reward_grade(@user, @user.id, 'Phone', 500) reward_grade(@user, @user.id, 'Phone', 500)
else else
@user.update_attributes!(:mail => params[:value]) @user.update_attributes!(:mail => params[:value])
Gitlab.client.edit_user_email(@user.gid, :email => @user.mail) if @user.gid # Gitlab.client.edit_user_email(@user.gid, :email => @user.mail) if @user.gid
reward_grade(@user, @user.id, 'Mail', 500) reward_grade(@user, @user.id, 'Mail', 500)
end end
end end

@ -104,6 +104,8 @@ class EcloudController < ApplicationController
des_services = params['services'].select{|s| s['opttype'] == 1} des_services = params['services'].select{|s| s['opttype'] == 1}
if des_services.present? if des_services.present?
des_services.each do |ds| des_services.each do |ds|
logger.info("666666#{ecloud.try(:id)}, 55555555#{ds['code']}")
esd = EcloudService.where(ecloud_id: ecloud.try(:id), code: ds['code']).first esd = EcloudService.where(ecloud_id: ecloud.try(:id), code: ds['code']).first
esd.update_attributes!(opttype: ds['opttype'], begintime: ds['begintime'], endtime: ds['endtime']) esd.update_attributes!(opttype: ds['opttype'], begintime: ds['begintime'], endtime: ds['endtime'])
end end
@ -143,10 +145,10 @@ class EcloudController < ApplicationController
# end # end
render :json => {result: true, errmsg: ""} render :json => {result: true, errmsg: ""}
rescue Exception => e # rescue Exception => e
logger.error(e.message) # logger.error(e.message)
render :json => {code: 500, msg: "#{e.message}"} # render :json => {code: 500, msg: "#{e.message}"}
raise ActiveRecord::Rollback # raise ActiveRecord::Rollback
end end
end end
end end

@ -6,32 +6,36 @@ module SubjectsHelper
end end
# 实训路径详情列表,右侧状态显示栏 # 实训路径详情列表,右侧状态显示栏
def shixun_show_in_subject subject_status, shixun_status def shixun_show_in_subject subject_status, shixun_status, shixun_hidden
content = if subject_status < 2 content = if shixun_hidden
case shixun_status '<span class="fr color-grey-c">暂未公开</span>'
when 0, 1 else
'<span class="fr color-grey-c">暂未公开</span>' if subject_status < 2
when 2 case shixun_status
'<span class="fr color-grey-9">已发布</span>' when 0, 1
when 3 '<span class="fr color-grey-c">暂未公开</span>'
'<span class="fr color-grey-9">已关闭</span>' when 2
else '<span class="fr color-grey-9">已发布</span>'
"" when 3
end '<span class="fr color-grey-9">已关闭</span>'
else else
if shixun_status != 2 ""
case shixun_status end
when 0, 1 else
'<span class="fr color-grey-c">暂未公开</span>' if shixun_status != 2
when 3 case shixun_status
'<span class="fr color-grey-9">已关闭</span>' when 0, 1
else '<span class="fr color-grey-c">暂未公开</span>'
"" when 3
end '<span class="fr color-grey-9">已关闭</span>'
else else
"" ""
end end
end else
""
end
end
end
return content.html_safe return content.html_safe
end end
@ -39,7 +43,7 @@ module SubjectsHelper
def start_shixun_in_subject subject, shixun, myshixun def start_shixun_in_subject subject, shixun, myshixun
is_modify = ShixunModify.where(:myshixun_id => myshixun.try(:id), :shixun_id => shixun.try(:id), :status => 1).first is_modify = ShixunModify.where(:myshixun_id => myshixun.try(:id), :shixun_id => shixun.try(:id), :status => 1).first
content_before = '' content_before = ''
content = if shixun.status == 2 || User.current.manager_of_shixun?(shixun) content = if (shixun.status == 2 && !shixun.hidden) || User.current.manager_of_shixun?(shixun)
content_before = "<a href=\"#{shixun_path(shixun)}\" class=\"mr30 color-blue_4C shixun_detail pointer fl none\" target=\"_blank\">查看详情</a>" content_before = "<a href=\"#{shixun_path(shixun)}\" class=\"mr30 color-blue_4C shixun_detail pointer fl none\" target=\"_blank\">查看详情</a>"
if User.current.try(:mail).blank? if User.current.try(:mail).blank?
%Q{<a class="btn_auto user_bluebg_btn fl none" onclick="sure_box_redirect_without_newtab_btn('#{security_settings_path}', '开启实训,请先绑定邮箱','绑定邮箱');" id = "shixun_operation">开始实战</a>} %Q{<a class="btn_auto user_bluebg_btn fl none" onclick="sure_box_redirect_without_newtab_btn('#{security_settings_path}', '开启实训,请先绑定邮箱','绑定邮箱');" id = "shixun_operation">开始实战</a>}

@ -61,7 +61,7 @@
<span class="paragraph_name <%= shixun.status < 2 && !is_shixun_manager ? "color-grey-c" : "color-grey3" %>"><span class="subject_stage_shixun_index"><%= s_index + 1 %></span>-<%= index + 1 %>&nbsp;&nbsp;<%= shixun.name %></span> <span class="paragraph_name <%= shixun.status < 2 && !is_shixun_manager ? "color-grey-c" : "color-grey3" %>"><span class="subject_stage_shixun_index"><%= s_index + 1 %></span>-<%= index + 1 %>&nbsp;&nbsp;<%= shixun.name %></span>
</li> </li>
<li class="fr status_li"> <li class="fr status_li">
<%= shixun_show_in_subject @subject.status, shixun.status %> <%= shixun_show_in_subject @subject.status, shixun.status, shixun.hidden %>
<%= start_shixun_in_subject @subject, shixun, myshixun %> <%= start_shixun_in_subject @subject, shixun, myshixun %>
</li> </li>
</div> </div>

@ -0,0 +1,14 @@
class MigrateHomeworkCommonEndTimes < ActiveRecord::Migration
def up
homework_commons = HomeworkCommon.where("id < 21549")
homework_commons.find_each do |homework|
sql = "update homework_commons set end_time = (select max(end_time) from
homework_seconds where id = #{homework.id}) where id = #{homework.id}"
ActiveRecord::Base.connection.execute(sql)
end
end
def down
end
end

@ -0,0 +1,13 @@
class MigrateHomeworkCommonEndTime2 < ActiveRecord::Migration
def up
homework_commons = HomeworkCommon.where("id >= 21549")
homework_commons.each do |homework|
if homework.publish_time.nil?
homework.update_column('end_time', nil)
end
end
end
def down
end
end
Loading…
Cancel
Save