我使用 API 生成了一些特定的报告,并且我得到了一些项目来计算我赚了多少钱。它工作但现在它返回内部服务器错误。我使用 Upwork\API\Routers\Reports\Finance\Earnings API。
我使用的代码示例:
$users = new \Upwork\API\Routers\Organization\Users($client);
$info = $users->getMyInfo();
date_default_timezone_set('UTC');
$date1 = date('Y-m-d', strtotime('-1 year'));
$date2 = date('Y-m-d', strtotime('+1 month'));
$earnings = new \Upwork\API\Routers\Reports\Finance\Earnings($client);
$freelancerReference = $info->user->reference;
$params = array(
"tq" => "
SELECT
date,
date_due,
buyer_team__reference,
buyer_team__id,
buyer_team_name,
assignment__reference,
assignment_name,
amount,
type,
subtype,
description
WHERE
date >= '{$date1}' AND
date <= '{$date2}'
ORDER BY
date ASC
",
);
$amounts = $earnings->getByFreelancer($freelancerReference, $params);