• Jpush极光推送


    require 'jpush'
    class SidkiqJpushWorker
      include Sidekiq::Worker
    
      #  args[0] msg  ; args[1] region_id ; args[2]: 设备 1 Android 2 ios
      # SidkiqJpushWorker.perform_async("张三你好","140fe1da9e9010a3725")
      def perform(*args)
        #msg = args[0]
        msg,registration_ids = args[0], args[1]
    
        # audience = JPush::Push::Audience.new.set_registration_id(registration_ids)
        #  #client = JPush::Client.new(JpushConfig::APP_KEY, JpushConfig::MASTER_SECRET)
    
        # app_key = "59bb23b8250c779fa0035af0"
        # master_secret = "5903bd6524c89970f3f8266c"
        # jpush = JPush::Client.new(app_key, master_secret)
    
        # #pusher = client.pusher
        # push_payload = JPush::Push::PushPayload.new(
        #     platform: 'all',
        #     audience: 'all',
        #     notification: 'hello jpush',
        #     message: msg
        # )
        # #pusher.push(payload1)
        # jpush.pusher.push(push_payload)
    
        app_key = "59bb23b8250c779fa0035af0"
        master_secret = "5903bd6524c89970f3f8266c"
        # reg_id = '190e35f7e044c642639'  JPushClient
        client = JPush::Client.new(app_key, master_secret)
        #client = JPush::Client.new(JpushConfig::APP_KEY, JpushConfig::MASTER_SECRET)
    
        playload1=JPush::PushPayload.build(
            #"cid": "8103a4c628a0b98974ec1949-711261d4-5f17-4d2f-a855-5e5a8909b26e",
            :platform => Jpush::Platform.all,
            :audience => Jpush::Audience.build(:registration_id => registration_ids),
    
            :notification =>Jpush::Notification.build(
              :android => JPush::AndroidNotification.build(
                  :alert => "服务单01201607122395,分派给了你。",
                  :title => "您有新的分配单!"
                  # :builder_id => 1,
                  # :extras => {:key1 => 'value1', :key2 => 'value2'})
                  )
    
    
            # :message => JPush::Message.build(
            #     :msg_content => "message content test",
            #     :title => "message title test",
            #     # :content_type => "message content type test",
            #     # :extras => {:key1 => "value1", :key2 => "value2"}
            #     ),
    
            #   :options => {
            #     "time_to_live": 60,
            #     "apns_production": false,
            #     "apns_collapse_id":"jiguang_test_201706011100"
            # }    
          )
        )
           client.sendPush(playload1)
    
    
    
    
    
      end
    
    end
    

      

     
  • 相关阅读:
    #轻重链剖分,交互#LOJ 6669 Nauuo and Binary Tree
    #贪心#洛谷 6093 [JSOI2015]套娃
    #根号分治,树上倍增#洛谷 3591 [POI2015]ODW
    #KD-Tree,替罪羊树#洛谷 6224 [BJWC2014]数据
    #K-D Tree#洛谷 2093 [国家集训队]JZPFAR
    nim-lang: UUID shellcode execution(过所有杀软)
    nim-lang 免杀测试:回调函数结合隐写术
    Shellcode Injection via Callbacks(nim学习系列)
    Reflective dll injection(nim 学习系列)
    搭建简易的 http server(nim 学习系列)
  • 原文地址:https://www.cnblogs.com/lmg-jie/p/8022509.html
Copyright © 2020-2023  润新知