PHP code example of hadeswang / earnp-getui

1. Go to this page and download the library: Download hadeswang/earnp-getui library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

hadeswang / earnp-getui example snippets


'providers' => [
    //........
    Earnp\Getui\GetuiServiceprovider::class,
],

'aliases' => [
     //..........
    'Getui'     => Earnp\Getui\Facades\Getui::class,
],

php artisan vendor:publish

Getui::getUserDataByDate($date);

[
  "result" => "Success",
  "data" => [
  // 新注册用户数
  "newRegistCount" => 512,
  // 累计注册用户数
  "registTotalCount" => 14349,
  // 活跃用户数
  "activeCount" => 1544,
  // 在线用户数
  "onlineCount" => 55,
  "appId" => "",
  "date" => "20170726",
  ]
]

Getui::getPushDataByDate($date);

[
  "result" => "ok",
  "data" => [
    "appId" => "",
    "date" => "20170726",
    // 发送总数
    "sendCount" => 255,
    // 在线发送数
    "sendOnlineCount" => 140,
    // 接收数
    "receiveCount" => 138,
    // 展示数
    "showCount" => 25,
    // 点击数
    "clickCount" => 12,
  ],
  "GT" => "{"sent":140,"feedback":138,"displayed":25,"clicked":12}"
]

Getui::stopPushTask($taskId);

Getui::getUserStatus($CID);

[
  // 是否在线,Offline代表不在线,Online代表在线
  "result" => "Offline",
  // 最后登陆时间
  "lastLogin" => 1501142220930,
  "isblack" => false,
]

Getui::getPushMessageResult($taskId);

[
  "result" => "ok",
  "taskId" => "OSS-0728_071043065bcecc3a129937763b2309cd"
]

Getui::getUserCountByTags($tagList);

[
  "result" => "Success",
  "appId" => "",
  "tagCount" => [],
]

Getui::getPersonaTags();

[
  "result" => "Success",
  "tags" => []
]

$template = "IGtTransmissionTemplate";
$data = "a";
$config = array("type" => "HIGH", "title" => "你有一条新消息", "body" => "你有一个3000元的订单需要申请","logo"=>"","logourl"=>"");
$CID = "";
$test = Getui::pushMessageToSingle($template,$config,$data,$CID);

[
  "result" => "ok",
  "taskId" => "OSS-0728_071043065bcecc3a129937763b2309cd",
  "status" => "successed_offline",
]

$template = "IGtTransmissionTemplate";
$data = "a";
$config = array("type" => "HIGH", "title" => "你有一条新消息", "body" => "你有一个3000元的订单需要申请","logo"=>"","logourl"=>"");
$CID = "";
$test = Getui::pushMessageToList($template,$config,$data,$CID);

[
  "result" => "ok"
  "contentId" => "OSL-0728_hLKYR4tmkC7S0lI7QnSTT"
]

// 模版选择
$template = "IGtTransmissionTemplate";
// 发送内容
$data = "IGtTransmissionTemplate";
// 条件选择
$choice = array(
        // 发送手机类型
        "phoneTypeList"=>["ANDROID","IPHONE","IPAD"],
        // 发送城市
        "provinceList"=>["北京","上海"],
        // 标签选择,为空即可
        "tagList"=>["标签"],
        // 年龄选择
        "age"=>["10","11"]
    );
$config = array("type" => "HIGH", "title" => "你有一条新消息", "body" => "APP更新了哦,快去看看吧","logo"=>"","logourl"=>"");
$test = Getui::pushMessageToApp($template,$config,$data,$choice);

[
  "result" => "ok"
  "contentId" => "OSL-0728_hLKYR4tmkC7S0lI7QnSTT"
]