消息表添加字段
This commit is contained in:
parent
0bf9b5c6e6
commit
643b06484b
|
@ -77,9 +77,9 @@ class MembersController < ApplicationController
|
|||
project.user_grades << user_grades unless user_grades.first.user_id.nil?
|
||||
@applied_message.update_attribute(:status, 2)
|
||||
# 添加成功后,申请人收到消息
|
||||
AppliedMessage.create(:user_id => @applied_message.applied_user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 6, :viewed => true, :applied_user_id => @applied_message.user_id)
|
||||
AppliedMessage.create(:user_id => @applied_message.applied_user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 6, :viewed => true, :applied_user_id => @applied_message.user_id, :role => applied_project.role)
|
||||
# 添加成功后,批准人收到消息
|
||||
AppliedMessage.create(:user_id => @applied_message.user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 7, :viewed => true, :applied_user_id => @applied_message.applied_user_id)
|
||||
AppliedMessage.create(:user_id => @applied_message.user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 7, :viewed => true, :applied_user_id => @applied_message.applied_user_id, :role => applied_project.role)
|
||||
rescue Exception => e
|
||||
puts e
|
||||
end
|
||||
|
@ -96,9 +96,9 @@ class MembersController < ApplicationController
|
|||
@applied_message.update_attribute(:status, 3)
|
||||
applied_project = @applied_message.applied
|
||||
# 发送消息给被拒者,user_id对应的收到信息的用户
|
||||
AppliedMessage.create(:user_id => @applied_message.applied_user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 4, :viewed => true, :applied_user_id => @applied_message.user_id)
|
||||
AppliedMessage.create(:user_id => @applied_message.applied_user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 4, :viewed => true, :applied_user_id => @applied_message.user_id, :role => applied_project.role)
|
||||
# 发送消息给拒绝者
|
||||
AppliedMessage.create(:user_id => @applied_message.user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 5, :viewed => true, :applied_user_id => @applied_message.applied_user_id)
|
||||
AppliedMessage.create(:user_id => @applied_message.user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 5, :viewed => true, :applied_user_id => @applied_message.applied_user_id, :role => applied_project.role)
|
||||
# applied_project.delete
|
||||
end
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class AppliedMessage < ActiveRecord::Base
|
||||
# status: 0表示未批准; status:1表示已批准; status: 2表示已拒绝
|
||||
attr_accessible :applied_id, :applied_type, :status, :user_id, :viewed, :applied_user_id
|
||||
attr_accessible :applied_id, :applied_type, :status, :user_id, :viewed, :applied_user_id, :role, :project_id
|
||||
belongs_to :applied ,:polymorphic => true
|
||||
belongs_to :apply_add_schools
|
||||
belongs_to :user
|
||||
|
|
|
@ -10,7 +10,7 @@ class AppliedProject < ActiveRecord::Base
|
|||
# 仅仅给项目管理人员发送消息
|
||||
def send_appliled_message
|
||||
self.project.managers.each do |member|
|
||||
self.applied_messages << AppliedMessage.new(:user_id => member.user_id, :status => true, :viewed => false, :applied_user_id => self.user_id)
|
||||
self.applied_messages << AppliedMessage.new(:user_id => member.user_id, :status => true, :viewed => false, :applied_user_id => self.user_id, :role => self.role, :project_id => self.project_id)
|
||||
end
|
||||
# end
|
||||
end
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<%= render :partial => "users/user_message_applide_users", :locals =>{:ma => ma} %>
|
||||
</li>
|
||||
<li class="homepageNewsContent fl" style="width:283px;"><a href="javascript:void(0);" class="newsGrey">
|
||||
以“<%= applied_project_message_type(ma.applied.role) %>”身份加入
|
||||
以“<%= applied_project_message_type(ma.role) %>”身份加入
|
||||
<%= link_to ma.applied.project, project_path(ma.applied.project), :class => "link-blue", :target => '_blank' %>
|
||||
</a>
|
||||
</li>
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddRoleToAppliedMessage < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :applied_messages, :role, :integer
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddProjectIdToAppliedMessage < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :applied_messages, :project_id, :integer
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20160728075947) do
|
||||
ActiveRecord::Schema.define(:version => 20160729124833) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -82,12 +82,16 @@ ActiveRecord::Schema.define(:version => 20160728075947) do
|
|||
t.integer "status", :default => 0
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "applied_user_id"
|
||||
t.integer "role"
|
||||
t.integer "project_id"
|
||||
end
|
||||
|
||||
create_table "applied_projects", :force => true do |t|
|
||||
t.integer "project_id", :null => false
|
||||
t.integer "user_id", :null => false
|
||||
t.integer "role", :default => 0
|
||||
t.integer "applied_user_id"
|
||||
end
|
||||
|
||||
create_table "apply_add_schools", :force => true do |t|
|
||||
|
|
Loading…
Reference in New Issue