Commit cba6f722 by zmj

fix huawei 推送参数

parent 97818129
......@@ -33,7 +33,7 @@ module AppPush
ver: '1',
appId: config['app_id']
}
url = "https://api.push.hicloud.com/pushsend.do?nsp_ctx=#{URI.escape(nsp_ctx.to_s)}"
url = "https://api.push.hicloud.com/pushsend.do?nsp_ctx=#{CGI::escape(nsp_ctx.to_json)}"
AppPush::Log.info("url: #{url}")
AppPush::Log.info("body: #{body}")
response = HTTParty.post(url, body: body, headers: headers, timeout: 5)
......@@ -51,13 +51,19 @@ module AppPush
}
}
}
{
access_token: 'access_token',
nsp_svc: 'openpush.message.api.send',
nsp_ts: Time.now.to_i,
device_token_list: device_tokens, # 单次最多100
payload: payload
params = {
access_token: CGI.escape(access_token),
nsp_svc: CGI.escape('openpush.message.api.send'),
nsp_ts: CGI.escape(Time.now.to_i.to_s),
device_token_list: CGI.escape(device_tokens.to_s),
payload: CGI.escape(payload.to_json)
}
params_str = ''
params.each_with_index do |(key,value), index|
params_str += "#{key}=#{value}"
params_str += '&' if index + 1 < params.size
end
params_str
end
def handle_token_res
......@@ -89,4 +95,4 @@ module AppPush
end
end
end
end
end
\ No newline at end of file
module AppPush
VERSION = "0.1.2.1"
VERSION = "0.1.3"
end
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