Subversion Repositories SmartDukaan

Rev

Rev 21209 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 21209 Rev 21219
Line 57... Line 57...
57
				$result = array('success'=>false);
57
				$result = array('success'=>false);
58
				$this->log('error'.print_r($this->request->data,1),'gcm');
58
				$this->log('error'.print_r($this->request->data,1),'gcm');
59
			} else {
59
			} else {
60
				$dataForModel = $this->request->data;
60
				$dataForModel = $this->request->data;
61
				$this->log('before find '.print_r($dataForModel,1),'gcm');
61
				$this->log('before find '.print_r($dataForModel,1),'gcm');
62
				$data = $this->GcmUser->find('first',array('conditions'=>array('user_id'=>$this->request->data['user_id'],'imeinumber'=>$this->request->data['imeinumber']),'order'=>array('id'=>'desc')));
62
				$data = $this->GcmUser->find('first',array('conditions'=>array('user_id'=>$dataForModel['user_id'],'imeinumber'=>$dataForModel['imeinumber']),'order'=>array('id'=>'desc')));
63
				$this->log("found row ".print_r($data,1),'gcm');
63
				$this->log("found row ".print_r($data,1),'gcm');
64
				if(!empty($data)){
64
				if(!empty($data)){
65
					$dataForModel['id'] = $data['GcmUser']['id'];
65
					$dataForModel['id'] = $data['GcmUser']['id'];
66
					if(!array_key_exists('notification_type', $dataForModel)) {
66
					if(!array_key_exists('notification_type', $dataForModel)) {
-
 
67
						if($dataForModel['gcm_regid']!=$data['GcmUser']['gcm_regid']){
67
						$dataForModel['notification_type'] = 'gcm';
68
							$dataForModel['notification_type'] = 'gcm';
-
 
69
						}
68
					} 
70
					} 
69
					$dataForModel['failurecount'] = 0;					
71
					$dataForModel['failurecount'] = 0;					
70
				}else{
72
				}else{
71
					$this->GcmUser->create();
73
					$this->GcmUser->create();
72
				}			
74
				}