Module: Model::Annunciate

Extended by:
ActiveSupport::Concern
Defined in:
app/models/wechat/model/annunciate.rb

Instance Method Summary collapse

Instance Method Details

#bodyObject



27
28
29
# File 'app/models/wechat/model/annunciate.rb', line 27

def body
  annunciation.body
end

#to_wechatObject



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/models/wechat/model/annunciate.rb', line 13

def to_wechat
  app = PublicApp.valid.find_by(organ_id: annunciation.organ_id, primary: true)

  return unless app

  tag_ids = app.tags.where(user_tag_id: user_tag_id).pluck(:tag_id)
  if tag_ids.present?
    api = app.api
    tag_ids.each do |tag_id|
      api.message_mass_sendall(body, tag_id)
    end
  end
end

#to_wechat_laterObject



9
10
11
# File 'app/models/wechat/model/annunciate.rb', line 9

def to_wechat_later
  AnnunciateJob.perform_later(self)
end