/** * @brief 构造函数 * @param string $ctrlId 控制器ID标识符 * @param string $module 控制器所包含的模块 */ public function __construct($module, $controllerId) { $this->module = $module; $this->ctrlId = $controllerId; //初始化theme方案 if (isset($this->module->config['theme'])) { //根据不同的客户端进行智能选择 if (is_array($this->module->config['theme'])) { $client = IClient::getDevice(); $this->theme = isset($this->module->config['theme'][$client]) ? $this->module->config['theme'][$client] : current($this->module->config['theme']); } else { $this->theme = $this->module->config['theme']; } } //初始化skin方案 if (isset($this->module->config['skin'])) { //根据不同的客户端进行智能选择 if (is_array($this->module->config['skin'])) { $client = IClient::getDevice(); $this->skin = isset($this->module->config['skin'][$client]) ? $this->module->config['skin'][$client] : current($this->module->config['skin']); } else { $this->skin = $this->module->config['skin']; } } //初始化lang方案 $this->lang = $this->module->language; //修正runtime配置 $this->module->runtimePath = $this->module->getRuntimePath() . $this->theme . '/'; $this->module->webRunPath = $this->module->getWebRunPath() . $this->theme . '/'; }
/** * @brief theme和skin进行选择 */ public static function onCreateController() { $controller = func_num_args() > 0 ? func_get_arg(0) : IWeb::$app->controller; //判断是否为后台管理控制器 if (in_array($controller->getId(), self::$syscontroller)) { defined("IWEB_SCENE") ? "" : define("IWEB_SCENE", self::SCENE_SYSDEFAULT); $controller->theme = self::$sysTheme; $controller->skin = self::$sysSkin; } elseif (in_array($controller->getId(), self::$sellercontroller)) { defined("IWEB_SCENE") ? "" : define("IWEB_SCENE", self::SCENE_SYSSELLER); $controller->theme = self::$sysSellerTheme; $controller->skin = self::$sysSellerSkin; } else { defined("IWEB_SCENE") ? "" : define("IWEB_SCENE", self::SCENE_SITE); /** * 对于theme和skin的判断流程 * 1,直接从URL中获取是否已经设定了方案__theme,__skin * 2,获取cookie中的方案名称 * 3,读取config配置中的默认方案 */ $urlTheme = IReq::get('__theme'); $urlSkin = IReq::get('__skin'); if ($urlTheme && $urlSkin && preg_match('|^\\w+$|', $urlTheme) && preg_match('|^\\w+$|', $urlSkin)) { ISafe::set('__theme', $controller->theme = $urlTheme); ISafe::set('__skin', $controller->skin = $urlSkin); } elseif (ISafe::get('__theme') && ISafe::get('__skin')) { $controller->theme = ISafe::get('__theme'); $controller->skin = ISafe::get('__skin'); } else { if (isset(IWeb::$app->config['theme'])) { //根据不同的客户端进行智能选择 if (is_array(IWeb::$app->config['theme'])) { $client = IClient::getDevice(); $controller->theme = isset(IWeb::$app->config['theme'][$client]) ? IWeb::$app->config['theme'][$client] : current(IWeb::$app->config['theme']); } else { $controller->theme = IWeb::$app->config['theme']; } } if (isset(IWeb::$app->config['skin'])) { //根据不同的客户端进行智能选择 if (is_array(IWeb::$app->config['skin'])) { $client = IClient::getDevice(); $controller->skin = isset(IWeb::$app->config['skin'][$client]) ? IWeb::$app->config['skin'][$client] : current(IWeb::$app->config['skin']); } else { $controller->skin = IWeb::$app->config['skin']; } } } } //修正runtime配置 IWeb::$app->runtimePath = IWeb::$app->getRuntimePath() . $controller->theme . '/'; IWeb::$app->webRunPath = IWeb::$app->getWebRunPath() . $controller->theme . '/'; }
public function getPaymentListByOnline() { $where = " type = 1 and status = 0 and class_name not in ('balance','offline') "; switch (IClient::getDevice()) { //移动支付 case IClient::MOBILE: $where .= ' and client_type in(2,3) '; //如果不是微信客户端,去掉微信专用支付 if (IClient::isWechat() == false) { $where .= " and class_name != 'wap_wechat'"; } break; //pc支付 //pc支付 case IClient::PC: $where .= ' and client_type in(1,3) '; break; } $paymentDB = new IModel('payment'); return $paymentDB->query($where); }