From 914660ad9f8de05619d2941e51d4df7b82f89644 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Fri, 15 Mar 2019 17:25:04 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E4=B8=80=E4=BA=9B=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 3 ++- app/controllers/ecloud_controller.rb | 12 +++++++----- app/models/ecloud_service.rb | 1 + 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 262efb00..6792babf 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -68,7 +68,8 @@ class ApplicationController < ActionController::Base def ecloud_auth ucloud_user_id euser = EcloudUser.where("id =? and opttype not in(3, 5)", ucloud_user_id).first if euser.present? # 开通过业务 - # + # ni + else false end diff --git a/app/controllers/ecloud_controller.rb b/app/controllers/ecloud_controller.rb index edf568a9..080b2565 100644 --- a/app/controllers/ecloud_controller.rb +++ b/app/controllers/ecloud_controller.rb @@ -55,12 +55,12 @@ class EcloudController < ApplicationController begin if params['opttype'] == 0 # 开通企业/个人业务 ecloud = Ecloud.create!(eloud_params) - create_service(params['services'], ecloud.try(:id)) + create_service(params['services'], ecloud.try(:id)) if params['services'].present? create_product_params(params['productparas'], ecloud.try(:id)) if params['productparas'].present? # 为管理员添加一条记录 # 开通的时候都是用户的opttype也是0 # 如果管理员已经存在,则不用重复开通 - euser = EcloudUser.where(id: params['userid'], custid: params['custid']).first + euser = EcloudUser.where(userid: 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'], @@ -88,7 +88,8 @@ class EcloudController < ApplicationController elsif params['opttype'] == 1 # 业务变更 ecloud = Ecloud.where(custid: params['custid'], custcode: params['custcode'], productcode: params['productcode']).first # 套餐变更 - # 新增业务 + # 操作代码 0:新增业务,1:注销业务2:修改业务 + # # 新增服务 add_service = params['services'].select{|s| s['opttype'] == 0} create_service(add_service, ecloud.try(:id)) if add_service.present? @@ -106,8 +107,8 @@ class EcloudController < ApplicationController if edt_services.present? edt_services.each do |es| ese = EcloudService.where(ecloud_id: ecloud.try(:id), code: es['code']).first - ese.update_attributes!(opttype: es['opttype'], begintime: es['begintime'], endtime: es['endtime']) - create_serviceparas es['serviceparas'].first, ese.id + ese.update_attributes!(opttype: es['opttype'], begintime: es['begintime'], endtime: es['endtime']) if ese.present? + create_serviceparas(es['serviceparas'].first, ese.id) if ese.present? end end @@ -120,6 +121,7 @@ class EcloudController < ApplicationController # ecloud_id = ecloud.try(:id) elsif params['opttype'] == 4 # 再次重复开通 + # 再次申请开通,这种情况就是累加时间 ecloud = Ecloud.where(custid: params['custid'], custcode: params['custcode'], productcode: params['productcode']).first create_service(params['services'], ecloud.try(:id)) create_product_params(params['productparas'], ecloud.try(:id)) if params['productparas'].present? diff --git a/app/models/ecloud_service.rb b/app/models/ecloud_service.rb index 4a388ed4..dba4a7b2 100644 --- a/app/models/ecloud_service.rb +++ b/app/models/ecloud_service.rb @@ -1,3 +1,4 @@ +# 操作代码 0:新增业务,1:注销业务2:修改业务 class EcloudService < ActiveRecord::Base attr_accessible :begintime, :code, :endtime, :opttype, :ecloud_id, :packagecode, :bossorderid belongs_to :ecloud From a791f1bc534b43333ecf64af2a9bb9e321f20140 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 18 Mar 2019 11:21:53 +0800 Subject: [PATCH 2/9] .. --- app/controllers/application_controller.rb | 58 ++++++++++++++++++++--- 1 file changed, 52 insertions(+), 6 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 6792babf..eeaafd16 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -65,16 +65,62 @@ 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? # 开通过业务 - # ni + # 云启训练场(EduCoder)个人版 产品编码(appId) 9200108 + # 产品名称 计费类型 套餐编码 + # 云启训练场(EduCoder)个人版 固定包月 9200108001 + # 固定包月 9200108002 + # 固定包月 9200108003 + # --------------------------------------------------- + # 产品名称 计费类型 套餐编码 + # 云启训练场(EduCoder))院校版 包月+按license 9200109001 + # 包月+按license 9200109002 + + # 云启训练场(EduCoder))院校版 产品编码(appId) 9200109 + def ecloud_auth subject_id + # euser = EcloudUser.where("userid =? and opttype not in(3, 5)", User.current.id).first + # if euser.present? # 开通过业务 + # # 获取用户的套餐信息 + # e_service = euser.ecloud_services.where("opttype != 1") + # # 如果用户开通过服务 + # if e_service.present? + # if e_service.count >1 # 说明有重复开通过业务 + # else + # code = e_service.first.try(:code) + # + # end + # end + # else + # false # 没开通过服务,或者服务被禁用则不允许访问 + # end + # + # + # + # + # if e_service.count > 1 # 说明有重复订购过套餐 + # else + # code = e_service.try(:code) + # end + # service_count = euser.ecloud_services.where("opttype != 1").try(:code) + # + # end + # 如果不是Ecloud过来的用户,则不改变用户的使用状态及权限,按现有模式即可 + end - else - false + # 根据业务确定权限 + def ecloud_services_auth code, subject_id + subject = Subject.find(subject_id) + subject_level = subject.subject_level_system.try(:level) + case code + when "9200108001" + subject_level.to_i == 1 ? true : false + when "9200108002" + + end 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 || From 95098fafd4a8b1178a5737b32a834c6b512d13b2 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 18 Mar 2019 11:23:54 +0800 Subject: [PATCH 3/9] .. --- app/controllers/application_controller.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index eeaafd16..8bb217cc 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -110,13 +110,13 @@ class ApplicationController < ActionController::Base def ecloud_services_auth code, subject_id subject = Subject.find(subject_id) subject_level = subject.subject_level_system.try(:level) - case code - when "9200108001" - subject_level.to_i == 1 ? true : false - when "9200108002" - - end - end + # case code + # when "9200108001" + # subject_level.to_i == 1 ? true : false + # when "9200108002" + # + # end + # end end From 2c6e1ba86821a1062c9beddf7867d1fd9a090b43 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 18 Mar 2019 14:11:31 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E6=8A=A5=E5=91=8A?= =?UTF-8?q?=E7=9A=84=E6=95=B0=E6=8D=AE=E6=80=BB=E8=A1=A8=E4=B8=8E=E5=88=86?= =?UTF-8?q?=E8=A1=A8=E7=9A=84=E6=95=B0=E6=8D=AE=E6=B2=A1=E6=9C=89=E5=8C=B9?= =?UTF-8?q?=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 2 +- app/helpers/shixuns_helper.rb | 2 +- app/views/student_work/shixun_work_report.html.erb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 2537c465..a368f88b 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -113,7 +113,7 @@ class StudentWorkController < ApplicationController pass_consume_time += (game.cost_time / 60.0).to_f end all_time += (game.cost_time / 60.0).to_f - user_total_score += game.final_score.to_i < 0 ? 0 : game.challenge.score.to_i + user_total_score += game.status == 2 ? game.final_score.to_i < 0 ? 0 : game.challenge.score.to_i : 0 if myshixun.user_id == @work.user.id @game_user_query << [game.id, game.outputs.first.try(:query_index).to_i] end diff --git a/app/helpers/shixuns_helper.rb b/app/helpers/shixuns_helper.rb index 23168ccf..a42225cd 100644 --- a/app/helpers/shixuns_helper.rb +++ b/app/helpers/shixuns_helper.rb @@ -5,7 +5,7 @@ module ShixunsHelper def myshixun_exp myshixun score = 0 myshixun.games.each do |game| - score += game.final_score.to_i < 0 ? 0 : game.challenge.score.to_i + score += game.status == 2 ? game.final_score.to_i < 0 ? 0 : game.challenge.score.to_i : 0 end score end diff --git a/app/views/student_work/shixun_work_report.html.erb b/app/views/student_work/shixun_work_report.html.erb index 9577d57e..34449b17 100644 --- a/app/views/student_work/shixun_work_report.html.erb +++ b/app/views/student_work/shixun_work_report.html.erb @@ -81,7 +81,7 @@ <%= user_query.blank? ? "--" : user_query.first[1] %> <%= game.try(:end_time).nil? ? "--" : format_time(game.end_time) %> <%= game.consumes_time %> - <%= game.final_score.to_i < 0 ? 0 : game.challenge.score.to_i %> / <%= game.challenge.st == 1 ? game.challenge.choose_score : game.challenge.score %> + <%= game.status == 2 ? (game.final_score.to_i < 0 ? 0 : game.challenge.score.to_i) : 0 %> / <%= game.challenge.st == 1 ? game.challenge.choose_score : game.challenge.score %> <% end %> From 999aba69f4faee83f1be5851ab0d3558ca6021a2 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 19 Mar 2019 09:14:25 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E8=B6=85=E7=BA=A7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E7=9A=84=E8=AF=95=E7=94=A8=E6=8E=88=E6=9D=83=E5=AE=A1?= =?UTF-8?q?=E6=89=B9-=E5=B7=B2=E5=AE=A1=E6=89=B9=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E3=80=81=E4=BB=A5=E5=8F=8A=E7=94=A8=E6=88=B7=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=AD=9B=E9=80=89=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/managements_controller.rb | 56 +++++++++--- .../managements/trial_authorization.html.erb | 85 +++++++++--------- app/views/managements/users.html.erb | 86 +++++++++++-------- public/stylesheets/educoder/edu-main.css | 1 + 4 files changed, 140 insertions(+), 88 deletions(-) diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 9992d000..599e8da4 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -2104,25 +2104,36 @@ end condition = (params[:research_condition].nil? || params[:research_condition] == "name") ? "concat(lastname, firstname)" : params[:research_condition] if 0 == status if params[:research_condition] == "phone" && params[:research_contents].blank? - @users = User.order("#{@order_key} #{@us_order}") + @users = User.where(nil) else - @users = User.where("#{condition} like '%#{params[:research_contents]}%'").order("#{@order_key} #{@us_order}") + @users = User.where("#{condition} like '%#{params[:research_contents]}%'") end else if params[:research_condition] == "phone" && params[:research_contents].blank? - @users = User.where(:status => status).order("#{@order_key} #{@us_order}") + @users = User.where(:status => status) else - @users = User.where("status = #{status} and #{condition} like '%#{params[:research_contents]}%'").order("#{@order_key} #{@us_order}") + @users = User.where("status = #{status} and #{condition} like '%#{params[:research_contents]}%'") end end + if params[:identity] && params[:identity].to_i != -1 + @users = @users.includes(:user_extensions).where("user_extensions.identity = ?", params[:identity].to_i) + end + + if params[:auto_school] && params[:auto_school].to_i != 0 + @users = @users.includes(:user_extensions => [:school]).where("schools.auto_users_trial = ?", params[:auto_school].to_i == 1 ? 1 : 0) + end + if params[:school] && params[:school] != '' school_name = params[:school] school = School.where("name like '%#{school_name}%'") school_id = school.map(&:id) user_id = UserExtensions.where(:school_id => school_id).map(&:user_id) - @users = @users.where(:id => user_id).order("#{@order_key} #{@us_order}") + @users = @users.where(:id => user_id) end + + @users = @users.order("#{@order_key} #{@us_order}") + @page = (params['page'] || 1).to_i @users_count = @users.count @limit = 20 @@ -3186,25 +3197,44 @@ end search = params[:search] @status = trial_authorization_status(params[:status]) # @status = (params[:status].blank? || params[:status] == "0") ? 0 : [1,2] - if search.blank? - @authorizations = ApplyAction.where(:container_type => "TrialAuthorization", :status => @status).includes(:user) - else - user_id = User.find_by_sql("select id from users where concat(lastname,firstname) like '%#{search}%'") - @authorizations = ApplyAction.where(:container_type => "TrialAuthorization", :status => @status, :user_id => user_id).includes(:user) + user_id = [] + search = false + @authorizations = ApplyAction.where(:container_type => "TrialAuthorization", :status => @status) + + unless search.blank? + user_id = User.find_by_sql("select id from users where concat(lastname,firstname) like '%#{search}%'").map(&:id) end - if params[:sname] && params[:sname] != '' + if params[:sname] && params[:sname].strip != '' school_id = School.where("name like '%#{params[:sname]}%'") - user_id = UserExtensions.where(:school_id => school_id).map(&:user_id) - @authorizations = @authorizations.where(:user_id => user_id).order("updated_at desc") + new_user_id = UserExtensions.where(:school_id => school_id).map(&:user_id) + user_id = user_id.size == 0 ? new_user_id : user_id & new_user_id + search = true + end + + if params[:identity] && params[:identity].to_i != -1 + new_user_id = UserExtensions.where(:identity => params[:identity].to_i).map(&:user_id) + user_id = user_id.size == 0 ? new_user_id : user_id & new_user_id + search = true end + if params[:auto_school] && params[:auto_school].to_i != 0 + school_id = School.where(auto_users_trial: params[:auto_school].to_i == 1 ? 1 : 0) + new_user_id = UserExtensions.where(:school_id => school_id).map(&:user_id) + user_id = user_id.size == 0 ? new_user_id : user_id & new_user_id + search = true + end + + @authorizations = user_id.size == 0 && !search ? @authorizations.order("updated_at desc") : @authorizations.where(:user_id => user_id.uniq).order("updated_at desc") + @autu_count = @authorizations.count @limit = 15 @is_remote = true @autu_pages = Paginator.new @autu_count, @limit, params['page'] || 1 @offset ||= @autu_pages.offset @authorizations = paginateHelper @authorizations, @limit + + @authorizations = @authorizations.includes(:user) respond_to do |format| format.js format.html diff --git a/app/views/managements/trial_authorization.html.erb b/app/views/managements/trial_authorization.html.erb index 5f2c17a1..acdc4d69 100644 --- a/app/views/managements/trial_authorization.html.erb +++ b/app/views/managements/trial_authorization.html.erb @@ -28,11 +28,22 @@
-

+

全部 同意 拒绝

+ +
@@ -91,59 +102,55 @@ }); /* ----------------------- 已审批(全部) ------------------------- */ - $("#audit_all_authentication").on("click", function(){ - var iName = $("#audit_search_name").val(); - var sName = $("#school_search_name").val(); - - $.ajax({ - url: "<%= trial_authorization_managements_path %>" + ".js", - data: { name: iName, status: [1, 2], sname: sName } - }); - }); + $("#audit_all_authentication").on("click", function(){search_func([1, 2]);}); /* ----------------------- 已审批(同意) ------------------------- */ - $("#audit_agree_authentication").live("click", function(){ - var iName = $("#audit_search_name").val(); - var sName = $("#school_search_name").val(); - - $.ajax({ - url: "<%= trial_authorization_managements_path %>" +".js", - data: { name: iName, status: 1, sname: sName} - }); - }); + $("#audit_agree_authentication").live("click", function(){search_func(1);}); /* ----------------------- 已审批(拒绝) ------------------------- */ - $("#audit_reject_authentication").live("click", function(){ - var iName = $("#audit_search_name").val(); - var sName = $("#school_search_name").val(); + $("#audit_reject_authentication").live("click", function(){search_func(2);}); - $.ajax({ - url: "<%= trial_authorization_managements_path %>" +".js", - data: { name: iName, status: 2, sname: sName } - }); + /* ------------------- 按名字进行搜索(已审批)-------------------- */ + $("#audit_search").live("click", function(){search_func(0);}); + $("#user_identity").on("change", function(){search_func(0);}); + $("#auto_school").on("change", function(){search_func(0);}); + + $("#audit_search_name, #school_search_name").on("keydown", function(e){ + // 兼容FF和IE和Opera + var theEvent = e || window.event; + var code = theEvent.keyCode || theEvent.which || theEvent.charCode; + if (code == 13) { + //回车执行查询 + search_func(0); + } }); - /* ------------------- 按名字进行搜索(已审批)-------------------- */ - $("#audit_search").live("click", function(){ + function search_func(status){ var iName = $("#audit_search_name").val(); var sName = $("#school_search_name").val(); + var identity = $("#user_identity").val(); + var auto_school = $("#auto_school").val(); + var type = status; - var id = $("#audit_all_authentication").parent().find(".active").attr("id"); - var type = 0; + if(type == 0){ + var id = $("#audit_all_authentication").parent().find(".active").attr("id"); - if(id == "audit_all_authentication"){ - type = [1, 2]; - }else if(id=="audit_agree_authentication"){ - type = 1; - }else{ - type = 2; + if(id == "audit_all_authentication"){ + type = [1, 2]; + }else if(id=="audit_agree_authentication"){ + type = 1; + }else{ + type = 2; + } } -// alert(type); + $.ajax({ url: "<%= trial_authorization_managements_path %>" +".js", - data: { search: iName, status: type, sname: sName} + data: { search: iName, status: type, sname: sName, identity: identity, auto_school: auto_school} }); - }); + } + + // $(document).keyup(function(event){ // if(event.keyCode == 13){ diff --git a/app/views/managements/users.html.erb b/app/views/managements/users.html.erb index e707214e..9b01dab3 100644 --- a/app/views/managements/users.html.erb +++ b/app/views/managements/users.html.erb @@ -1,40 +1,53 @@
<%= form_tag(url_for(users_managements_path), :id => "managements_users_search", :method => "post", :remote => true) do %> -
-

全部状态

- -
    -
  • 全部状态
  • -
  • 活动的(<%= query_user_status_num 1 %>)
  • -
  • 未激活(<%= query_user_status_num 2 %>)
  • -
  • 已锁定(<%= query_user_status_num 3 %>)
  • -
-
-
-

真实姓名搜索

- -
    -
  • 真实姓名搜索
  • -
  • 用户id搜索
  • -
  • 邮箱地址搜索
  • -
  • 手机号码搜索
  • -
-
-
- -
-
  • - - -
    -
  • - +
    +

    全部状态

    + +
      +
    • 全部状态
    • +
    • 活动的(<%= query_user_status_num 1 %>)
    • +
    • 未激活(<%= query_user_status_num 2 %>)
    • +
    • 已锁定(<%= query_user_status_num 3 %>)
    • +
    +
    +
    +

    真实姓名搜索

    + +
      +
    • 真实姓名搜索
    • +
    • 用户id搜索
    • +
    • 邮箱地址搜索
    • +
    • 手机号码搜索
    • +
    +
    - 搜索 - 清除 + + - +
    + +
    +
  • + + +
    +
  • + + + 搜索 + 清除 + + 课堂添加成员 <% end %>
    @@ -42,7 +55,7 @@ <%= render :partial => "managements/user_list" %>
    \ No newline at end of file diff --git a/app/views/managements/users.html.erb b/app/views/managements/users.html.erb index 9b01dab3..3117e124 100644 --- a/app/views/managements/users.html.erb +++ b/app/views/managements/users.html.erb @@ -44,6 +44,9 @@ + + + 搜索 清除 From 99a47e1c8ec47c97714ada703b51bc94c0cc6483 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 19 Mar 2019 16:08:55 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E8=B6=85=E7=BA=A7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E7=9A=84=E8=87=AA=E5=8A=A8=E6=8E=88=E6=9D=83=E5=8D=95?= =?UTF-8?q?=E4=BD=8D=E5=88=97=E8=A1=A8=E4=B8=AD=EF=BC=8C=E4=BB=85=E7=BB=99?= =?UTF-8?q?=E2=80=9D=E5=AD=A6=E7=94=9F=E2=80=9C=E8=87=AA=E5=8A=A8=E6=8E=88?= =?UTF-8?q?=E6=9D=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/account_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 34552787..e5f4f8b4 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -1038,7 +1038,7 @@ class AccountController < ApplicationController apply_action = ApplyAction.where(:user_id => User.current.id, :container_type => "TrialAuthorization", :status => 0).first school_ids = School.where(:auto_users_trial => 1).map(&:id) user_ex = User.current.user_extensions - if (user_ex.identity == 0 || (user_ex.identity == 1 && user_ex.student_id.present?)) && !user_ex.school.nil? && school_ids.include?(user_ex.school_id) + if user_ex.identity == 1 && user_ex.student_id.present? && !user_ex.school.nil? && school_ids.include?(user_ex.school_id) User.current.update_attributes(:certification => 1) logger.warn("apply_trail #######{User.current.login} ****#{User.current.user_extensions.school_id}") @tip = "申请已提交,我们将在1分钟内完成审核" From a8fb7072305beaf3fd83a10fe720504588acb9e0 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 19 Mar 2019 16:19:06 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E8=BF=87=E6=9D=A5=E7=9A=84=E6=89=8B=E6=9C=BA=E5=8F=B7=E6=9C=89?= =?UTF-8?q?=E7=9B=B8=E5=90=8C=E7=9A=84=E6=83=85=E5=86=B5=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/ecloud_controller.rb | 2 +- app/models/user.rb | 38 ++++++++++++++++------------ 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/app/controllers/ecloud_controller.rb b/app/controllers/ecloud_controller.rb index c49b34a6..6ff6d1ef 100644 --- a/app/controllers/ecloud_controller.rb +++ b/app/controllers/ecloud_controller.rb @@ -43,7 +43,7 @@ class EcloudController < ApplicationController CLIENT_ID = '1056' CLIENT_SECRET = '2e84256a-3de4-4713-9e02-10ee88a14592' SERVER_URL = "https://221.176.53.130:44390/services/" - +q ## 签名 diff --git a/app/models/user.rb b/app/models/user.rb index fdb9566a..31c58f26 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1693,31 +1693,37 @@ class User < Principal end def self.create_with_ecoder!(info) - user = User.new - user.admin = false - user.login = "ecoder_" + info["mobile"] + user = User.find_by_phone(info["mobile"]) - user.phone = info["mobile"] + # 如果手机号存在,则直接绑定用户 + # 因为手机号可以取回密码,所以可以视为同一用户 + unless user + user = User.new + user.admin = false + user.login = "ecoder_" + info["mobile"] - unless User.find_by_mail(info["email"]) - user.mail = info["email"] - end - user.nickname = info["username"] + user.phone = info["mobile"] + + unless User.find_by_mail(info["email"]) + user.mail = info["email"] + end + user.nickname = info["username"] - user.activate - user.last_login_on = Time.now + user.activate + user.last_login_on = Time.now - user.ecoder_user_id = info["userid"] + user.ecoder_user_id = info["userid"] - user.save!(:validate => false) + user.save!(:validate => false) - UserStatus.create!(:user_id => user.id, :changsets_count => 0, :watchers_count => 0) + UserStatus.create!(:user_id => user.id, :changsets_count => 0, :watchers_count => 0) - ue = user.user_extensions ||= UserExtensions.new - ue.user_id = user.id - ue.save! + ue = user.user_extensions ||= UserExtensions.new + ue.user_id = user.id + ue.save! + end user end From ebe9ee145b81345058b32a1f3197fdb040eb7940 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 19 Mar 2019 16:45:14 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E6=8A=A5=E5=91=8A?= =?UTF-8?q?=E7=9A=84=E5=BC=80=E5=90=AF=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/student_work/shixun_work_report.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/student_work/shixun_work_report.html.erb b/app/views/student_work/shixun_work_report.html.erb index 34449b17..a7307405 100644 --- a/app/views/student_work/shixun_work_report.html.erb +++ b/app/views/student_work/shixun_work_report.html.erb @@ -76,7 +76,7 @@ 延时 <% end %> - <%= game.try(:open_time).nil? ? "--" : format_time(game.open_time) %> + <%= game.try(:open_time).nil? || game.status == 3 ? "--" : format_time(game.open_time) %> <% user_query = @game_user_query.select{|user_query| user_query[0] == game.id} %> <%= user_query.blank? ? "--" : user_query.first[1] %> <%= game.try(:end_time).nil? ? "--" : format_time(game.end_time) %>