我编写了以下ProcFu代码来更新项目:
$data = @json_decode($pf_payload, true);
$receivers = explode(",", str_replace(' ', '', strip_tags($data['receivers'])));
$id = $data['id'];
foreach($receivers as $receiver){
$contact = call_pf_script("podio_search_app.pf", ["app_id" => 21403776, "field_id" => 175887225, "search_val" => $receiver, "condition" => "C", "max_results" => 1]);
$contact_item_id = @json_decode($contact, true)[0]['item_id'];
if($contact_item_id != ""){
$contact_emails = @json_decode(
call_pf_script("podio_item_field_get.pf", ["podio_item_id" => $contact_item_id, "field_id" => 175891813, "raw" => true]), true);
$emails = array(
175891813 => array("values" => array())
);
foreach($contact_emails as $email){
array_push($emails[175891813]["values"], array("value" => array("item_id" => $email['value']['item_id'])));
}
array_push($emails[175891813]["values"], array("value" => array("item_id" => (int) $id)));
//$emails = @json_encode($emails, true);
$result = call_pf_script("podio_item_fields_update.pf", ["podio_item_id" => $contact_item_id, "values" => $emails, "hook" => false, "silent" => false]);
}
}
以某种方式可以正确执行此代码,但不会更新指定的项目(无错误消息)。我正在使用的脚本如下:https://procfu.com/script.php?s=podio_item_fields_update.pf。我也尝试过仅将id放入$ emails数组中,并尝试将类似array('item_id'=> 239428)之类的数组放入$ emails数组中,但都没有运气。
我希望有人能帮助我