组织域名申请提示策略、消息存储表结构修改

This commit is contained in:
huang 2017-01-16 16:10:28 +08:00
parent b36089c45d
commit f321082fdc
5 changed files with 37 additions and 8 deletions

View File

@ -635,10 +635,18 @@ class OrganizationsController < ApplicationController
end
end
def apply_subdomain
@organization = Organization.find(params[:id])
organization = Organization.find(params[:id])
@applied_message_count = AppliedMessage.where(:applied_id => organization.id, :name => params[:domain].downcase).count
# 如果申请过该名字,怎不能重复申请
if @applied_message_count > 0
@flag = true
return
else
admins = User.where("admin=1")
admins.each do |admin|
OrgMessage.create(:user_id => admin.id, :organization_id => @organization.id, :message_type => 'ApplySubdomain', :message_id => @organization.id, :sender_id => User.current.id, :viewed => 0, :content => params[:domain].downcase)
AppliedMessage.create(:user_id => admin.id, :applied_id => organization.id, :applied_type => 'ApplySubdomain', :viewed => 0, :satus => 1, :applied_user_id => User.current.id, :name => params[:domain].downcase)
# OrgMessage.create(:user_id => admin.id, :organization_id => @organization.id, :message_type => 'ApplySubdomain', :message_id => @organization.id, :sender_id => User.current.id, :viewed => 0, :content => params[:domain].downcase)
end
end
end

View File

@ -2066,7 +2066,8 @@ class UsersController < ApplicationController
@applied_message_alls << mess
end
elsif (message_all.message_type == "AppliedMessage" )
if (mess.applied_type == "AppliedContest" && mess.status == 0) || (mess.applied_type == "StudentWorksScoresAppeal" && mess.status == 0) || (mess.applied_type == "AppliedProject" && mess.status == 1 && AppliedMessage.where("applied_id = #{mess.applied_id} and status != 1").count == 0) || ( mess.applied_type == "ApplyAddSchools" && ApplyAddSchools.where(:school_id => mess.applied_id, :status => 0).count != 0 )
if (mess.applied_type == "AppliedContest" && mess.status == 0) || (mess.applied_type == "StudentWorksScoresAppeal" && mess.status == 0) ||
(mess.applied_type == "AppliedProject" && mess.status == 1 && AppliedMessage.where("applied_id = #{mess.applied_id} and status != 1").count == 0) || ( mess.applied_type == "ApplyAddSchools" && mess.status ==0 )
@applied_message_alls << mess
end
elsif message_all.message_type == "CourseMessage"

View File

@ -0,0 +1,21 @@
<div id="sy_popup_box" style="width:380px;">
<div class="sy_popup_top sy_popup_top_tishi">
<h3 class="fl">温馨提示</h3>
<a href="javascript:void(0);" class="sy_icons_close02 fr" onclick="hideModal()"></a>
<div class="cl"></div>
</div>
<div class="sy_popup_con02" >
<ul class="sy_popup_tishi ">
<li>
<% if @flag %>
<p>当前组织已申请过该域名,请耐心等待管理员的审批,审批完成后系统会以消息的形式通知您</p>
<% else %>
<p>您的申请已提交,系统会以消息的形式通知您结果</p>
<% end %>
</li>
<li>
<a href="javascript:void(0);" class="sy_btn_blue " onclick="hideModal()">知道了</a>
</li>
</ul>
</div>
</div>

View File

@ -0,0 +1,2 @@
var htmlvalue = "<%= escape_javascript(render :partial => 'organizations/applied_organization_domain_tip') %>";
pop_box_new(htmlvalue,380,250);

View File

@ -227,9 +227,6 @@
data:{
id:id,
domain:domain
},
success:function(){
$("#apply_hint").text("您的申请已提交,系统会以消息的形式通知您结果");
}
});
}