raw_contacts
This commit is contained in:
@@ -281,6 +281,8 @@ enum { PARTNER_STRIPE };
|
||||
#define WRENCHBOARD_ACCOUNT_NOTIFICATIONS 11205
|
||||
|
||||
#define WRENCHBOARD_ACCOUNT_DASHRECENT 11206
|
||||
#define WRENCHBOARD_ACCOUNT_CONTACTIMPORT 11207
|
||||
|
||||
|
||||
#define WRENCHBOARD_RESOURCE_MYFILES 11307
|
||||
#define WRENCHBOARD_MYFILES_LIST 11309
|
||||
|
||||
@@ -128,6 +128,7 @@ long test() {
|
||||
return 0L;
|
||||
}
|
||||
long WrenchTestWalletCapability(CVars in, CVars &out);
|
||||
long WrenchImportContacts(CVars in, CVars &out);
|
||||
|
||||
long account_calls(CVars in, CVars &out) {
|
||||
logfmt(logINFO, "account_calls()");
|
||||
@@ -489,6 +490,11 @@ long account_calls(CVars in, CVars &out) {
|
||||
return WrenchRecentDash(in, out);
|
||||
break;
|
||||
|
||||
case WRENCHBOARD_ACCOUNT_CONTACTIMPORT:
|
||||
// Contact imports
|
||||
return WrenchImportContacts(in, out);
|
||||
break;
|
||||
|
||||
case WRENCHBOARD_RESOURCE_MYFILES:
|
||||
return WrenchRegisterMyFileUpload(in, out);
|
||||
break;
|
||||
@@ -521,6 +527,37 @@ long account_calls(CVars in, CVars &out) {
|
||||
|
||||
#define PHP_API_TRANSFER_COMPLETE 200
|
||||
|
||||
|
||||
long WrenchImportContacts(CVars in, CVars &out) {
|
||||
long ret = PHP_API_BAD_PARAM;
|
||||
logfmt(logINFO, "long WrenchImportContacts(CVars in, CVars out)");
|
||||
REQ_STRING(in, "raw_contacts", 0, 5500, "(.*)");
|
||||
long member_id = REQ_LONG(in, "member_id", 1, -1);
|
||||
REQ_STRING(in, "member_uid", 20, 100, "(.*)");
|
||||
CVars x;
|
||||
const PGresult *res = pgsql_query("SELECT id AS import_id FROM members_contacts_import WHERE member_id=%lu", member_id);
|
||||
if (res != NULL && pgsql_num_rows(res) > 0) {
|
||||
map<const char*, const char*>f = pgsql_fetch_assoc(res, 0);
|
||||
CVars rec;
|
||||
map_to_cvars(f, rec);
|
||||
|
||||
x["raw_contacts"] = in["raw_contacts"];
|
||||
x["raw_contacts"].set_valid(true);
|
||||
update_db_record(DBS_VALID, "members_contacts_import", x, rec["import_id"].Long());
|
||||
ret = PHP_API_OK;
|
||||
} else {
|
||||
x["member_id"] = member_id;
|
||||
x["member_id"].set_valid(true);
|
||||
x["member_uid"] = member_uid;
|
||||
x["member_uid"].set_valid(true);
|
||||
x["raw_contacts"] = in["description"];
|
||||
x["raw_contacts"].set_valid(true);
|
||||
long sid = insert_db_record(DBS_VALID, "members_contacts_import", "members_contacts_import_id_seq", x);
|
||||
ret = PHP_API_OK;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
long WrenchMyPage(CVars in, CVars &out) {
|
||||
logfmt(logINFO, "WrenchMyPageIntro()");
|
||||
long ret = PHP_API_BAD_PARAM;
|
||||
|
||||
@@ -280,6 +280,8 @@ const WRENCHBOARD_FAMILY_HOMEBANNERS = 11203;
|
||||
|
||||
define('WRENCHBOARD_ACCOUNT_NOTIFICATIONS', 11205);
|
||||
|
||||
const WRENCHBOARD_ACCOUNT_CONTACTIMPORT = 11207;
|
||||
|
||||
const WRENCHBOARD_PICTURE_PROFILE = 11300;
|
||||
const WRENCHBOARD_PICTURE_JOB = 11303;
|
||||
const WRENCHBOARD_PICTURE_FAMBANNER= 11304;
|
||||
|
||||
@@ -57,7 +57,7 @@ $routes->post('/en/wrench/api/v1/paymenthx', 'WrenchApi::apigate');
|
||||
$routes->post('/en/wrench/api/v1/purchasehx', 'WrenchApi::apigate');
|
||||
$routes->post('/en/wrench/api/v1/contracthx', 'WrenchJobs::contractHx');
|
||||
|
||||
$routes->post('/en/wrench/api/v1/cachecontacts', 'WrenchApi::apigate');
|
||||
$routes->post('/en/wrench/api/v1/WrenchUserContacts', 'WrenchApi::usersContacts');
|
||||
|
||||
|
||||
$routes->post('/en/wrench/api/v1/stepresetpass', 'WrenchApi::apigate');
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
<?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");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user