You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
# status: 0 审核中 1 同意 2 拒绝 3 撤销
class ApplyAction < ActiveRecord :: Base
default_scope :order = > 'updated_at desc'
attr_accessible :container_id , :container_type , :dealer_id , :reason , :user_id , :status , :apply_reason , :noticed , :ip_addr , :reject_description
belongs_to :user
has_many :tidings , :as = > :container , :dependent = > :destroy
after_create :send_tiding
def send_tiding
if self . container_type == 'TrialAuthorization' && self . status == 1
self . tidings << Tiding . new ( :user_id = > self . user_id , :trigger_user_id = > 0 , :status = > 1 , :tiding_type = > " System " , :parent_container_id = > self . container_id , :viewed = > 0 ,
:parent_container_type = > self . container_type , :belong_container_id = > self . container_id , :belong_container_type = > " User " )
else
self . tidings << Tiding . new ( :user_id = > '1' , :trigger_user_id = > self . user_id , :status = > 0 , :tiding_type = > " Apply " , :parent_container_id = > self . container_id , :viewed = > 0 ,
:parent_container_type = > self . container_type , :belong_container_id = > self . container_id , :belong_container_type = > self . container_type == " TrialAuthorization " ? " User " : ( self . container_type == " ApplyShixun " ? " Shixun " : " Subject " ) )
end
end
end