<?php
/*
* This file is part of the overtrue/wechat.
*
* (c) overtrue <i@overtrue.me>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace EasyWeChat\OfficialAccount\DataCube;
use EasyWeChat\Kernel\BaseClient;
/**
* Class Client.
*
* @author overtrue <i@overtrue.me>
*/
class Client extends BaseClient
{
public function userSummary(string $from, string $to)
{
return $this->query('datacube/getusersummary', $from, $to);
}
public function userCumulate(string $from, string $to)
{
return $this->query('datacube/getusercumulate', $from, $to);
}
public function articleSummary(string $from, string $to)
{
return $this->query('datacube/getarticlesummary', $from, $to);
}
public function articleTotal(string $from, string $to)
{
return $this->query('datacube/getarticletotal', $from, $to);
}
public function userReadSummary(string $from, string $to)
{
return $this->query('datacube/getuserread', $from, $to);
}
public function userReadHourly(string $from, string $to)
{
return $this->query('datacube/getuserreadhour', $from, $to);
}
public function userShareSummary(string $from, string $to)
{
return $this->query('datacube/getusershare', $from, $to);
}
public function userShareHourly(string $from, string $to)
{
return $this->query('datacube/getusersharehour', $from, $to);
}
public function upstreamMessageSummary(string $from, string $to)
{
return $this->query('datacube/getupstreammsg', $from, $to);
}
public function upstreamMessageHourly(string $from, string $to)
{
return $this->query('datacube/getupstreammsghour', $from, $to);
}
public function upstreamMessageWeekly(string $from, string $to)
{
return $this->query('datacube/getupstreammsgweek', $from, $to);
}
public function upstreamMessageMonthly(string $from, string $to)
{
return $this->query('datacube/getupstreammsgmonth', $from, $to);
}
public function upstreamMessageDistSummary(string $from, string $to)
{
return $this->query('datacube/getupstreammsgdist', $from, $to);
}
public function upstreamMessageDistWeekly(string $from, string $to)
{
return $this->query('datacube/getupstreammsgdistweek', $from, $to);
}
public function upstreamMessageDistMonthly(string $from, string $to)
{
return $this->query('datacube/getupstreammsgdistmonth', $from, $to);
}
public function interfaceSummary(string $from, string $to)
{
return $this->query('datacube/getinterfacesummary', $from, $to);
}
public function interfaceSummaryHourly(string $from, string $to)
{
return $this->query('datacube/getinterfacesummaryhour', $from, $to);
}
public function cardSummary(string $from, string $to, $condSource = 0)
{
$ext = [
'cond_source' => intval($condSource),
];
return $this->query('datacube/getcardbizuininfo', $from, $to, $ext);
}
public function freeCardSummary(string $from, string $to, int $condSource = 0, string $cardId = '')
{
$ext = [
'cond_source' => intval($condSource),
'card_id' => $cardId,
];
return $this->query('datacube/getcardcardinfo', $from, $to, $ext);
}
public function memberCardSummary(string $from, string $to, $condSource = 0)
{
$ext = [
'cond_source' => intval($condSource),
];
return $this->query('datacube/getcardmembercardinfo', $from, $to, $ext);
}
public function memberCardSummaryById(string $from, string $to, string $cardId)
{
$ext = [
'card_id' => $cardId,
];
return $this->query('datacube/getcardmembercarddetail', $from, $to, $ext);
}
protected function query(string $api, string $from, string $to, array $ext = [])
{
$params = array_merge([
'begin_date' => $from,
'end_date' => $to,
], $ext);
return $this->httpPostJson($api, $params);
}
}