/**
  * 列表
  */
 public function index()
 {
     parent::_authUser(array(1, 2, 5, 7, 8, 9));
     $title = $this->_get('q');
     //关键字搜索
     $areaId = $this->_getid('area_id', 0);
     //城区
     $serviceId = $this->_getid('service_id', 0);
     //商圈
     $shopType = $this->_getid('shop_type', 0);
     //店铺类型
     $tips = $this->_getid('tips', 0);
     //参与活动
     $status = $this->_getid('status', 2);
     //状态
     $p = $this->_getid('p', 1);
     $where = array('AND' => array('city_id' => steadmin::$adminInfo['city_id']));
     if ($title) {
         $where['LIKE'] = array('shop_name' => parent::safeSearch($title));
     }
     if ($tips) {
         $where['LIKE'] = array('tips_list' => ',' . ($tips - 1) . ',');
     }
     if ($areaId) {
         $where['AND']['area_id'] = $areaId;
     }
     if ($serviceId) {
         $where['AND']['service_id'] = $serviceId;
     }
     if ($shopType) {
         $where['AND']['shop_type'] = $shopType - 1;
     }
     if ($status) {
         $where['AND']['status'] = $status - 1;
     }
     //DOTO:后期可能会让另外的帐号也可以来管理这个店(比喻品牌创建了多个分店,那么品牌可以管理所有的分店,分店也可以管理自己的店),那么需要额外指定管理权限
     if (!parent::_checkIsAdmin()) {
         if (steadmin::$adminInfo['groupid'] == 8) {
             //店长
             $where['AND']['shop_id'] = steadmin::$adminInfo['shop_id'];
         } elseif (parent::_checkIsPresident()) {
             $where['AND']['service_id'] = steadmin::$adminInfo['service_id'];
         } else {
             $where['AND']['user_id'] = steadmin::$adminInfo['user_id'];
         }
     }
     $rs = M('ste_shop')->where($where)->page($p)->order('shop_id DESC')->findAll();
     $total = M('ste_shop')->getTotal();
     //        z(M('ste_shop')->getAllSql());
     //        z($rs);
     if ($rs) {
         foreach ($rs as $k => $v) {
             $rs[$k]['userName'] = parent::_getAdminName($v['user_id']);
             $rs[$k]['tipsList'] = implode(',', parent::_getTipsGroupList($this->steSetting['shop_tips'], $v['tips_list']));
             $rs[$k]['areaName'] = parent::getAreaName($v['area_id']);
             $rs[$k]['serviceName'] = isset($this->serviceData[$v['service_id']]) ? $this->serviceData[$v['service_id']]['stitle'] : '';
             $rs[$k]['stime'] = date('H:i', strtotime($v['stime']));
             $rs[$k]['etime'] = date('H:i', strtotime($v['etime']));
         }
     }
     $this->assign(array('adminData' => $this->adminData, 'service' => $this->serviceData, 'area' => M('area')->field('aid,name')->where(array('city_id' => steadmin::$adminInfo['city_id'], 'area_level' => 2))->findAll(false), 'rs' => $rs, 'total' => $total, 'p' => $p, 'area_id' => $areaId, 'service_id' => $serviceId, 'shop_type' => $shopType, 'title' => $title, 'tips_id' => $tips, 'status' => $status, 'setting' => $this->steSetting));
     $this->display();
 }