From b1306711da97df28e05f3b61e48bd6d5893e3e29 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Tue, 18 Jun 2019 19:41:30 +0800 Subject: [PATCH 1/7] add wechat oauth file --- public/MP_verify_FL7DKThNNDDEnU4k.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 public/MP_verify_FL7DKThNNDDEnU4k.txt diff --git a/public/MP_verify_FL7DKThNNDDEnU4k.txt b/public/MP_verify_FL7DKThNNDDEnU4k.txt new file mode 100644 index 00000000..5f5ee70d --- /dev/null +++ b/public/MP_verify_FL7DKThNNDDEnU4k.txt @@ -0,0 +1 @@ +FL7DKThNNDDEnU4k \ No newline at end of file From ef8ee3c7e5df7814cfe9c97d3f33d3ef2fcea769 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Tue, 18 Jun 2019 20:23:42 +0800 Subject: [PATCH 2/7] test wexpau --- app/controllers/trainings_controller.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/app/controllers/trainings_controller.rb b/app/controllers/trainings_controller.rb index c88cee80..d97cd53b 100644 --- a/app/controllers/trainings_controller.rb +++ b/app/controllers/trainings_controller.rb @@ -15,11 +15,7 @@ class TrainingsController < ApplicationController # TODO: 测试完成后删除 ALLOW_OPENID_LIST = [ - 'o5fSc08-NDxC2564k9USCuiuC9cY', - 'o5fSc097mQbwhYVLK9DAIa3uz_ug', - 'o5fSc0607iR3rp4-h_VnuBTp8CiM', - 'o5fSc0-nX6bUGQNQt3FrRhUKVNIw', - 'o5fSc0607iR3rp4-h_VnuBTp8CiM' + 'oSrqE52fgGMooW3B1K4mZ0Le5G9I' ] before_filter :check_openid, only: [:update_payinfo] def check_openid From 65c91f890a1df521e4494fe968d87e4c69699e9b Mon Sep 17 00:00:00 2001 From: p31729568 Date: Wed, 19 Jun 2019 09:18:19 +0800 Subject: [PATCH 3/7] open wechat pay method --- app/controllers/trainings_controller.rb | 37 +++++++--------------- app/models/training.rb | 2 +- app/views/trainings/pay.html.erb | 24 +++++++------- app/views/trainings/result.html.erb | 6 ++-- app/views/trainings/trainingsInfo.html.erb | 7 +--- 5 files changed, 30 insertions(+), 46 deletions(-) diff --git a/app/controllers/trainings_controller.rb b/app/controllers/trainings_controller.rb index d97cd53b..8650a5a7 100644 --- a/app/controllers/trainings_controller.rb +++ b/app/controllers/trainings_controller.rb @@ -13,16 +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 = [ - 'oSrqE52fgGMooW3B1K4mZ0Le5G9I' - ] - 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 @@ -33,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 @@ -56,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 @@ -164,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 @@ -199,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..58de07ab 100644 --- a/app/models/training.rb +++ b/app/models/training.rb @@ -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/trainings/pay.html.erb b/app/views/trainings/pay.html.erb index 903876cf..9aebe19f 100644 --- a/app/views/trainings/pay.html.erb +++ b/app/views/trainings/pay.html.erb @@ -2,18 +2,10 @@
<%= hidden_field_tag(:friendly_id, @friendly_id) %> - <% if @test_wxpay %> -
- <% else %> -
- <% end %> +
>

- <% if @test_wxpay %> - <%= @training.training_payinfo.pay_type.to_i == 3 ? "线下支付" : "微信支付" %> - <% else %> - 线下支付 - <% end %> + <%= @training.training_payinfo.pay_type.to_i == 3 ? "线下支付" : "微信支付" %>

mt5" id="payInfos"> @@ -107,7 +99,11 @@
" id="paySubmitBtn"> 返回 - 立即支付 + <% if @training.training_payinfo.not_payed? %> + 立即支付 + <% else %> + 提交 + <% end %>
@@ -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..c71758ab 100644 --- a/app/views/trainings/result.html.erb +++ b/app/views/trainings/result.html.erb @@ -121,7 +121,7 @@ // eruda.init(); function wechatPay() { $.ajax({ - url: '<%= pay_js_trainings_path %>', + url: '<%= pay_js_trainings_path(friendly_id: @friendly_id) %>', type: "POST", data: '{}' } @@ -147,7 +147,7 @@ // 使用以上方式判断前端返回,微信团队郑重提示: //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。 setTimeout(function () { - window.location.href = "/trainings/<% @tag_id %>/result"; + window.location.href = "/trainings/<% @friendly_id %>/result"; }, 500); } else if (res.err_msg == 'get_brand_wcpay_request:cancel') { @@ -189,7 +189,7 @@ var data = new FormData(); data.append('image', files[0]); - data.append('tag_id', '<%= @tag_id %>'); + data.append('friendly_id', '<%= @friendly_id %>'); $.ajax({ url: '<%= update_picture_trainings_path %>', diff --git a/app/views/trainings/trainingsInfo.html.erb b/app/views/trainings/trainingsInfo.html.erb index e71b9c07..964455bc 100644 --- a/app/views/trainings/trainingsInfo.html.erb +++ b/app/views/trainings/trainingsInfo.html.erb @@ -41,12 +41,7 @@ <% if @training.training_payinfo.blank? || @training.training_payinfo.not_payed? %>
<%= link_to '转账支付', pay_training_path(id: @friendly_id, pay_type: 3), class: 'leftbtn' %> - - <% if @test_wxpay %> - <%= link_to '微信支付', pay_training_path(id: @friendly_id, pay_type: 1), class: 'rightbtn' %> - <% else %> - 微信支付 - <% end %> + <%= link_to '微信支付', pay_training_path(id: @friendly_id, pay_type: 1), class: 'rightbtn' %>
<% else %>
From 4925e9f4c028a647332efe10ecf835b73f48d3aa Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 19 Jun 2019 09:22:50 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E5=AE=9E=E5=90=8D=E8=AE=A4=E8=AF=81?= =?UTF-8?q?=E5=92=8C=E8=81=8C=E4=B8=9A=E8=AE=A4=E8=AF=81=E7=9A=84=E7=9F=AD?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E6=8F=90=E9=86=92=E6=9B=B4=E6=8D=A2=E6=89=8B?= =?UTF-8?q?=E6=9C=BA=E5=8F=B7=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/account_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 128475e6..544865fd 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -876,7 +876,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 @@ -935,7 +935,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 @@ -944,7 +944,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 From b41ca035dd9dd0cecadae3036fef9fbe191792ee Mon Sep 17 00:00:00 2001 From: p31729568 Date: Wed, 19 Jun 2019 09:41:41 +0800 Subject: [PATCH 5/7] add whitelist for wxpay test --- app/controllers/trainings_controller.rb | 25 +++++++++++++++++++++- app/views/trainings/pay.html.erb | 14 ++++++++++-- app/views/trainings/trainingsInfo.html.erb | 8 ++++++- 3 files changed, 43 insertions(+), 4 deletions(-) diff --git a/app/controllers/trainings_controller.rb b/app/controllers/trainings_controller.rb index 8650a5a7..ad3248c9 100644 --- a/app/controllers/trainings_controller.rb +++ b/app/controllers/trainings_controller.rb @@ -15,6 +15,20 @@ class TrainingsController < ApplicationController layout 'base_trainings' + # TODO: 测试完成后删除 + ALLOW_OPENID_LIST = [ + 'oSrqE59d6uMBkANfXnJcGuUwuGds', + 'oSrqE5-j3rT3f9nt4iFhSICPF1Vo', + 'oSrqE5w6dtsRyjFkFBahQ1jeurTk', + 'oSrqE52fgGMooW3B1K4mZ0Le5G9I', + '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 + def show @training = current_training @@ -23,6 +37,9 @@ class TrainingsController < ApplicationController return end + # TODO: 测试完成后删除 + @test_wxpay = ALLOW_OPENID_LIST.include?(session[:wechat_open_id]) + render 'trainingsInfo' end @@ -50,6 +67,8 @@ 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 @@ -155,8 +174,12 @@ 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? - _pay_js(training_info.fee) + # TODO: 测试完成后删除 + _pay_js(@test_wxpay ? 0.01 : training_info.fee) else redirect_to result_training_path(id: friendly_id) end diff --git a/app/views/trainings/pay.html.erb b/app/views/trainings/pay.html.erb index 9aebe19f..f1b16f6e 100644 --- a/app/views/trainings/pay.html.erb +++ b/app/views/trainings/pay.html.erb @@ -2,10 +2,20 @@
<%= hidden_field_tag(:friendly_id, @friendly_id) %> -
> + <% if @test_wxpay %> +
+ <% else %> +
+ <% end %> +

- <%= @training.training_payinfo.pay_type.to_i == 3 ? "线下支付" : "微信支付" %> + <% if @test_wxpay %> + <%= @training.training_payinfo.pay_type.to_i == 3 ? "线下支付" : "微信支付" %> + <% else %> + 线下支付 + <% end %> +

mt5" id="payInfos"> diff --git a/app/views/trainings/trainingsInfo.html.erb b/app/views/trainings/trainingsInfo.html.erb index 964455bc..d9c74d6f 100644 --- a/app/views/trainings/trainingsInfo.html.erb +++ b/app/views/trainings/trainingsInfo.html.erb @@ -41,7 +41,13 @@ <% if @training.training_payinfo.blank? || @training.training_payinfo.not_payed? %>
<%= link_to '转账支付', pay_training_path(id: @friendly_id, pay_type: 3), class: 'leftbtn' %> - <%= link_to '微信支付', pay_training_path(id: @friendly_id, pay_type: 1), class: 'rightbtn' %> + <%#= link_to '微信支付', pay_training_path(id: @friendly_id, pay_type: 1), class: 'rightbtn' %> + + <% if @test_wxpay %> + <%= link_to '微信支付', pay_training_path(id: @friendly_id, pay_type: 1), class: 'rightbtn' %> + <% else %> + 微信支付 + <% end %>
<% else %>
From ce67c42c272389ded001756fe40817db920c03f0 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Wed, 19 Jun 2019 10:03:07 +0800 Subject: [PATCH 6/7] remove wechat pay test --- app/controllers/trainings_controller.rb | 25 +--------------------- app/views/trainings/pay.html.erb | 22 ++++++------------- app/views/trainings/trainingsInfo.html.erb | 8 +------ 3 files changed, 8 insertions(+), 47 deletions(-) diff --git a/app/controllers/trainings_controller.rb b/app/controllers/trainings_controller.rb index ad3248c9..8650a5a7 100644 --- a/app/controllers/trainings_controller.rb +++ b/app/controllers/trainings_controller.rb @@ -15,20 +15,6 @@ class TrainingsController < ApplicationController layout 'base_trainings' - # TODO: 测试完成后删除 - ALLOW_OPENID_LIST = [ - 'oSrqE59d6uMBkANfXnJcGuUwuGds', - 'oSrqE5-j3rT3f9nt4iFhSICPF1Vo', - 'oSrqE5w6dtsRyjFkFBahQ1jeurTk', - 'oSrqE52fgGMooW3B1K4mZ0Le5G9I', - '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 - def show @training = current_training @@ -37,9 +23,6 @@ class TrainingsController < ApplicationController return end - # TODO: 测试完成后删除 - @test_wxpay = ALLOW_OPENID_LIST.include?(session[:wechat_open_id]) - render 'trainingsInfo' end @@ -67,8 +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 @@ -174,12 +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? - # 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 diff --git a/app/views/trainings/pay.html.erb b/app/views/trainings/pay.html.erb index f1b16f6e..7426cfa3 100644 --- a/app/views/trainings/pay.html.erb +++ b/app/views/trainings/pay.html.erb @@ -2,20 +2,10 @@
<%= hidden_field_tag(:friendly_id, @friendly_id) %> - <% if @test_wxpay %> -
- <% else %> -
- <% end %> - +
>

- <% if @test_wxpay %> - <%= @training.training_payinfo.pay_type.to_i == 3 ? "线下支付" : "微信支付" %> - <% else %> - 线下支付 - <% end %> - + <%= @training.training_payinfo.pay_type.to_i == 3 ? "线下支付" : "微信支付" %>

mt5" id="payInfos"> @@ -192,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 () { diff --git a/app/views/trainings/trainingsInfo.html.erb b/app/views/trainings/trainingsInfo.html.erb index d9c74d6f..964455bc 100644 --- a/app/views/trainings/trainingsInfo.html.erb +++ b/app/views/trainings/trainingsInfo.html.erb @@ -41,13 +41,7 @@ <% if @training.training_payinfo.blank? || @training.training_payinfo.not_payed? %>
<%= link_to '转账支付', pay_training_path(id: @friendly_id, pay_type: 3), class: 'leftbtn' %> - <%#= link_to '微信支付', pay_training_path(id: @friendly_id, pay_type: 1), class: 'rightbtn' %> - - <% if @test_wxpay %> - <%= link_to '微信支付', pay_training_path(id: @friendly_id, pay_type: 1), class: 'rightbtn' %> - <% else %> - 微信支付 - <% end %> + <%= link_to '微信支付', pay_training_path(id: @friendly_id, pay_type: 1), class: 'rightbtn' %>
<% else %>
From 66f52ddfcc3e52a2e8ad9d38cd745ce1bffabb95 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Wed, 19 Jun 2019 10:25:30 +0800 Subject: [PATCH 7/7] trainings feature --- app/models/training.rb | 2 +- app/views/layouts/base_management.html.erb | 2 +- app/views/trainings/enroll.html.erb | 26 +++++++++++++ app/views/trainings/result.html.erb | 38 +++++++++++++------ app/views/trainings/trainingsInfo.html.erb | 12 ++++++ ...20190619021343_add_columns_to_trainings.rb | 6 +++ 6 files changed, 72 insertions(+), 14 deletions(-) create mode 100644 db/migrate/20190619021343_add_columns_to_trainings.rb diff --git a/app/models/training.rb b/app/models/training.rb index 58de07ab..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 工程教育认证 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 @@
  • <%= link_to "技术体系", tech_system_managements_path %>
  • <%= link_to "升级通知", update_notice_managements_path %>
  • <%= link_to "门户banner设置", setting_banner_managements_path %>
  • -
  • <%= link_to "2018培训会", training_2018_managements_path %>
  • +
  • <%= link_to "培训会", training_2018_managements_path %>
  • diff --git a/app/views/trainings/enroll.html.erb b/app/views/trainings/enroll.html.erb index f5ee6867..d7a2e59a 100644 --- a/app/views/trainings/enroll.html.erb +++ b/app/views/trainings/enroll.html.erb @@ -152,6 +152,16 @@ name="position" value="<%= @training.position %>"/> + + <% if @training_type == 4 %> +
  • + 职务 + +
  • + <% end %> +
  • 手机号码
  • + <% if @training_type == 4 %> +
  • + 待认证专业 + +
  • + <% end %> + <% if @training_type == 3 %>

    您关注的课程类型(最少选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/result.html.erb b/app/views/trainings/result.html.erb index c71758ab..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 %>
    - <%= render partial: 'upload_img', locals: { training: @training, disabled: true } %> - <% end %> -
    + <% if @training.training_payinfo.info.present? || (@training.training_payinfo.attachment_id.to_i > 0 || @training.training_payinfo.pay_type != TrainingPayinfo::PayType_Wechat) %> +
    + <% if @training.training_payinfo.info.present? %> +

    +

    <%= @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 %> +
    + <% end %>

    diff --git a/app/views/trainings/trainingsInfo.html.erb b/app/views/trainings/trainingsInfo.html.erb index 964455bc..3ec764ca 100644 --- a/app/views/trainings/trainingsInfo.html.erb +++ b/app/views/trainings/trainingsInfo.html.erb @@ -21,10 +21,22 @@ 职称 <%= @training.position %> + <% if @training_type == 4 %> +
  • + 职务 + <%= @training.job_title %> +
  • + <% end %>
  • 手机号 <%= @training.phone %>
  • + <% if @training_type == 4 %> +
  • + 待认证专业 + <%= @training.uncertified_major %> +
  • + <% end %>
    <% if @training.training_type == 3 %> diff --git a/db/migrate/20190619021343_add_columns_to_trainings.rb b/db/migrate/20190619021343_add_columns_to_trainings.rb new file mode 100644 index 00000000..f4eacee1 --- /dev/null +++ b/db/migrate/20190619021343_add_columns_to_trainings.rb @@ -0,0 +1,6 @@ +class AddColumnsToTrainings < ActiveRecord::Migration + def change + add_column :trainings, :job_title, :string + add_column :trainings, :uncertified_major, :string + end +end