Commit 34e8b4e7 authored by 杨培's avatar 杨培

增加用户中心事件跟踪服务;增加论坛数据统计服务;

parent adb30c26
<?php
/**
* Created by PhpStorm.
* User: pader
* Date: 2018/6/13
* Time: 10:26
*/
require __DIR__.'/_init.php';
use internalApi\bbs\Stat;
Stat::setDebug();
$f = 1528732800;
$t = 1528819199;
//$data = Stat::threadsActivityInTime($f, $t, 3600*5);
//$data = Stat::countReplyThumbup(strtotime('Today'), strtotime('Tomorrow')-1);
print_r($data);
<?php
/**
* Created by PhpStorm.
* User: pader
* Date: 2018/6/13
* Time: 17:25
*/
use internalApi\ucenter\Track;
require __DIR__.'/_init.php';
echo Track::track('test');
<?php
/**
* Created by PhpStorm.
* User: pader
* Date: 2018/6/13
* Time: 09:05
*/
namespace internalApi\bbs;
use internalApi\base\Client;
/**
* 论坛数据统计服务
* @package internalApi\bbs
*/
class Stat extends Client
{
/**
* 统计在指定时间范围内的新帖子数量
*
* @param int $timebetween
* @param int $timeand
* @return int
*/
public static function countThreads($timeBetween, $timeAnd)
{
return self::call('stat.countThreads', compact('timeBetween', 'timeAnd'));
}
/**
* 统计指定时间范围内且在指定时限内有回帖的帖子数量
*
* @param int $timeBetween
* @param int $timeAnd
* @param int $inSeconds 首个回帖产生时间秒数范围
* @param string $way 首个回帖在产生时间内还是时间外的,时间内使用in,时间外使用out
* @return int
*/
public static function countThreadsActivity($timeBetween, $timeAnd, $inSeconds, $way='in')
{
return self::call('stat.countThreadsActivity', compact('timeBetween', 'timeAnd', 'inSeconds', 'way'));
}
/**
* 统计指定时间范围内的回复数量
*
* @param int $timeBetween
* @param int $timeAnd
* @return int
*/
public static function countReplysBetween($timeBetween, $timeAnd)
{
return self::call('stat.countReplysBetween', compact('timeBetween', 'timeAnd'));
}
/**
* 统计指定时间范围内的回复点赞数
*
* @param int $timeBetween
* @param int $timeAnd
* @return int
*/
public static function countReplyThumbup($timeBetween, $timeAnd) {
return self::call('stat.countReplyThumbup', compact('timeBetween', 'timeAnd'));
}
/**
* 统计指定时间范围内的活跃用户
*
* @param int $timeBetween
* @param int $timeAnd
* @return int
*/
public static function countActivityUser($timeBetween, $timeAnd) {
return self::call('stat.countActivityUser', compact('timeBetween', 'timeAnd'));
}
/**
* 统计指定时间范围内的签到数量
*
* @param int $timeBetween
* @param int $timeAnd
* @return int
*/
public static function countSign($timeBetween, $timeAnd) {
return self::call('stat.countSign', compact('timeBetween', 'timeAnd'));
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: pader
* Date: 2018/6/13
* Time: 17:13
*/
namespace internalApi\ucenter;
use internalApi\base\Client;
/**
* 用户中心事件跟踪服务
* @package internalApi\ucenter
*/
class Track extends Client
{
/**
* 添加事件
*
* @param string $event 事件、32个字符以内
* @param int $uid 用户UID,0代表访客
* @param int|null $time 时间,默认为当前时间
* @param array $props 属性键值列表
* @return string 事件ID
*/
public static function track($event, $uid=0, $time=null, $props=[])
{
return self::call('track.track', compact('event', 'uid', 'time', 'props'));
}
/**
* 更新事件
*
* @param string $id
* @param int $uid
* @param int|null $time
* @param array $props
*/
public static function update($id, $uid=0, $time=null, $props=[])
{
return self::call('track.update', compact('id', 'uid', 'time', 'props'));
}
}
\ No newline at end of file
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