Subversion Repositories SmartDukaan

Rev

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

Rev 19327 Rev 19333
Line 584... Line 584...
584
// 		$response = $this->make_request($url,null);
584
// 		$response = $this->make_request($url,null);
585
		
585
		
586
		$user_id = $this->Auth->user('id');
586
		$user_id = $this->Auth->user('id');
587
		$cachekey = 'target-'.$user_id;
587
		$cachekey = 'target-'.$user_id;
588
		$getoffer = Cache::read($cachekey,'target');
588
		$getoffer = Cache::read($cachekey,'target');
589
			
589
		$current_time = time();
590
		$response = "";
590
		$response = "";
591
		if($getoffer === false){
591
		if($getoffer === false){
592
			$offerurl = $this->apihost."getOfferForUser/?user_id=47";
592
			$offerurl = $this->apihost."getOfferForUser/?user_id=".user_id;
593
			$response = $this->make_request($offerurl,null);
593
			$response = $this->make_request($offerurl,null);
594
			Cache::write($cachekey , $response ,'target');
594
			Cache::write($cachekey , $response ,'target');
595
			if(!empty($response)){
595
			if(!empty($response)){
596
				$current_time = time();
596
				
597
								if($offerresponse['startDate']/1000 <= $current_time && $offerresponse['endDate']/1000 >= $current_time ){
597
								if($response['startDate']/1000 <= $current_time && $response['endDate']/1000 >= $current_time ){
598
					
598
					
599
								}
599
								}
600
								else{
600
								else{
601
									$offerresponse = "";
601
									$response = "";
602
									}
602
									}
603
				}
603
				}
604
				else{
604
				else{
605
					$offerresponse = "";
605
					$response = "";
606
				}
606
				}
607
		}else{
607
		}else{
-
 
608
			if(!empty($getoffer)){
608
			$response = $getoffer;
609
					$response = $getoffer;
-
 
610
					if($response['startDate']/1000 <= $current_time && $response['endDate']/1000 >= $current_time ){
-
 
611
						
-
 
612
					}
-
 
613
					else{
-
 
614
						$response = "";
-
 
615
					}
-
 
616
				}
609
		}
617
		}
610
		
618
		
611
		$maxpercentage = 0;
619
		$maxpercentage = 0;
612
// 		debug($response);
620
// 		debug($response);
613
		
621