<?php
/**
 * 信息管理
 * @Copyright (C) 2016 汉潮 All rights reserved.
 * @License http://www.hanchao9999.com
 * @Author xiaogg <xiaogg@sina.cn>
 */
 
namespace Admin\Controller;
class SmsLogsController extends BaseController{
    public function index(){
        /* 查询条件初始化 */
        $map = array();
        $postdata=I('param.');
        if($postdata['name']){
            $where = $wheres = array();
            $where['id']=array('like','%'.$postdata['name'].'%');
            $where['username']=array('like','%'.$postdata['name'].'%');
            $where['mobile']=array('like','%'.$postdata['name'].'%');
            $where['_logic'] = 'or';
            $wheres['_complex'] = $where;
            $uid = M('Member')->where($wheres)->field('id')->select();
            $arr = array();
            foreach ($uid as $k => $v) {
                $arr[] = $v['id'];
            }
            $map['uid'] = implode(',',$arr);
        }
        if($postdata['time_frame'] && $postdata['time_end']){
            $map['sendtime'] = array(array('gt',strtotime($postdata['time_frame'])),array('lt',strtotime($postdata['time_end'])));
        }
        if($postdata['is_success'] == 2){
            $map['is_success'] = 0;
        }else if($postdata['is_success'] == 1){
			$map['is_success'] = 1;
		}
        $list = $this->lists('SmsLogs', $map);
        $this->assign($postdata);
        $this->assign('list', $list);

        $this->display();
    }
}