diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 649cf19d..987f2b70 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -878,7 +878,7 @@ class AccountController < ApplicationController if ApplyUserAuthentication.where(:user_id => @user.id, :status => 0, :auth_type => 1).count == 0 ApplyUserAuthentication.create(:user_id => @user.id, :status => 0, :auth_type => 1) begin - status = Trustie::Sms.send(mobile: '18173242757', send_type:'apply_auth' , name: '管理员') + status = Trustie::Sms.send(mobile: '18711085785', send_type:'apply_auth' , name: '管理员') rescue => e Rails.logger.error "发送验证码出错: #{e}" end @@ -937,7 +937,7 @@ class AccountController < ApplicationController if ApplyUserAuthentication.where(:user_id => @user.id, :status => 0, :auth_type => 2).count == 0 ApplyUserAuthentication.create(:user_id => @user.id, :status => 0, :auth_type => 2) begin - status = Trustie::Sms.send(mobile: '18173242757', send_type:'apply_pro_certification' , name: '管理员') + status = Trustie::Sms.send(mobile: '18711085785', send_type:'apply_pro_certification' , name: '管理员') rescue => e Rails.logger.error "发送验证码出错: #{e}" end @@ -946,7 +946,7 @@ class AccountController < ApplicationController if File.exist?(diskfile2) ApplyUserAuthentication.create(:user_id => @user.id, :status => 0, :auth_type => 2) begin - status = Trustie::Sms.send(mobile: '18173242757', send_type:'apply_pro_certification' , name: '管理员') + status = Trustie::Sms.send(mobile: '18711085785', send_type:'apply_pro_certification' , name: '管理员') rescue => e Rails.logger.error "发送验证码出错: #{e}" end diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 483a4ff3..5382a025 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -346,19 +346,19 @@ class ManagementsController < ApplicationController if mirror.blank? raise("choose_update_mirror exception") end - shixun_tomcat = Redmine::Configuration['shixun_tomcat'] - params = {imageName: mirror.name, imageID: old_id, flag: flag} - uri = "#{shixun_tomcat}/bridge/docker/updateImage" - res = uri_exec uri, params - if (res && res['code'] != 0) - raise("choose_update_mirror exception") - end + #shixun_tomcat = Redmine::Configuration['shixun_tomcat'] + #params = {imageName: mirror.name, imageID: old_id, flag: flag} + #uri = "#{shixun_tomcat}/bridge/docker/updateImage" + #res = uri_exec uri, params + # if (res && res['code'] != 0) + #raise("choose_update_mirror exception") + #end if flag == 0 - mirror.update_attributes(:mirrorID => change_id, :status => 0) + mirror.update_attributes(:mirrorID => change_id, :status => 1) # 用户操作的的行为需要记录 user_id, 中间层操作的行为user_id = -1 MirrorOperationRecord.create!(:mirror_repository_id => mirror.id, :mirror_id => change_id, :mirror_name => mirror.name, :status => 1, :user_id => User.current.id, :old_tag => old_id, :new_tag => change_id) else - mirror.update_attribute(:status, 0) + mirror.update_attribute(:status, 1) end respond_to do |format| format.js{ redirect_to mirror_repository_managements_path(:reaction => "choose_update_mirror")} @@ -720,20 +720,25 @@ class ManagementsController < ApplicationController shixun_tomcat = Redmine::Configuration['shixun_tomcat'] params = {imageName: @mirror.name} # 主从节点同步镜像 - uri = "#{shixun_tomcat}/bridge/docker/syncImage" - res = uri_exec uri, params - if (res && res['code'] != 0) - raise("Synchronize Mirror exception") - end + #uri = "#{shixun_tomcat}/bridge/docker/syncImage" + #res = uri_exec uri, params + #if (res && res['code'] != 0) + # raise("Synchronize Mirror exception") + #end end if @_params[:type_name] != @mirror.type_name - MirrorOperationRecord.create!(:mirror_repository_id => @mirror.id, :status => 5, :user_id => User.current.id, :old_tag => @mirror.type_name, :new_tag => @_params[:type_name]) + MirrorOperationRecord.create!(:mirror_repository_id => @mirror.id, :status => 5, + :user_id => User.current.id, :old_tag => @mirror.type_name, + :new_tag => @_params[:type_name]) elsif @_params[:status].to_i != @mirror.status - MirrorOperationRecord.create!(:mirror_repository_id => @mirror.id, :status => 6, :user_id => User.current.id, :old_tag => @mirror.status, :new_tag => @_params[:status]) + MirrorOperationRecord.create!(:mirror_repository_id => @mirror.id, :status => 6, + :user_id => User.current.id, :old_tag => @mirror.status, + :new_tag => @_params[:status]) end - @mirror.update_attributes(:description => @_params[:description], :status => @_params[:status], :main_type => @_params[:mirror_type], - :type_name => @_params[:type_name], :resource_limit => @_params[:mirror_resource_limit], :cpu_limit => @_params[:mirror_cpu_limit], - :memory_limit => @_params[:mirror_memory_limit], :time_limit => @_params[:mirror_time_limit]) + @mirror.update_attributes(:description => @_params[:description], :status => @_params[:status], + :main_type => @_params[:mirror_type], :type_name => @_params[:type_name], + :resource_limit => @_params[:mirror_resource_limit], :cpu_limit => @_params[:mirror_cpu_limit], + :memory_limit => @_params[:mirror_memory_limit], :time_limit => @_params[:mirror_time_limit]) @index = MirrorRepository.order("created_at desc").map(&:id).index(@mirror.id) respond_to do |format| format.js diff --git a/app/controllers/trainings_controller.rb b/app/controllers/trainings_controller.rb index c88cee80..8650a5a7 100644 --- a/app/controllers/trainings_controller.rb +++ b/app/controllers/trainings_controller.rb @@ -13,20 +13,6 @@ class TrainingsController < ApplicationController before_filter :check_training_type, only: [:enroll] before_filter :check_current_training, only: [:show, :update, :pay, :pay_js, :update_payinfo, :result] - # TODO: 测试完成后删除 - ALLOW_OPENID_LIST = [ - 'o5fSc08-NDxC2564k9USCuiuC9cY', - 'o5fSc097mQbwhYVLK9DAIa3uz_ug', - 'o5fSc0607iR3rp4-h_VnuBTp8CiM', - 'o5fSc0-nX6bUGQNQt3FrRhUKVNIw', - 'o5fSc0607iR3rp4-h_VnuBTp8CiM' - ] - before_filter :check_openid, only: [:update_payinfo] - def check_openid - return if ALLOW_OPENID_LIST.include?(session[:wechat_open_id]) - render plain: '暂未开放' - end - layout 'base_trainings' def show @@ -37,18 +23,22 @@ class TrainingsController < ApplicationController return end - # TODO: 测试完成后删除 - @test_wxpay = ALLOW_OPENID_LIST.include?(session[:wechat_open_id]) - render 'trainingsInfo' end def enroll @training = current_training || Training.new - if @training.training_payinfo.present? && params[:disable_redirect].blank? - redirect_to result_training_path(id: friendly_id) - return + if params[:disable_redirect].blank? + if @training.training_payinfo.present? + redirect_to result_training_path(id: friendly_id) + return + end + + unless @training.new_record? + redirect_to training_path(id: friendly_id) + return + end end end @@ -60,9 +50,6 @@ class TrainingsController < ApplicationController @training.training_payinfo.fee = @training.registration_fee @training.training_payinfo.pay_type = params[:pay_type].presence || 3 end - - # TODO: 测试完成后删除 - @test_wxpay = ALLOW_OPENID_LIST.include?(session[:wechat_open_id]) end def pay_callback @@ -168,13 +155,8 @@ class TrainingsController < ApplicationController training_info.save! - # TODO: 测试完成后删除 - @test_wxpay = ALLOW_OPENID_LIST.include?(session[:wechat_open_id]) - if params[:js] == 'true' && training_info.not_payed? - Rails.logger.info("### start wechat pay => fee: #{training_info.fee}") - # TODO: 测试完成后删除 - _pay_js(@test_wxpay ? 0.01 : training_info.fee) + _pay_js(training_info.fee) else redirect_to result_training_path(id: friendly_id) end @@ -203,6 +185,7 @@ class TrainingsController < ApplicationController #js获取支付参数 def _pay_js(fee) + Rails.logger.info("### start wechat pay => fee: #{fee}") @training = current_training js_function_call do out_trade_no = Wechat.pay.gen_trade_no diff --git a/app/models/training.rb b/app/models/training.rb index cb7f2db7..8bb9c6d3 100644 --- a/app/models/training.rb +++ b/app/models/training.rb @@ -1,7 +1,7 @@ #encoding: utf-8 class Training < ActiveRecord::Base attr_accessible :address, :email, :name, :phone, :position, :school, :sex, :openid, :training_type, - :major, :student_id + :major, :student_id, :job_title, :uncertified_major # training_type 1 2018-培训会 2 警察学院大数据培训会 3 大数据和人工智能 4 工程教育认证 @@ -38,7 +38,7 @@ class Training < ActiveRecord::Base # 三人以上 8折 num >= 3 ? 3000.0 * 0.8 * num : 3000.0 * num when 4 then - 1200.0 * num + 700.0 * num else raise ArgumentError end diff --git a/app/views/layouts/base_management.html.erb b/app/views/layouts/base_management.html.erb index eb6ce06d..48fee5c4 100644 --- a/app/views/layouts/base_management.html.erb +++ b/app/views/layouts/base_management.html.erb @@ -137,7 +137,7 @@
您关注的课程类型(最少选1项)
@@ -242,6 +261,13 @@ return; } + <% if @training_type == 4 %> + if ($("#uncertifiedMajor").val() == '') { + alert("请输入专业名称"); + return; + } + <% end %> + <% if @training_type == 3 %> if ($("input[type='checkbox'][name='research_field[]']:checked").length == 0) { alert('请选择您关注的课程类型'); diff --git a/app/views/trainings/pay.html.erb b/app/views/trainings/pay.html.erb index 903876cf..7426cfa3 100644 --- a/app/views/trainings/pay.html.erb +++ b/app/views/trainings/pay.html.erb @@ -2,18 +2,10 @@- <% if @test_wxpay %> - <%= @training.training_payinfo.pay_type.to_i == 3 ? "线下支付" : "微信支付" %> - <% else %> - 线下支付 - <% end %> + <%= @training.training_payinfo.pay_type.to_i == 3 ? "线下支付" : "微信支付" %>
@@ -186,10 +182,10 @@ // $(this).addClass("active"); // billTypeShowFun(parseInt($(this).index()), userInfo); // }) - // //关闭弹窗 - // $(".billClose").on("click", function () { - // hideNav($(".downNav")); - // }); + //关闭弹窗 + $(".billClose").on("click", function () { + hideNav($(".downNav")); + }); //延迟支付,直接提交 $('#delayPayBtn').on('click', function () { @@ -266,6 +262,12 @@ $('form').submit(); }); + // 微信支付后修改内容提交 + $("#submitWxpayFormBtn").on('click', function () { + if(!checkBillInfo()){ return; } + $('form').submit(); + }); + //上传头像 InitPhoto(); diff --git a/app/views/trainings/result.html.erb b/app/views/trainings/result.html.erb index d43da5f0..41091e30 100644 --- a/app/views/trainings/result.html.erb +++ b/app/views/trainings/result.html.erb @@ -17,10 +17,22 @@ <%= @training.position %> + <% if @training_type == 4 %> ++ + <%= @training.job_title %> +
+ <% end %><%= @training.phone %>
+ <% if @training_type == 4 %> ++ + <%= @training.uncertified_major %> +
+ <% end %><%= @training.training_payinfo.info %>
+ <% end %> + + <% if @training.training_payinfo.attachment_id.to_i > 0 || @training.training_payinfo.pay_type != TrainingPayinfo::PayType_Wechat %> + + + <%= render partial: 'upload_img', locals: { training: @training, disabled: true } %> + <% end %> +温馨提示:支持现场缴费