Subversion Repositories SmartDukaan

Rev

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

Rev 16628 Rev 16840
Line 101... Line 101...
101
		}
101
		}
102
		return $this->redirect(array('action' => 'index'));
102
		return $this->redirect(array('action' => 'index'));
103
	}
103
	}
104
 
104
 
105
	public function getDateInstalls($date) {
105
	public function getDateInstalls($date) {
106
		$conditions = array('user_id'=>$this->Auth->User('id'),'transaction_date'=>$date);
106
		// $conditions = array('user_id'=>$this->Auth->User('id'),'transaction_date'=>$date);
107
		$fields = array('app_name','sum(installCount) AS installs','sum(payoutAmount) AS amount');
107
		// $fields = array('app_name','sum(installCount) AS installs','sum(payoutAmount) AS amount');
108
		$installs = $this->UserAppInstall->find('all',array('fields'=>$fields,'conditions'=>$conditions,'group'=>'app_id'));
108
		// $installs = $this->UserAppInstall->find('all',array('fields'=>$fields,'conditions'=>$conditions,'group'=>'app_id'));
109
		if(!empty($installs)){
109
		// if(!empty($installs)){
110
			foreach ($installs as $key => $value) {
110
		// 	foreach ($installs as $key => $value) {
111
				$result[$value['UserAppInstall']['app_name']] = $value[0];
111
		// 		$result[$value['UserAppInstall']['app_name']] = $value[0];
112
			}
112
		// 	}
113
			$response = array('installs' => $result,'success'=>true);
113
		// 	$response = array('installs' => $result,'success'=>true);
114
		}else{
114
		// }else{
115
			$response = array('installs' => null,'success'=>false);
115
		// 	$response = array('installs' => null,'success'=>false);
116
		}		
116
		// }		
117
		$this->response->type('json');
117
		// $this->response->type('json');
118
		$this->layout = 'ajax';
118
		// $this->layout = 'ajax';
119
		$this->set(array(
119
		// $this->set(array(
120
		    'result' => $response,
120
		//     'result' => $response,
121
		    // 'callback' => $callback,
121
		//     // 'callback' => $callback,
122
		    '_serialize' => array('result')
122
		//     '_serialize' => array('result')
123
		));
123
		// ));
124
		$this->render('/Elements/json');		
124
		// $this->render('/Elements/json');	
-
 
125
		$this->autoRender = false;	
-
 
126
		$this->request->onlyAllow('ajax');
-
 
127
		$url = $this->apihost.'appUserBatchDateDrillDown/1/'.$date;
-
 
128
		$getApp = $this->make_request($url,null);
-
 
129
		return json_encode($getApp);	
-
 
130
	}
-
 
131
 
-
 
132
	public function getAppByDate($date) {
-
 
133
		$this->autoRender = false;	
-
 
134
		$this->request->onlyAllow('ajax');
-
 
135
		$url = $this->apihost.'appUserBatchDateDrillDown/1/'.$date;
-
 
136
		$getApp = $this->make_request($url,null);
-
 
137
		return json_encode($getApp);
125
	}
138
	}
126
}
139
}