百度云推送官方地址http://developer.baidu.com/wiki/index.php"http://developer.baidu.com/wiki/index.php">http://developer.baidu.com/wiki/index.php"codetitle">复制代码 代码如下:
start() ->
inets:start(),
{Mega,Sec,_} = now(),
ApiKey = "apikey=aghjklpoikmnbhjklpoijnbfd",%%用户的APIkey
%% 我的设备
% Channel_Id = "channel_id=1234567890098765432",%% 用户的某一设备channelid,也就是客户端demo安装在的手机的channelid
%% 模拟器
Channel_Id = "channel_id=3959774938927755088",%%客户端模拟器的channelid
Device_Type = "device_type=3",%%类型,细节在官方文档中查看,1:浏览器设备;2:PC设备;3:Android设备;4:IOS设备;5:Windows phone设备
Message_Type = "message_type=1",%% 0:消息;1:通知;默认为0
TitleStr = " :kkkk,嘎嘎嘎阿 达航空 件阿 斯顿,,,,哈哈哈,erlang",
DescriptionStr = "行不:行啊!",
Messages0 = "messages={\"title\":\"",
Messages1 = TitleStr,
Messages2 = "\",\"description\":\"",
Messages3 = DescriptionStr,
Messages4 = "\",\"notification_builder_id\":0,"
++ "\"notification_basic_style\":2,\"open_type\":2,\"url\":\"\",\"user_confirm\":0,\"pkg_content\":\"\",\"custom_content\":\"\"}",
Messages = Messages0 ++ Messages1 ++ Messages2 ++ Messages3 ++ Messages4,
Method = "method=push_msg",
Msg_keys= "msg_keys=erlang_keys",
Push_Type = "push_type=1",
Time = "timestamp="++ integer_to_list((Mega * 1000000 + Sec)),
User_Id = "user_id=213123123",%%用户的userid
Url = "http://channel.api.duapp.com/rest/2.0/channel/channel",
Http_Method = "POST",
SecretKey = "123weqwe12wq12eqweqweqwe",%%用户的secretekey
Str0 = Http_Method ++ Url ++ ApiKey ++ Channel_Id ++ Device_Type ++ Message_Type ++ Messages0,
Str1 = Messages2,
Str2 = Messages4 ++ Method ++ Msg_keys ++ Push_Type ++ Time ++ User_Id ++ SecretKey,
TitleBin = list_to_binary(TitleStr),
TIntegerU = unicode:characters_to_list(TitleBin,utf8),
TChanges = utf8(TIntegerU,[]),
Title_Utf8 =
lists:foldl(fun(Change,Acc) ->
case Change of
[Term] when Term >= $a, Term =< $z ->
Acc ++ Change;
[Term] when Term >= $A, Term =< $Z ->
Acc ++ Change;
[Term] when Term >= $0, Term =< $9 ->
Acc ++ Change;
[Term] when Term =:= $. ->
Acc ++ Change;
[Term] when Term =:= $_ ->
Acc ++ Change;
[Term] when Term =:= $- ->
Acc ++ Change;
[Term] when Term =:= 32 ->
Acc ++ [43];
_ ->
Acc ++ list_to_hex_s(Change)
end
end,[],TChanges),
DesBin = list_to_binary(DescriptionStr),
DIntegerU = unicode:characters_to_list(DesBin,utf8),
DChanges = utf8(DIntegerU,[]),
Des_Utf8 =
lists:foldl(fun(Change,Acc) ->
case Change of
[Term] when Term >= $a, Term =< $z ->
Acc ++ Change;
[Term] when Term >= $A, Term =< $Z ->
Acc ++ Change;
[Term] when Term >= $0, Term =< $9 ->
Acc ++ Change;
[Term] when Term =:= $. ->
Acc ++ Change;
[Term] when Term =:= $_ ->
Acc ++ Change;
[Term] when Term =:= $- ->
Acc ++ Change;
_ ->
Acc ++ list_to_hex_s(Change)
end
end,[],DChanges),
StrValue = escape_uri(Str0) ++ Title_Utf8 ++ escape_uri(Str1) ++ Des_Utf8 ++ escape_uri(Str2),
Md5Str = md5_hex(StrValue),
Sign = "sign=" ++ Md5Str,
PostInfo = ApiKey ++ "&" ++ Sign ++ "&" ++ User_Id ++ "&"
++ Channel_Id ++ "&" ++ Device_Type ++ "&" ++ Message_Type ++ "&" ++ Messages
++ "&" ++ Method ++ "&" ++ Msg_keys ++ "&" ++ Push_Type ++ "&" ++ Time,
timer:sleep(30*1000),
Result = httpc:request(post,{Url,[],"application/x-www-form-urlencoded",PostInfo},[],[]),
case Result of
{ok,{{"HTTP/1.1",200,"OK"},_,_}} ->
nothing;
_ ->
io:format("Result:~p~n",[Result])
end.
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
P70系列延期,华为新旗舰将在下月发布
3月20日消息,近期博主@数码闲聊站 透露,原定三月份发布的华为新旗舰P70系列延期发布,预计4月份上市。
而博主@定焦数码 爆料,华为的P70系列在定位上已经超过了Mate60,成为了重要的旗舰系列之一。它肩负着重返影像领域顶尖的使命。那么这次P70会带来哪些令人惊艳的创新呢?
根据目前爆料的消息来看,华为P70系列将推出三个版本,其中P70和P70 Pro采用了三角形的摄像头模组设计,而P70 Art则采用了与上一代P60 Art相似的不规则形状设计。这样的外观是否好看见仁见智,但辨识度绝对拉满。
更新日志
- 小骆驼-《草原狼2(蓝光CD)》[原抓WAV+CUE]
- 群星《欢迎来到我身边 电影原声专辑》[320K/MP3][105.02MB]
- 群星《欢迎来到我身边 电影原声专辑》[FLAC/分轨][480.9MB]
- 雷婷《梦里蓝天HQⅡ》 2023头版限量编号低速原抓[WAV+CUE][463M]
- 群星《2024好听新歌42》AI调整音效【WAV分轨】
- 王思雨-《思念陪着鸿雁飞》WAV
- 王思雨《喜马拉雅HQ》头版限量编号[WAV+CUE]
- 李健《无时无刻》[WAV+CUE][590M]
- 陈奕迅《酝酿》[WAV分轨][502M]
- 卓依婷《化蝶》2CD[WAV+CUE][1.1G]
- 群星《吉他王(黑胶CD)》[WAV+CUE]
- 齐秦《穿乐(穿越)》[WAV+CUE]
- 发烧珍品《数位CD音响测试-动向效果(九)》【WAV+CUE】
- 邝美云《邝美云精装歌集》[DSF][1.6G]
- 吕方《爱一回伤一回》[WAV+CUE][454M]