| Line 54... |
Line 54... |
| 54 |
public function add() {
|
54 |
public function add() {
|
| 55 |
if ($this->request->is('post')) {
|
55 |
if ($this->request->is('post')) {
|
| 56 |
if(isset($this->request->data['pushdata']) && !empty($this->request->data['pushdata'])) {
|
56 |
if(isset($this->request->data['pushdata']) && !empty($this->request->data['pushdata'])) {
|
| 57 |
$pushdata = json_decode($this->request->data['pushdata'],1);
|
57 |
$pushdata = json_decode($this->request->data['pushdata'],1);
|
| 58 |
$pushdata['pushdata'][0]['ip'] = $_SERVER['HTTP_CF_CONNECTING_IP'];
|
58 |
$pushdata['pushdata'][0]['ip'] = $_SERVER['HTTP_CF_CONNECTING_IP'];
|
| 59 |
$this->log(print_r($pushdata,1),'nodejs');
|
59 |
$this->log(print_r($pushdata['pushdata'][0],1),'nodejs');
|
| 60 |
/*
|
60 |
/*
|
| 61 |
$this->UserUrl->create();
|
61 |
$this->UserUrl->create();
|
| 62 |
if ($this->UserUrl->saveAll($pushdata['pushdata'])) {
|
62 |
if ($this->UserUrl->saveAll($pushdata['pushdata'])) {
|
| 63 |
$result = array('success' => true,'message'=>__('The url has been saved.'));
|
63 |
$result = array('success' => true,'message'=>__('The url has been saved.'));
|
| 64 |
} else {
|
64 |
} else {
|
| Line 70... |
Line 70... |
| 70 |
$this->SaholicLog->saveAll($pushdata['pushdata']);
|
70 |
$this->SaholicLog->saveAll($pushdata['pushdata']);
|
| 71 |
}
|
71 |
}
|
| 72 |
*/
|
72 |
*/
|
| 73 |
//Nodejs api call
|
73 |
//Nodejs api call
|
| 74 |
$url = "45.33.50.227:3001/addBrowsingHistory";
|
74 |
$url = "45.33.50.227:3001/addBrowsingHistory";
|
| 75 |
$this->make_request($url,$pushdata['pushdata']);
|
75 |
$this->make_request($url,$pushdata['pushdata'][0]);
|
| 76 |
$result = array('success' => true,'message'=>__('The url has been saved.'));
|
76 |
$result = array('success' => true,'message'=>__('The url has been saved.'));
|
| 77 |
$this->response->type('json');
|
77 |
$this->response->type('json');
|
| 78 |
$this->layout = 'ajax';
|
78 |
$this->layout = 'ajax';
|
| 79 |
$this->set(array(
|
79 |
$this->set(array(
|
| 80 |
'result' => $result,
|
80 |
'result' => $result,
|