圆月山庄资源网 Design By www.vgjia.com

百度云推送官方地址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.

标签:
Erlang,百度云推送,Android服务端

圆月山庄资源网 Design By www.vgjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
圆月山庄资源网 Design By www.vgjia.com

《魔兽世界》大逃杀!60人新游玩模式《强袭风暴》3月21日上线

暴雪近日发布了《魔兽世界》10.2.6 更新内容,新游玩模式《强袭风暴》即将于3月21 日在亚服上线,届时玩家将前往阿拉希高地展开一场 60 人大逃杀对战。

艾泽拉斯的冒险者已经征服了艾泽拉斯的大地及遥远的彼岸。他们在对抗世界上最致命的敌人时展现出过人的手腕,并且成功阻止终结宇宙等级的威胁。当他们在为即将于《魔兽世界》资料片《地心之战》中来袭的萨拉塔斯势力做战斗准备时,他们还需要在熟悉的阿拉希高地面对一个全新的敌人──那就是彼此。在《巨龙崛起》10.2.6 更新的《强袭风暴》中,玩家将会进入一个全新的海盗主题大逃杀式限时活动,其中包含极高的风险和史诗级的奖励。

《强袭风暴》不是普通的战场,作为一个独立于主游戏之外的活动,玩家可以用大逃杀的风格来体验《魔兽世界》,不分职业、不分装备(除了你在赛局中捡到的),光是技巧和战略的强弱之分就能决定出谁才是能坚持到最后的赢家。本次活动将会开放单人和双人模式,玩家在加入海盗主题的预赛大厅区域前,可以从强袭风暴角色画面新增好友。游玩游戏将可以累计名望轨迹,《巨龙崛起》和《魔兽世界:巫妖王之怒 经典版》的玩家都可以获得奖励。