Commit 2f365c2c by zmj

修改推送的数量和token 过期时间

parent e8db51e8
......@@ -4,11 +4,13 @@ module Push
TOKEN_URL = 'https://login.cloud.huawei.com/oauth2/v2/token'.freeze
PUSH_URL = 'https://api.push.hicloud.com/pushsend.do'.freeze
ACCESS_TOEKN_EXPIRE_TIME = 3500
BATCH_PUSH_MAX = 80
class << self
# 4a7d376b47c847634571a86b37e93272 测试使用的device_token
def push(device_tokens, message)
handle_token_res if access_token.blank?
device_tokens.each_slice(100) do |device_token_array|
device_tokens.each_slice(BATCH_PUSH_MAX) do |device_token_array|
res_push(message, device_token_array)
end
rescue StandardError => err
......
module Push
module Xiaomi
PUSH_URL = 'https://api.xmpush.xiaomi.com/v3/message/regid'.freeze
PUSH_DEVICE_MAX = 1000
BATCH_PUSH_MAX = 80
class << self
def push(registration_ids, payload)
registration_ids.each_slice(PUSH_DEVICE_MAX) do |registration_ids_array|
registration_ids.each_slice(BATCH_PUSH_MAX) do |registration_ids_array|
registration_id = registration_ids_array.join(',')
post(message(payload, registration_id))
end
......
module Token
ACCESS_TOEKN_EXPIRE_TIME = 3600
ACCESS_TOEKN_EXPIRE_TIME = 7200
class << self
def key(app_name)
"push:api:#{app_name}:access_token"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment