0

每当我使用getTasks()它都会返回Invalid Request

但是,当我使用getTasksForProject它时,它会返回值。

获取任务()

$tasks = $asana_client->tasks->getTasks(["opt_fields" => "name,due_on"]);

foreach ($tasks as $task) {
    var_dump($task);//will return error
}

getTasksForProject

$tasks = $asana_client->tasks->getTasksForProject($projects[12]->gid, ["opt_fields" => "name,due_on"]);

foreach ($tasks as $task) {
    var_dump($task);    
}

object(stdClass)#312 (3) { ["gid"]=> string(16) "**8**3*31**73173" ["due_on"]=> string(10) "2020-06-26" ["name"]=> string(15) "Navbar Settings" }

是什么导致了这个错误,在文档下它没有说需要 projectid 的参数?

4

1 回答 1

0

我尝试了您的项目代码并且可以工作,但是任务脚本有问题,我这样解决了:

我的任务通过工作区和 asiggnee 用户 gid 起作用:

public function getTasks($gid,$workspace,$client)
    {
        $tasks = $client->tasks->getTasks(array('workspace' => $workspace, 'assignee' => $gid), ["opt_fields" => "assignee,name,completed,start_on,due_on,completed_at,created_at,notes,parent,num_subtasks"]);
        return  $tasks;
    }

我这样称呼:

$tasks=collect($this->getTasks($user->gid,$workspace[0]->gid,$asana_client))->sortByDesc('created_at');

最后尝试像这样检索的项目:return dd($tasks);

PD:对不起,我的英语不好

于 2020-07-01T14:22:13.940 回答