65 lines
2.1 KiB
PHP
65 lines
2.1 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers;
|
|
|
|
class WrenchUserContacts extends BaseController
|
|
{
|
|
|
|
/*
|
|
CREATE TABLE members_contacts_import (
|
|
id SERIAL,
|
|
uid uuid DEFAULT uuid_generate_v4(),
|
|
member_id INT REFERENCES members(id) NOT NULL,
|
|
member_uid VARCHAR(150) NOT NULL,
|
|
raw_contacts TEXT,
|
|
status INT DEFAULT 0,
|
|
added timestamp without time zone DEFAULT now(),
|
|
updated timestamp without time zone DEFAULT now()
|
|
);
|
|
ALTER TABLE ONLY members_contacts_import
|
|
ADD CONSTRAINT members_contacts_import_id_key UNIQUE (id);
|
|
|
|
* this.usrData = {action:22010,
|
|
member_id: this.sessionDataProviderService.member_id,
|
|
uid: this.sessionDataProviderService.member_uid,
|
|
sessionid: this.sessionDataProviderService.session ,
|
|
raw_contacts: contactResult }
|
|
*/
|
|
public function usersContacts(){
|
|
$raw_json = file_get_contents('php://input');
|
|
$in = json_decode($raw_json, true);
|
|
$out =[];
|
|
$in["action"] = WRENCHBOARD_ACCOUNT_CONTACTIMPORT;
|
|
|
|
if (isset($in["uid"]) && $in["uid"] !='' ){
|
|
$in["member_uid"]=$in["uid"];
|
|
}
|
|
|
|
$in["raw_contacts"] = serialize($in['raw_contacts']);
|
|
$ret = $this->wrenchboard->wrenchboard_api($in, $out);
|
|
$out['internal_return'] = $ret;
|
|
log_message('critical', "usersBanners ********* ALL ".serialize($out) );
|
|
|
|
return $this->summaryReturnData($in,$out); //json_encode( $final_out );
|
|
}
|
|
|
|
private function processContacts( $in ){
|
|
log_message('critical', "************************ cachecontacts 0001 ".serialize($in));
|
|
|
|
$inx =[];
|
|
$inx["member_id"] = $in["member_id"];
|
|
$inx["uid"] = $in["uid"];
|
|
$inx["sessionid"] = $in["sessionid"];
|
|
$raw_contacts = $in["raw_contacts"];
|
|
|
|
foreach ( $raw_contacts["contacts"] as $rows){
|
|
$firstname = $rows["name"]["given"];
|
|
$lastname = $rows["name"]["family"];
|
|
$contactid = $rows["contactId"];
|
|
log_message('critical', "************************ $firstname $lastname $contactid");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} |