超级管理员的试用授权列表手动授权不应该在审批页面新增申请记录
This commit is contained in:
parent
dde055fd3a
commit
d417ca0cf3
|
|
@ -902,35 +902,56 @@ end
|
|||
=end
|
||||
|
||||
if params[:member_ids] && params[:trial_whether] == "trial_agree"
|
||||
params[:member_ids].each do |member|
|
||||
aUser = ApplyAction.where(:user_id => member, :container_type => "TrialAuthorization")
|
||||
if aUser.blank?
|
||||
ApplyAction.create(:user_id => member, :container_type => "TrialAuthorization", :status => 1)
|
||||
else
|
||||
aUser.update_all(:status => 1)
|
||||
end
|
||||
end
|
||||
aUser = User.where(:id => params[:member_ids])
|
||||
aUser.update_all(:certification => 1)
|
||||
apply_user = ApplyAction.where(:user_id => params[:member_ids])
|
||||
apply_user.update_all(:status => 1) unless apply_user.blank?
|
||||
elsif params[:member_ids] && params[:trial_whether] == "trial_cancel"
|
||||
ApplyAction.where(:user_id => params[:member_ids], :container_type => "TrialAuthorization").update_all(:status => 2)
|
||||
User.where(:id => params[:member_ids]).update_all(:certification => 0)
|
||||
apply_user = ApplyAction.where(:user_id => params[:member_ids])
|
||||
apply_user.update_all(:status => 2) unless apply_user.blank?
|
||||
end
|
||||
|
||||
if params[:member_ids] && (params[:occupation] == "occupation_agree" || params[:realname] == "realname_agree")
|
||||
if params[:member_ids] && params[:occupation] == "occupation_agree"
|
||||
User.where(:id => params[:member_ids]).update_all(:professional_certification => true)
|
||||
apply_user = ApplyUserAuthentication.where(:user_id => params[:member_ids], :auth_type => 2)
|
||||
unless apply_user.blank?
|
||||
apply_user.update_all(:status => 1)
|
||||
end
|
||||
elsif params[:member_ids] && params[:realname] == "realname_agree"
|
||||
User.where(:id => params[:member_ids]).update_all(:authentication => true)
|
||||
elsif params[:member_ids] && (params[:occupation] == "occupation_agree" || params[:realname] == "realname_cancel")
|
||||
apply_user = ApplyUserAuthentication.where(:user_id => params[:member_ids], :auth_type => 1)
|
||||
unless apply_user.blank?
|
||||
apply_user.update_all(:status => 1)
|
||||
end
|
||||
elsif params[:member_ids] && params[:occupation] == "occupation_cancel"
|
||||
User.where(:id => params[:member_ids]).update_all(:professional_certification => false)
|
||||
apply_user = ApplyUserAuthentication.where(:user_id => params[:member_ids], :auth_type => 2)
|
||||
unless apply_user.blank?
|
||||
apply_user.update_all(:status => 2)
|
||||
end
|
||||
elsif params[:member_ids] && params[:realname] == "realname_cancel"
|
||||
User.where(:id => params[:member_ids]).update_all(:authentication => false)
|
||||
apply_user = ApplyUserAuthentication.where(:user_id => params[:member_ids], :auth_type => 1)
|
||||
unless apply_user.blank?
|
||||
apply_user.update_all(:status => 2)
|
||||
end
|
||||
end
|
||||
|
||||
if params[:trial] == "-1"
|
||||
apply = ApplyAction.where(:container_type => "TrialAuthorization")
|
||||
apply_id = apply.blank? ? -1 : "(" + apply.map{|a| a.user_id}.join(",") + ")"
|
||||
apply_user_id = User.where("id not in #{apply_id} and status = 1").all
|
||||
apply_user_id = User.where("id not in #{apply_id} and status = 1 and certification = 0").all
|
||||
apply_user_id = apply_user_id.blank? ? [-1] : apply_user_id.map{|a| a.id}.split(",")[0]
|
||||
elsif params[:trial] == "-2"
|
||||
apply_user_id = User.where(:status => 1).all
|
||||
apply_user_id = apply_user_id.blank? ? [-1] : apply_user_id.map{|a| a.id}.split(",")[0]
|
||||
else
|
||||
apply = ApplyAction.where(:status => params[:trial])
|
||||
elsif params[:trial] == "0"
|
||||
apply = ApplyAction.where(:status => 0)
|
||||
apply_user_id = apply.blank? ? [-1] : apply.map{|a| a.user_id}.split(",")[0]
|
||||
else
|
||||
apply_user_id = User.where(:status => 1, :certification => params[:trial]).all
|
||||
apply_user_id = apply_user_id.blank? ? [-1] : apply_user_id.map{|a| a.id}.split(",")[0]
|
||||
end
|
||||
|
||||
if params[:school] == ""
|
||||
|
|
@ -1035,6 +1056,7 @@ end
|
|||
end
|
||||
end
|
||||
apply_action.update_attributes(:status => (params[:type] == "1" ? 2 : 1), :reason => params[:reject_reason], :dealer_id => User.current.id)
|
||||
User.where(:id => apply_action.user_id).first.update_attributes(:certification => (params[:type] == "1" ? 2 : 1))
|
||||
user_id = User.find_by_sql("select id from users where concat(lastname,firstname) like '%#{search}%'")
|
||||
@authorizations = ApplyAction.where(:container_type => "TrialAuthorization", :status => 0, :user_id => user_id).includes(:user)
|
||||
@autu_count = @authorizations.count
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ module ApplicationHelper
|
|||
# if params[:action] == "on_search" || params[:action] == "apply_trail" # 之所以这样处理是为了避开account页面ajax加载
|
||||
# return true
|
||||
# end
|
||||
authentication = ApplyAction.where(:user_id => User.current.id, :status => 1).first
|
||||
authentication = User.where(:id => User.current.id, :certification => 1).first
|
||||
user_identity = User.current.try(:user_extensions).try(:identity)
|
||||
if user_identity.blank? || authentication.blank?
|
||||
redirect_to my_account_path
|
||||
|
|
@ -3026,12 +3026,15 @@ module ApplicationHelper
|
|||
end
|
||||
end
|
||||
|
||||
def identity_authentication_status status
|
||||
case status
|
||||
when nil
|
||||
"未授权"
|
||||
def identity_authentication_status user
|
||||
authorization = ApplyAction.where(:user_id => user, :container_type => "TrialAuthorization").last
|
||||
case user.try(:certification)
|
||||
when 0
|
||||
"处理中"
|
||||
if authorization.try(:status) == 0
|
||||
"处理中"
|
||||
else
|
||||
"未授权"
|
||||
end
|
||||
when 1
|
||||
"已授权"
|
||||
when 2
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
<% @users.each_with_index do |user,index| %>
|
||||
<% authorization = ApplyAction.where(:user_id => user, :container_type => "TrialAuthorization").last %>
|
||||
<tr>
|
||||
<td style="padding-left:15px;">
|
||||
<input id="authorization_<%= user.id %>" type="checkbox" class="magic-checkbox" name="member_ids[]" value="<%= user.id %>">
|
||||
|
|
@ -33,7 +32,7 @@
|
|||
<td><%= user.professional_certification ? "已认证" : "未认证" %></td>
|
||||
<td ><span class="edu-txt-w140 task-hide2" title="<%= user.try(:user_extensions).try(:school).try(:name) %>"><%= user.try(:user_extensions).try(:school).try(:name).blank? ? "--" : user.try(:user_extensions).try(:school) %></span></td>
|
||||
<td ><span class="edu-txt-w140 task-hide2"><%= user.try(:user_extensions).department ? user.try(:user_extensions).try(:department).try(:name).to_s : '--' %></span></td>
|
||||
<td><%= identity_authentication_status(authorization.try(:status)) %></td>
|
||||
<td><%= identity_authentication_status(user) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
|
|
|
|||
|
|
@ -1,17 +1,6 @@
|
|||
<!--<form action="<%#= search_user_managements_path %>" id="management_search_user" method="post" data-remote="true">-->
|
||||
<%= form_tag(url_for(search_user_managements_path), :id => "management_search_user", :method => "post", :remote => true) do %>
|
||||
<div class="edu-class-top mt15 clearfix ">
|
||||
<!-- <div class="edu-position edu-admin-select fl mr10" style="width:100px;" >
|
||||
<p>认证情况<i class="fa fa-caret-down ml10" ></i></p>
|
||||
<input type="hidden" name="authentication" value="">
|
||||
<ul class="edu-admin-option">
|
||||
<li data-val="">认证情况</li>
|
||||
<li data-val="1">已认证</li>
|
||||
<li data-val="-1">未认证</li>
|
||||
<li data-val="0">处理中</li>
|
||||
<li data-val="2">被拒绝</li>
|
||||
</ul>
|
||||
</div>-->
|
||||
<div class="edu-position edu-admin-select fl mr10" style="width:110px;">
|
||||
<p>试用授权情况<i class="fa fa-caret-down ml10" ></i></p>
|
||||
<input type="hidden" name="trial" value='-2'>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
class AddCertificationToUser < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :users, :certification, :boolean, :default => 0
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
class UpdateApplyActionToUser < ActiveRecord::Migration
|
||||
def up
|
||||
apply_users = ApplyAction.where(:status => 1, :container_type => "TrialAuthorization")
|
||||
apply_users.each do |apply|
|
||||
User.where(:id => apply.user_id).first.update_column(:certification, 1)
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
class ModifyCertificationForUser < ActiveRecord::Migration
|
||||
def up
|
||||
change_column :users, :certification, :integer, :default => 0
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
class UpdateRejectCerticationForUser < ActiveRecord::Migration
|
||||
def up
|
||||
apply_users = ApplyAction.where(:status => 2, :container_type => "TrialAuthorization")
|
||||
unless apply_users.blank?
|
||||
apply_users.each do |apply|
|
||||
User.where(:id => apply.user_id).first.update_column(:certification, 2)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
||||
Loading…
Reference in New Issue