You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
2.0 KiB

<?php
namespace jucheng\tongji;
class Statistics extends Base
{
/**
* 更新用户数
* @param int $number 用户数量
* @date 2022-10-25
*/
public function updateUserNumber($number = 1)
{
$url = $this->url . 'Statistics/updateUserNumber';
$data = [
'project_id' => $this->projectId,
'time' => time(),
'number' => $number,
];
// 发送请求
$result = http_data_post($url, base64_encode(json_encode($data)));
// 记录日志
$uid = defined('UID') ? UID : '';
platformLog($data, $result, 'jucheng_tongji_update_user_number_uid_' . $uid);
return $result;
}
/**
* 更新订单信息
* @param float $money 订单金额
* @param int $number 订单数量
* @date 2022-10-25
*/
public function updateOrderInfo($money, $number = 1)
{
$url = $this->url . 'Statistics/updateOrderInfo';
$data = [
'project_id' => $this->projectId,
'time' => time(),
'money' => $money,
'number' => $number,
];
// 发送请求
$result = http_data_post($url, base64_encode(json_encode($data)));
// 记录日志
$uid = defined('UID') ? UID : '';
platformLog($data, $result, 'jucheng_tongji_update_order_info_uid_' . $uid);
return $result;
}
/**
* 更新交易流水
* @param float $money 金额
* @date 2022-10-26
*/
public function updateTurnoverMoney($money)
{
$url = $this->url . 'Statistics/updateTurnoverMoney';
$data = [
'project_id' => $this->projectId,
'time' => time(),
'money' => $money
];
// 发送请求
$result = http_data_post($url, base64_encode(json_encode($data)));
// 记录日志
$uid = defined('UID') ? UID : '';
platformLog($data, $result, 'jucheng_tongji_update_turnover_money_uid_' . $uid);
return $result;
}
}