From 6fd67e780e44cf0e1a44f70acd74681acd1c29b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Fri, 15 Mar 2019 09:17:33 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E8=B7=AF=E5=BE=84=20?= =?UTF-8?q?=E6=96=B0=E5=BB=BA=EF=BC=8C=E4=BF=AE=E6=94=B9=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E4=B8=BA=E7=A9=BA=E5=8F=96=E6=B6=88=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E6=B2=A1=E6=9C=89=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/subjects/_new_shixun_list.html.erb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/views/subjects/_new_shixun_list.html.erb b/app/views/subjects/_new_shixun_list.html.erb index 52e1ef65..d94b28b1 100644 --- a/app/views/subjects/_new_shixun_list.html.erb +++ b/app/views/subjects/_new_shixun_list.html.erb @@ -25,8 +25,10 @@ <% else %>

没有实训数据可以选择

-

- 立即新建 + 立即新建 +

+ 取消 +
<% end %> From 49f639247e1d4edc0bb114d4c959cae1370c18ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Fri, 15 Mar 2019 09:44:50 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E6=8C=89=E9=92=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/subjects/_new_shixun_list.html.erb | 2 +- public/stylesheets/educoder/edu-main.css | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/views/subjects/_new_shixun_list.html.erb b/app/views/subjects/_new_shixun_list.html.erb index d94b28b1..17aafc08 100644 --- a/app/views/subjects/_new_shixun_list.html.erb +++ b/app/views/subjects/_new_shixun_list.html.erb @@ -27,7 +27,7 @@

没有实训数据可以选择

立即新建
- 取消 + 取消
<% end %> diff --git a/public/stylesheets/educoder/edu-main.css b/public/stylesheets/educoder/edu-main.css index 4e495353..d814abd5 100644 --- a/public/stylesheets/educoder/edu-main.css +++ b/public/stylesheets/educoder/edu-main.css @@ -859,4 +859,10 @@ html>body #ajax-indicator { position: fixed; } .ListTablecheckbox{ left: 42px; top: -1px !important; -} \ No newline at end of file +} + +.pathhidnmodel{ + position: absolute; + margin-top: 60px; + margin-left: -26px; +} From ea6364960bb8a11662e7ecfe61e28cce102daeb2 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 15 Mar 2019 14:01:45 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=20=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0314080805_create_shixun_student_works.rb} | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) rename db/migrate/{20190314080802_create_shixun_student_works.rb => 20190314080805_create_shixun_student_works.rb} (81%) diff --git a/db/migrate/20190314080802_create_shixun_student_works.rb b/db/migrate/20190314080805_create_shixun_student_works.rb similarity index 81% rename from db/migrate/20190314080802_create_shixun_student_works.rb rename to db/migrate/20190314080805_create_shixun_student_works.rb index 240adc00..55e217ff 100644 --- a/db/migrate/20190314080802_create_shixun_student_works.rb +++ b/db/migrate/20190314080805_create_shixun_student_works.rb @@ -13,16 +13,16 @@ class CreateShixunStudentWorks < ActiveRecord::Migration end def up - ActiveRecord::Base.transaction do - begin - works = StudentWork.where("myshixun_id != 0 and myshixun_id not in (select id from myshixuns) and (work_score is null or work_score = 0)") - works.update_all(:myshixun_id => 0, :work_status => 0, :work_score => nil, :final_score => nil, - :cost_time => 0, :update_time => nil, :compelete_status => 0, :commit_time => nil) + begin + works = StudentWork.where("myshixun_id != 0 and myshixun_id not in (select id from myshixuns) and (work_score is null or work_score = 0)") + works.update_all(:myshixun_id => 0, :work_status => 0, :work_score => nil, :final_score => nil, + :cost_time => 0, :update_time => nil, :compelete_status => 0, :commit_time => nil) - shixun_works = StudentWork.where("myshixun_id != 0 and myshixun_id not in (select id from myshixuns) and work_score > 0") - shixun_works.each do |work| - shixun = work.homework_common.try(:homework_commons_shixuns).try(:shixun) - user = work.user + shixun_works = StudentWork.where("myshixun_id != 0 and myshixun_id not in (select id from myshixuns) and work_score > 0") + shixun_works.each do |work| + shixun = work.homework_common.try(:homework_commons_shixuns).try(:shixun) + user = work.user + ActiveRecord::Base.transaction do if shixun.present? && user.present? # 创建新的myshixun和games # fork版本库,如果用户没有同步,则先同步用户 @@ -80,11 +80,11 @@ class CreateShixunStudentWorks < ActiveRecord::Migration end end end - rescue Exception => e - puts ("###failed to exec shixun: current task id is #{e}") - # g.delete_project(gshixun.id) if gshixun.try(:id).present? - raise ActiveRecord::Rollback end + rescue Exception => e + puts ("###failed to exec shixun: current task id is #{e}") + # g.delete_project(gshixun.id) if gshixun.try(:id).present? + raise ActiveRecord::Rollback end end From 836542759c4d936c3b1580bae5e4807df983f062 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 15 Mar 2019 14:04:43 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E4=BC=81=E4=B8=9A=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=A6=82=E6=9E=9C=E5=88=9B=E5=BB=BA=E4=BA=86=E4=B8=8D=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E5=88=9B=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 9 +++++++++ app/controllers/ecloud_controller.rb | 12 ++++++++---- app/models/ecloud_users.rb | 1 + .../20190314080802_create_shixun_student_works.rb | 1 + db/migrate/20190314111921_migrate_shixun_works_1.rb | 1 + 5 files changed, 20 insertions(+), 4 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 33d2e109..262efb00 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -65,6 +65,15 @@ class ApplicationController < ActionController::Base include Redmine::MenuManager::MenuController helper Redmine::MenuManager::MenuHelper + def ecloud_auth ucloud_user_id + euser = EcloudUser.where("id =? and opttype not in(3, 5)", ucloud_user_id).first + if euser.present? # 开通过业务 + # + else + false + end + end + def ec_public_auth major_school unless User.current.admin? || major_school.template_major || major_school.school.users.where(:id => User.current.id).count > 0 || major_school.ec_major_school_users.where(:user_id => User.current.id).count > 0 || diff --git a/app/controllers/ecloud_controller.rb b/app/controllers/ecloud_controller.rb index 0201fd73..edf568a9 100644 --- a/app/controllers/ecloud_controller.rb +++ b/app/controllers/ecloud_controller.rb @@ -59,10 +59,14 @@ class EcloudController < ApplicationController create_product_params(params['productparas'], ecloud.try(:id)) if params['productparas'].present? # 为管理员添加一条记录 # 开通的时候都是用户的opttype也是0 - EcloudUser.create!(custid: params['custid'], opttype: params['opttype'], userid: params['userid'], - username: params['username'], useralias: params['useralias'], - mobile: params['mobile'], email: params['email'], begintime: params['begintime'], - endtime: params['endtime']) + # 如果管理员已经存在,则不用重复开通 + euser = EcloudUser.where(id: params['userid'], custid: params['custid']).first + unless euser + EcloudUser.create!(custid: params['custid'], opttype: params['opttype'], userid: params['userid'], + username: params['username'], useralias: params['useralias'], + mobile: params['mobile'], email: params['email'], begintime: params['begintime'], + endtime: params['endtime']) + end elsif params['opttype'] == 2 # 试用转商用 # 变更企业/个人业务 # 业务列表:注销业务(注销试用的套餐),另一个业务项的操作代码是:新增业务(开通商用的套餐) # 需要通过产品服务编号和业务编码来区分哪个产品 diff --git a/app/models/ecloud_users.rb b/app/models/ecloud_users.rb index 9266adb7..99da0df2 100644 --- a/app/models/ecloud_users.rb +++ b/app/models/ecloud_users.rb @@ -1,3 +1,4 @@ class EcloudUser < ActiveRecord::Base + # opttype: # user['opttype']: 操作类型0:开通;1:变更;3: 取消授权;4:暂停;5:恢复; attr_accessible :begintime, :email, :endtime, :mobile, :opttype, :paras, :useralias, :userid, :username, :custid end diff --git a/db/migrate/20190314080802_create_shixun_student_works.rb b/db/migrate/20190314080802_create_shixun_student_works.rb index 240adc00..99c95c5c 100644 --- a/db/migrate/20190314080802_create_shixun_student_works.rb +++ b/db/migrate/20190314080802_create_shixun_student_works.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 class CreateShixunStudentWorks < ActiveRecord::Migration DCODES = %W(2 3 4 5 6 7 8 9 a b c f e f g h i j k l m n o p q r s t u v w x y z) diff --git a/db/migrate/20190314111921_migrate_shixun_works_1.rb b/db/migrate/20190314111921_migrate_shixun_works_1.rb index e3f18e34..38828b89 100644 --- a/db/migrate/20190314111921_migrate_shixun_works_1.rb +++ b/db/migrate/20190314111921_migrate_shixun_works_1.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 class MigrateShixunWorks1 < ActiveRecord::Migration DCODES = %W(2 3 4 5 6 7 8 9 a b c f e f g h i j k l m n o p q r s t u v w x y z) From 3839e8be60316a0fbda7388e6c081834d6d086cd Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 15 Mar 2019 14:08:27 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E8=BF=81=E7=A7=BB=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...90314080805_create_shixun_student_works.rb | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/db/migrate/20190314080805_create_shixun_student_works.rb b/db/migrate/20190314080805_create_shixun_student_works.rb index e0ebaec9..2861f22e 100644 --- a/db/migrate/20190314080805_create_shixun_student_works.rb +++ b/db/migrate/20190314080805_create_shixun_student_works.rb @@ -14,15 +14,15 @@ class MigrateShixunWorks1 < ActiveRecord::Migration end def up - begin - works = StudentWork.where("myshixun_id != 0 and myshixun_id not in (select id from myshixuns) and (work_score is null or work_score = 0)") - works.update_all(:myshixun_id => 0, :work_status => 0, :work_score => nil, :final_score => nil, - :cost_time => 0, :update_time => nil, :compelete_status => 0, :commit_time => nil) + works = StudentWork.where("myshixun_id != 0 and myshixun_id not in (select id from myshixuns) and (work_score is null or work_score = 0)") + works.update_all(:myshixun_id => 0, :work_status => 0, :work_score => nil, :final_score => nil, + :cost_time => 0, :update_time => nil, :compelete_status => 0, :commit_time => nil) - shixun_works = StudentWork.where("myshixun_id != 0 and myshixun_id not in (select id from myshixuns) and work_score > 0") - shixun_works.each do |work| - shixun = work.homework_common.try(:homework_commons_shixuns).try(:shixun) - user = work.user + shixun_works = StudentWork.where("myshixun_id != 0 and myshixun_id not in (select id from myshixuns) and work_score > 0") + shixun_works.each do |work| + shixun = work.homework_common.try(:homework_commons_shixuns).try(:shixun) + user = work.user + begin ActiveRecord::Base.transaction do if shixun.present? && user.present? # 创建新的myshixun和games @@ -81,11 +81,11 @@ class MigrateShixunWorks1 < ActiveRecord::Migration end end end + rescue Exception => e + puts ("###failed to exec shixun: current task id is #{e}") + # g.delete_project(gshixun.id) if gshixun.try(:id).present? + raise ActiveRecord::Rollback end - rescue Exception => e - puts ("###failed to exec shixun: current task id is #{e}") - # g.delete_project(gshixun.id) if gshixun.try(:id).present? - raise ActiveRecord::Rollback end end From 69ae7ea7ba13e07dcb256c77ef5d9014182169eb Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 15 Mar 2019 14:11:10 +0800 Subject: [PATCH 6/7] .. --- db/migrate/20190314080805_create_shixun_student_works.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/migrate/20190314080805_create_shixun_student_works.rb b/db/migrate/20190314080805_create_shixun_student_works.rb index 2861f22e..d40bb004 100644 --- a/db/migrate/20190314080805_create_shixun_student_works.rb +++ b/db/migrate/20190314080805_create_shixun_student_works.rb @@ -1,5 +1,5 @@ # encoding: utf-8 -class MigrateShixunWorks1 < ActiveRecord::Migration +class MigrateShixunWorks < ActiveRecord::Migration DCODES = %W(2 3 4 5 6 7 8 9 a b c f e f g h i j k l m n o p q r s t u v w x y z) def down_generate_identifier type From e354dcfaf0d331d6e3887cad20ec949e7d70bf24 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 15 Mar 2019 14:12:12 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/migrate/20190314080805_create_shixun_student_works.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/migrate/20190314080805_create_shixun_student_works.rb b/db/migrate/20190314080805_create_shixun_student_works.rb index d40bb004..0fe6b913 100644 --- a/db/migrate/20190314080805_create_shixun_student_works.rb +++ b/db/migrate/20190314080805_create_shixun_student_works.rb @@ -1,5 +1,5 @@ # encoding: utf-8 -class MigrateShixunWorks < ActiveRecord::Migration +class CreateShixunStudentWorks < ActiveRecord::Migration DCODES = %W(2 3 4 5 6 7 8 9 a b c f e f g h i j k l m n o p q r s t u v w x y z) def down_generate_identifier type