/** * 获得数据列表 */ public function doDefault(ZOL_Request $input, ZOL_Response $output) { $wArr = array(); #搜索字段 $whereSql = ""; $page = (int) $input->get('page') < 1 ? 1 : (int) $input->get('page'); $member = $input->get('member'); if ($member) { $memInfo = Helper_Member::getMemberInfo(array('phoneOrCardno' => $member)); if ($memInfo) { $output->memberId = $memInfo["id"]; } } if ($output->serctype) { $whereSql .= " AND ctype = " . $output->serctype; } if ($output->memberId) { $whereSql .= " AND memberId = " . $output->memberId; } $pageUrl = "?c={$output->ctlName}&a={$output->actName}&page={$page}&memberId={$output->memberId}&ctype={$wArr['ctype']}"; $pageSize = 30; $orderSql = "order by id desc"; $data = Helper_Dao::getList(array('dbName' => "Db_Andyou", 'tblName' => "memeberotherpro", 'cols' => "*", 'pageSize' => $pageSize, 'page' => $page, 'pageUrl' => $pageUrl, 'whereSql' => $whereSql, 'orderSql' => $orderSql, 'iswrite' => true, 'pageTpl' => 9)); if ($data) { $output->pageBar = $data['pageBar']; $output->allCnt = $data['allCnt']; $output->data = $data['data']; $output->pageUrl = $pageUrl; } $output->member = $member; $output->proCtypeArr = ZOL_Config::get("GLOBAL", "PRO_CTYPE"); $output->setTemplate('MemeberOtherPro'); }
protected static function init($mongoServerKey = 0, $isMongoWrite = 0) { static $reconn = 0; static $faildServer = null; $mongoKey = self::$_mongoServerKey . $mongoServerKey . $isMongoWrite; if (empty(self::$mongo[$mongoKey])) { defined('MONGOCACHE_CONF_KEY') || define('MONGOCACHE_CONF_KEY', 'Mongo'); $memConf = ZOL_Config::get(MONGOCACHE_CONF_KEY); if ($memConf) { self::$server = $memConf; } try { if ($mongoServerKey) { if (self::$mongoDbArr[$mongoServerKey]) { if ($isMongoWrite) { self::$server = self::$mongoDbArr[$mongoServerKey]['wserver']; self::$eserver = self::$mongoDbArr[$mongoServerKey]['wserver']; } else { self::$server = self::$mongoDbArr[$mongoServerKey]['server']; self::$eserver = self::$mongoDbArr[$mongoServerKey]['eserver']; } } } else { self::$server = 'localhost'; self::$eserver = 'mongo_server_zoldb'; //均衡服务器 } if ($reconn == 0) { $server = self::$server; } else { $server = self::$eserver; } $server = 'mongodb://' . $server; self::$mongo[$mongoKey] = new Mongo($server, array('timeout' => self::$timeout, 'persist' => 'Product')); } catch (MongoException $e) { if (self::$mongo[$mongoKey]) { self::$mongo[$mongoKey]->close(); } self::$mongo[$mongoKey] = null; if ($reconn < 2) { ++$reconn; return self::init($mongoServerKey, $isMongoWrite); } ZOL_Log::write('异常1:' . $e->getMessage(), ZOL_Log::TYPE_ERROR); Plugin_Expires::setExpires(0); ZOL_Http::sendHeader(404); trigger_error($e->getMessage(), E_USER_WARNING); exit; } } $reconn = 0; }
protected static function init() { if (empty(self::$mem)) { self::$mem = new Memcache(); defined('MEMCACHE_CONF_KEY') || define('MEMCACHE_CONF_KEY', 'Memcache'); $memConf = ZOL_Config::get(MEMCACHE_CONF_KEY); if ($memConf) { self::$servers = $memConf; } foreach (self::$servers as $val) { $exp = explode(':', $val); self::$mem->addServer($exp[0], $exp[1]); } } }
/** * 获得数据列表 */ public function doDefault(ZOL_Request $input, ZOL_Response $output) { $output->ctype = (int) $input->get("ctype"); //其他产品的消费类型 if (!$output->ctype) { $output->ctype = 2; } //获得所有会员类型 $output->memberCate = Helper_Member::getMemberCatePairs(); //获得所有的员工 $output->staffArr = Helper_Staff::getStaffPairs(); $output->proCtypeArr = ZOL_Config::get("GLOBAL", "PRO_CTYPE"); if (!isset($output->proCtypeArr[$output->ctype])) { echo "ERROR"; exit; } $output->ctypeName = $output->proCtypeArr[$output->ctype]['name']; $output->setTemplate('CheckoutOtherPro'); }
/** * 父类的Validate */ public function baseValidate(ZOL_Request $input, ZOL_Response $output) { $output->execName = $input->execName = $input->getExecName(); $output->actName = $input->actName = $input->getActionName(); $output->ctlName = $input->ctlName = $input->getControllerName(); $output->admin = $input->cookie(Helper_Yun_Member::$strUid); $output->userId = $input->cookie(Helper_Yun_Member::$strUid); #用户名 $cipher = $input->cookie(Helper_Yun_Member::$strCipher); $output->sysCfg = Helper_Yun_Option::getAllOptions(); $output->sysName = empty($output->sysCfg['SysName']) ? "" : $output->sysCfg['SysName']["value"]; if (!$output->noLoginCheck) { #验证登录 $output->isLogin = Helper_Yun_Member::checkLogin(array('userid' => $output->userId, 'cipher' => $cipher)); if (!$output->isLogin) { #如果登录不OK $backUrl = isset($_SERVER['REQUEST_URI']) ? 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] : ''; if (strpos($backUrl, "Login")) { $backUrl = ""; } Helper_Front::JumpToLogin(array('backUrl' => $backUrl)); } } #获得管理员身份 $output->adminInfo = Helper_Yun_AdminUser::getAdminUserInfo(array('userId' => $output->userId)); $output->adminType = (int) $output->adminInfo["isAdmin"]; //管理员类型,用于权限判断 if ($output->permission && !in_array($output->adminType, $output->permission)) { echo "Permission denied"; exit; } //所有站点的名字 $output->siteNames = ZOL_Config::get("Yun_Sites", "NAMES"); #头尾html $output->header = $output->fetchCol("Part/Header"); //左侧 $output->navi = $output->fetchCol("Part/Navi"); $output->footer = $output->fetchCol("Part/Footer"); return true; return true; }
/** * 获得日志列表 */ public static function getList($paramArr) { $options = array('appName' => '', 'subId' => 0, 'objId' => 0, 'num' => 10, 'offset' => '', 'getNum' => 0, 'whereSql' => ""); if (is_array($paramArr)) { $options = array_merge($options, $paramArr); } extract($options); $idMap = ZOL_Config::get("Star/InnerApp", "ID"); #顶级的分类 if (!isset($idMap[$appName])) { return false; } $subIdMap = ZOL_Config::get("Star/InnerApp", "SUBID"); #二级的分类 #将subid从英文形式转换为数字 if (isset($subIdMap[$appName]) && isset($subIdMap[$appName][$subId])) { $subId = $subIdMap[$appName][$subId]["id"]; } if ($appName) { $whereSql .= " and appId = " . $idMap[$appName]["id"]; } if ($subId) { $whereSql .= " and subId = " . $subId; } if ($objId) { $whereSql .= " and objId = '" . $objId . "'"; } $res = Helper_Dao::getRows(array('dbName' => "Db_Star", 'tblName' => "log_operations", 'offset' => $offset, 'limit' => $num, 'whereSql' => $whereSql . " order by id desc ", 'debug' => 0)); if ($getNum) { #是否获得数量 $cnt = Helper_Dao::getCount(array('dbName' => "Db_Star", 'tblName' => "log_operations", 'whereSql' => $whereSql, 'debug' => 0)); return array('allNum' => $cnt, 'data' => $res); } return $res; }
<i class="halflings-icon white off"></i><a href="?c=Login&a=Logout" style="display:inline;color:#ffffff;padding-left:5px;">退出登录</a></li> </ul> </div> </div> </div> <!-- END HEADER --> <!-- BEGIN CONTAINER --> <div class="page-container row-fluid" id="page-container"> <!-- BEGIN SIDEBAR --> <div class="page-sidebar nav-collapse" id="page-sidebar"> <!-- BEGIN SIDEBAR MENU --> <ul class="page-sidebar-menu"> <!-- <li><div class="sidebar-toggler hidden-phone"></div></li> --> <?php $menuArr = ZOL_Config::get("Yun_AdminMenu"); if ($menuArr) { foreach ($menuArr as $name => $menu) { //权限判定 if (isset($menu["permission"])) { if (!in_array($adminType, $menu["permission"])) { continue; } } $cls = isset($menu['class']) ? $menu['class'] : ''; echo '<li class="sel ' . $cls . '"> <a href="javascript:;"> <img src="icons/' . $menu["icon"] . '" align="absmiddle" width="20" height="20" style="width:20px;vertical-align:middle;"/> <span class="title">' . $name . '</span><span class="arrow "></span></a> <ul class="sub-menu"> '; foreach ($menu['items'] as $k => $v) {
/** * 获得数据列表 */ public function doSendTable(ZOL_Request $input, ZOL_Response $output) { header("Pragma: no-cache"); header('Content-type: application/x-msexcel;charset=utf-8'); header("Content-Disposition: attachment; filename=商品数据_" . date('Y-m-d H:i:s') . ".xls"); $wArr = array(); #搜索字段 $whereSql = ""; $output->sername = $wArr['name'] = $input->get('name'); $output->sercode = $wArr['code'] = $input->get('code'); $output->sercateId = $wArr['cateId'] = $input->get('cateId'); if (!empty($wArr)) { foreach ($wArr as $k => $v) { if ($k == 'cateId' && $v) { $whereSql .= ' AND cateId =' . $v; } elseif ($k == 'code' && $v) { $whereSql .= ' AND code =\'' . $v . "'"; } else { if (gettype($v) == 'string') { $whereSql .= !empty($v) ? ' AND ' . $k . ' like binary "%' . $v . '%" ' : ''; } else { $whereSql .= !empty($v) ? ' AND ' . $k . '=' . $v : ''; } } } } $pageSize = 100000; $orderSql = "order by id desc"; $data = Helper_Dao::getList(array('dbName' => "Db_AndyouYun", 'tblName' => "product", 'cols' => "*", 'pageSize' => $pageSize, 'page' => 1, 'pageUrl' => $pageUrl, 'whereSql' => $whereSql, 'orderSql' => $orderSql, 'iswrite' => true, 'pageTpl' => 9)); if ($data) { $output->pageBar = $data['pageBar']; $output->allCnt = $data['allCnt']; $output->data = $data['data']; $output->pageUrl = $pageUrl; } $output->cateInfo = Helper_Product::getProductCatePairs(); //获得所有的种类 $output->proCtype = ZOL_Config::get("GLOBAL", "PRO_CTYPE"); $html = $output->fetchCol('ProductToExcel'); echo mb_convert_encoding($html, "utf-8", "gbk"); exit; }
<i class="halflings-icon white off"></i><a href="?c=Login&a=Logout" style="display:inline;color:#ffffff;padding-left:5px;">退出登录</a></li> </ul> </div> </div> </div> <!-- END HEADER --> <!-- BEGIN CONTAINER --> <div class="page-container row-fluid" id="page-container"> <!-- BEGIN SIDEBAR --> <div class="page-sidebar nav-collapse" id="page-sidebar"> <!-- BEGIN SIDEBAR MENU --> <ul class="page-sidebar-menu"> <!-- <li><div class="sidebar-toggler hidden-phone"></div></li> --> <?php $menuArr = ZOL_Config::get("Admin_Menu"); if ($menuArr) { foreach ($menuArr as $name => $menu) { //权限判定 if (isset($menu["permission"])) { if (!in_array($adminType, $menu["permission"])) { continue; } } $cls = isset($menu['class']) ? $menu['class'] : ''; echo '<li class="sel ' . $cls . '"> <a href="javascript:;"> <img src="icons/' . $menu["icon"] . '" align="absmiddle" width="20" height="20" style="width:20px;vertical-align:middle;"/> <span class="title">' . $name . '</span><span class="arrow "></span></a> <ul class="sub-menu"> '; foreach ($menu['items'] as $k => $v) {
/** * 下载文件 * */ public static function downFile($paramArr) { $options = array('filePath' => '', 'fileType' => '', 'fileName' => ''); if (is_array($paramArr)) { $options = array_merge($options, $paramArr); } extract($options); if (empty($filePath) || empty($fileType)) { return false; } if (is_file($filePath)) { $fileType = strtolower($fileType); $fileTypeConf = ZOL_Config::get('Star_FileType'); $fileTypeStr = !empty($fileTypeConf[$fileType]) ? $fileTypeConf[$fileType] : 'text/plain'; $fileName = $fileName ? $fileName : basename($filePath); header('Content-type: ' . $fileTypeStr); //输出的类型 header('Content-Disposition: attachment; filename="' . $fileName . '"'); //下载显示的名字,注意格式 readfile($filePath); } else { return false; } }
protected static function dir() { $dir = ZOL_Config::get('app.var') ? ZOL_Config::get('app.var') : ZOL_Config::get('default.var'); return self::$dir = $dir . '/cache'; }