/** * 查看店铺列表 */ public function showstoreOp() { $model = Model('stat'); $where = array(); if (in_array($_GET['type'], array('newbyday', 'newbyweek', 'newbymonth', 'storearea'))) { $actionurl = 'index.php?act=stat_store&op=showstore&type=' . $_GET['type'] . '&t=' . $this->search_arr['t']; $searchtime_arr_tmp = explode('|', $this->search_arr['t']); foreach ((array) $searchtime_arr_tmp as $k => $v) { $searchtime_arr[] = intval($v); } $where['store_time'] = array('between', $searchtime_arr); } //商品分类 $sc_id = intval($_GET['scid']); if ($sc_id > 0) { $where['sc_id'] = $sc_id; $actionurl .= "&scid={$sc_id}"; } //省份 if (isset($_GET['provid'])) { $province_id = intval($_GET['provid']); $where['province_id'] = $province_id; $actionurl .= "&provid={$province_id}"; } if ($_GET['exporttype'] == 'excel') { $store_list = $model->getNewStoreStatList($where); } else { $store_list = $model->getNewStoreStatList($where, '', 10); } //店铺等级 $model_grade = Model('store_grade'); $grade_list = $model_grade->getGradeList(); if (!empty($grade_list)) { $search_grade_list = array(); foreach ($grade_list as $k => $v) { $search_grade_list[$v['sg_id']] = $v['sg_name']; } } //导出Excel if ($_GET['exporttype'] == 'excel') { //导出Excel uk86_import('libraries.uk86excel'); $excel_obj = new Uk86Excel(); $excel_data = array(); //设置样式 $excel_obj->setStyle(array('id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1'))); //header $excel_data[0][] = array('styleid' => 's_title', 'data' => '店铺名称'); $excel_data[0][] = array('styleid' => 's_title', 'data' => '店主账号'); $excel_data[0][] = array('styleid' => 's_title', 'data' => '店主卖家账号'); $excel_data[0][] = array('styleid' => 's_title', 'data' => '所属等级'); $excel_data[0][] = array('styleid' => 's_title', 'data' => '有效期至'); $excel_data[0][] = array('styleid' => 's_title', 'data' => '开店时间'); //data foreach ($store_list as $k => $v) { $excel_data[$k + 1][] = array('data' => $v['store_name']); $excel_data[$k + 1][] = array('data' => $v['member_name']); $excel_data[$k + 1][] = array('data' => $v['seller_name']); $excel_data[$k + 1][] = array('data' => $search_grade_list[$v['grade_id']]); $excel_data[$k + 1][] = array('data' => $v['store_end_time'] ? date('Y-m-d', $v['store_end_time']) : '无限制'); $excel_data[$k + 1][] = array('data' => date('Y-m-d', $v['store_time'])); } $excel_data = $excel_obj->charset($excel_data, CHARSET); $excel_obj->addArray($excel_data); $excel_obj->addWorksheet($excel_obj->charset('新增店铺', CHARSET)); $excel_obj->generateXML($excel_obj->charset('新增店铺', CHARSET) . date('Y-m-d-H', time())); exit; } Tpl::output('search_grade_list', $search_grade_list); Tpl::output('actionurl', $actionurl); Tpl::output('store_list', $store_list); Tpl::output('show_page', $model->showpage(2)); $this->links[] = array('url' => 'act=stat_store&op=showstore', 'lang' => 'stat_storelist'); Tpl::output('top_link', $this->sublink($this->links, 'showstore')); Tpl::showpage('stat.info.storelist'); }