diff --git a/app/controllers/trainings_controller.rb b/app/controllers/trainings_controller.rb index 7c95c150..2e11eaab 100644 --- a/app/controllers/trainings_controller.rb +++ b/app/controllers/trainings_controller.rb @@ -18,7 +18,7 @@ class TrainingsController < ApplicationController def show @training = current_training - if @training.training_payinfo.present? && params[:disable_redirect].blank? + if @training.training_payinfo.present? && !@training.training_payinfo.not_payed? && params[:disable_redirect].blank? redirect_to result_training_path(id: friendly_id) return end @@ -125,7 +125,7 @@ class TrainingsController < ApplicationController attachment = nil attachment = Attachment.create!(file: params[:image], author: User.first) if params[:image] - if attachment.blank? && training_info.not_payed? + if training_info.attachment.blank? && attachment.blank? && training_info.not_payed? flash[:message] = '请先上传支付凭证' render 'pay' return diff --git a/app/views/trainings/pay.html.erb b/app/views/trainings/pay.html.erb index 4e565525..920fd14b 100644 --- a/app/views/trainings/pay.html.erb +++ b/app/views/trainings/pay.html.erb @@ -248,7 +248,7 @@ $('#submitFormBtn').on('click', function () { if(!checkBillInfo()){ return; } - <% if @training.training_payinfo.not_payed? %> + <% if @training.training_payinfo.blank? || (@training.training_payinfo.not_payed? && @training.training_payinfo.attachment.blank?) %> var image = $("input[name='image']").val() if (!image || image.length < 0) { alert('请先上传支付凭证'); diff --git a/app/views/trainings/trainingsInfo.html.erb b/app/views/trainings/trainingsInfo.html.erb index e6287aaa..1ab35176 100644 --- a/app/views/trainings/trainingsInfo.html.erb +++ b/app/views/trainings/trainingsInfo.html.erb @@ -38,7 +38,7 @@ <%= link_to('修改资料', enroll_training_path(id: @friendly_id, disable_redirect: true), class: 'info_updateBtn') %> -<% if @training.training_payinfo.blank? %> +<% 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' %>