Subversion Repositories SmartDukaan

Rev

Rev 14934 | Rev 17096 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 14934 Rev 17091
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));
59
				$this->log(print_r($pushdata,1),'nodejs');
-
 
60
				/*
60
				$this->UserUrl->create();
61
				$this->UserUrl->create();
61
				if ($this->UserUrl->saveAll($pushdata['pushdata'])) {
62
				if ($this->UserUrl->saveAll($pushdata['pushdata'])) {
62
					$result = array('success' => true,'message'=>__('The url has been saved.'));
63
					$result = array('success' => true,'message'=>__('The url has been saved.'));
63
				} else {
64
				} else {
64
					$result = array('success' => false,'message'=>__('The url could not be saved. Please, try again.'));
65
					$result = array('success' => false,'message'=>__('The url could not be saved. Please, try again.'));
Line 66... Line 67...
66
				if(isset($pushdata['pushdata'][0]['httpstatus']) && !empty($pushdata['pushdata'][0]['httpstatus'])) {
67
				if(isset($pushdata['pushdata'][0]['httpstatus']) && !empty($pushdata['pushdata'][0]['httpstatus'])) {
67
					$this->loadModel('SaholicLog');
68
					$this->loadModel('SaholicLog');
68
					$this->SaholicLog->create();
69
					$this->SaholicLog->create();
69
					$this->SaholicLog->saveAll($pushdata['pushdata']);
70
					$this->SaholicLog->saveAll($pushdata['pushdata']);
70
				}
71
				}
-
 
72
				*/
-
 
73
				//Nodejs api call
-
 
74
				$url = "45.33.50.227:3001/addBrowsingHistory";
-
 
75
				$this->make_request($url,$pushdata['pushdata']);
-
 
76
				$result = array('success' => true,'message'=>__('The url has been saved.'));
71
				$this->response->type('json');
77
				$this->response->type('json');
72
				$this->layout = 'ajax';
78
				$this->layout = 'ajax';
73
				$this->set(array(
79
				$this->set(array(
74
				    'result' => $result,
80
				    'result' => $result,
75
				    // 'callback' => $callback,
81
				    // 'callback' => $callback,