获取业务绩效指标和统计数据。
请求参数
参数 | 类型 | 说明 | 必需的 |
---|---|---|---|
action | string | “GetStats” | Required |
timeline_days | int | (可选)检索时间线值的天数(最多 90 天)。 | Optional |
响应参数
参数 | 类型 | 说明 |
---|---|---|
result | string | 操作结果:成功或错误 |
income_today | float | 今天的总收入 |
income_thismonth | float | 本月总收入 |
income_thisyear | float | 今年总收入 |
income_alltime | float | 总收入 |
orders_pending | int | 挂单数量 |
orders_today_cancelled | int | 今天取消的订单数量 |
orders_today_pending | int | 当天日期的挂单数量 |
orders_today_fraud | int | 当天日期的欺诈订单计数 |
orders_today_active | int | 当天日期的活跃订单数 |
orders_today_total | int | 当天日期的订单数 |
orders_yesterday_cancelled | int | 昨天日期的取消订单数 |
orders_yesterday_pending | int | 昨天日期的挂单数量 |
orders_yesterday_fraud | int | 昨天日期的欺诈订单计数 |
orders_yesterday_active | int | 昨天日期的活跃订单数 |
orders_yesterday_total | int | 昨天日期的订单数 |
orders_thismonth_total | int | 本月订单数 |
orders_thisyear_total | int | 今年订单数 |
tickets_allactive | int | 有效票数 |
tickets_awaitingreply | int | 等待回复票数 |
tickets_flaggedtickets | int | 标记给进行 api 调用的管理员用户的票数 |
tickets_open | int | 打开状态的票数 |
tickets_answered | int | 已回答状态的票数 |
tickets_customerreply | int | 客户回复状态的票数 |
tickets_closed | int | 关闭状态的票数 |
tickets_onhold | int | On Hold 状态的票数 |
tickets_inprogress | int | 正在进行中的工单数量 |
cancellations_pending | int | 未决取消的计数 |
todoitems_due | int | 到期的待办事项计数 |
networkissues_open | int | 计算开放网络问题 |
quotes_valid | int | 有效引号的计数 |
staff_online | int | 在线员工人数 |
timeline_data | int | 如果在调用中指定了 $timeline_days ,则各种指标的历史每日计数。 |
示例请求 (CURL)
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
http_build_query(
array(
'action' => 'GetStats',
// See https://developers.whmcs.com/api/authentication
'username' => 'IDENTIFIER_OR_ADMIN_USERNAME',
'password' => 'SECRET_OR_HASHED_PASSWORD',
'timeline_days' => '7',
'responsetype' => 'json',
)
)
);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);
示例请求(本地 API)
$command = 'GetStats';
$postData = array(
'timeline_days' => '7',
);
$adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later
$results = localAPI($command, $postData, $adminUsername);
print_r($results);
示例响应 JSON
{
"result": "success",
"income_today": "$5.95 USD",
"income_thismonth": "$101.45 USD",
"income_thisyear": "$485.21 USD",
"income_alltime": "$2485.25 USD",
"orders_pending": 7,
"orders_today_cancelled": 1,
"orders_today_pending": 2,
"orders_today_fraud": 1,
"orders_today_active": 4,
"orders_today_total": 8,
"orders_yesterday_cancelled": 1,
"orders_yesterday_pending": 2,
"orders_yesterday_fraud": 0,
"orders_yesterday_active": 2,
"orders_yesterday_total": 4,
"orders_thismonth_total": 18,
"orders_thisyear_total": 124,
"tickets_allactive": 60,
"tickets_awaitingreply": 5,
"tickets_flaggedtickets": 3,
"tickets_open": 3,
"tickets_answered": 25,
"tickets_customerreply": 2,
"tickets_closed": 245,
"tickets_onhold": 30,
"tickets_inprogress": 0,
"cancellations_pending": 1,
"todoitems_due": 5,
"networkissues_open": 0,
"billableitems_uninvoiced": 1,
"quotes_valid": 2,
"staff_online": 1,
"timeline_data": {
"new_orders": {
"2018-11-30": 8,
"2018-11-29": 4,
"2018-11-28": 3,
"2018-11-27": 5,
"2018-11-26": 7,
"2018-11-25": 9,
"2018-11-24": 2
},
"accepted_orders": {
"2018-11-30": 4,
"2018-11-29": 2,
"2018-11-28": 3,
"2018-11-27": 4,
"2018-11-26": 5,
"2018-11-25": 8,
"2018-11-24": 2
},
"income": {
"2018-11-30": "5.95",
"2018-11-29": "10.17",
"2018-11-28": "15.30",
"2018-11-27": "18.90",
"2018-11-26": "17.45",
"2018-11-25": "10.28",
"2018-11-24": "5.18"
},
"expenditure": {
"2018-11-30": "0.00",
"2018-11-29": "0.00",
"2018-11-28": "0.00",
"2018-11-27": "0.00",
"2018-11-26": "0.00",
"2018-11-25": "0.00",
"2018-11-24": "0.00"
},
"new_tickets": {
"2018-11-30": 5,
"2018-11-29": 7,
"2018-11-28": 10,
"2018-11-27": 8,
"2018-11-26": 4,
"2018-11-25": 9,
"2018-11-24": 12
}
}
}
相关用法
- PHP WHMCS GetStaffOnline用法及代码示例
- PHP WHMCS GetServers用法及代码示例
- PHP WHMCS GetSupportStatuses用法及代码示例
- PHP WHMCS GetSupportDepartments用法及代码示例
- PHP WHMCS GetTicketNotes用法及代码示例
- PHP WHMCS GetUsers用法及代码示例
- PHP WHMCS GetTLDPricing用法及代码示例
- PHP WHMCS GetToDoItemStatuses用法及代码示例
- PHP WHMCS GetPermissionsList用法及代码示例
- PHP WHMCS GetCurrencies用法及代码示例
- PHP WHMCS GetEmails用法及代码示例
- PHP WHMCS GetClientPassword用法及代码示例
- PHP WHMCS GetPromotions用法及代码示例
- PHP WHMCS GetRegistrars用法及代码示例
- PHP WHMCS GetAutomationLog用法及代码示例
- PHP WHMCS GetQuotes用法及代码示例
- PHP WHMCS GetActivityLog用法及代码示例
- PHP WHMCS GetPaymentMethods用法及代码示例
- PHP WHMCS GetModuleQueue用法及代码示例
- PHP WHMCS GetTickets用法及代码示例
- PHP WHMCS GetProducts用法及代码示例
- PHP WHMCS GetProjects用法及代码示例
- PHP WHMCS GetInvoices用法及代码示例
- PHP WHMCS GetPayMethods用法及代码示例
- PHP WHMCS GetHealthStatus用法及代码示例
注:本文由纯净天空筛选整理自whmcs.com大神的英文原创作品 GetStats。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。