diff --git a/app/controllers/admins/identity_verifications_controller.rb b/app/controllers/admins/identity_verifications_controller.rb
index f5d5a11e..51d5e423 100644
--- a/app/controllers/admins/identity_verifications_controller.rb
+++ b/app/controllers/admins/identity_verifications_controller.rb
@@ -3,9 +3,7 @@ class Admins::IdentityVerificationsController < Admins::BaseController
def index
params[:sort_by] = params[:sort_by].presence || 'created_at'
params[:sort_direction] = params[:sort_direction].presence || 'desc'
-
identity_verifications = Admins::IdentityVerificationQuery.call(params)
-
@identity_verifications = paginate identity_verifications.preload(:user)
end
@@ -16,9 +14,13 @@ class Admins::IdentityVerificationsController < Admins::BaseController
end
def update
- @identity_verification.update(update_params)
- flash[:success] = '保存成功'
- render 'edit'
+ if @identity_verification.update(update_params)
+ redirect_to admins_identity_verifications_path
+ flash[:success] = "更新成功"
+ else
+ redirect_to admins_identity_verifications_path
+ flash[:danger] = "更新失败"
+ end
end
private
diff --git a/app/queries/admins/identity_verification_query.rb b/app/queries/admins/identity_verification_query.rb
index a0064ec0..7c0fd669 100644
--- a/app/queries/admins/identity_verification_query.rb
+++ b/app/queries/admins/identity_verification_query.rb
@@ -10,7 +10,7 @@ class Admins::IdentityVerificationQuery < ApplicationQuery
end
def call
- state = params[:state].blank? ? [0,1,2] : params[:state].to_i
+ state = params[:state] == "all" ? [0,1,2] : params[:state].nil? ? [0] : params[:state].to_i
applies = IdentityVerification.where(state: state)
custom_sort(applies, params[:sort_by], params[:sort_direction])
end
diff --git a/app/views/admins/identity_verifications/edit.html.erb b/app/views/admins/identity_verifications/edit.html.erb
index 99f9f02a..580c86f3 100644
--- a/app/views/admins/identity_verifications/edit.html.erb
+++ b/app/views/admins/identity_verifications/edit.html.erb
@@ -99,16 +99,10 @@
-
-
-
-
-
-
<% unless @identity_verification.state == "已通过" %>
- <%= f.radio_button :state, '已通过' %> 通过
- <%= f.radio_button :state, '已拒绝' %> 拒绝
+ <%= radio_button_tag("identity_verification[state]","已通过", required: 'required') %>通过
+ <%= radio_button_tag("identity_verification[state]","已拒绝", required: 'required') %>拒绝