<?php

class ipay_logAction extends BackendAction{

    public function _initialize() {
        parent::_initialize();
        $this->_mod = D('ipay_log');
    }

    
    
    protected function _search() {
        $map = array();    
		($time_start = I('time_start','', 'trim')) && $map['add_time'][] = array('egt', strtotime($time_start));
        ($time_end = I('time_end', '', 'trim')) && $map['add_time'][] = array('elt', strtotime($time_end));		
        ($trade_no = $this->_request('trade_no', 'trim')) && $map['trade_no|out_trade_no'] = array('like', '%'.$trade_no.'%');   
		($tid = $this->_request('tid', 'trim')) && $map['tid'] = $tid;  
 		$mod = $this->_request('mod', 'trim'); 
		if(!$mod){
		if(!$trade_no){	
		$map['mod'] = array('in','copypay,downpay');
		}		
		}else{
		$map['mod'] = $mod;	
		} 		   
		$pady = $this->_request('pady', 'trim');
		if($pady){
		if($pady==1){
		$map['isalipay'] = 0;	
		}else{
		$map['isalipay'] = 1;	
		}	
		}
		$padd = $this->_request('padd', 'trim');
		if($padd){
		if($padd==1){
		$map['pass'] = 1;	
		}else{
		$map['pass'] = 0;	
		}	
		}		
		if(!$trade_no && !$time_start){
		$map['add_time'][] = array('egt', strtotime('2021-04-28'));	//查询固定日期之后的
		}			
        $this->assign('search', array(
            'trade_no' => $trade_no,
			'tid' => $tid,
            'mod' => $mod,
			'pady' => $pady,
			'padd' => $padd,
			'time_start' => $time_start,
            'time_end' => $time_end,
        ));
        return $map;
    }

    

}