本文整理汇总了PHP中Setting::get_setting_value方法的典型用法代码示例。如果您正苦于以下问题:PHP Setting::get_setting_value方法的具体用法?PHP Setting::get_setting_value怎么用?PHP Setting::get_setting_value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Setting
的用法示例。
在下文中一共展示了Setting::get_setting_value方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Pages
/**
*
* Enter description here ...
* @param unknown_type $params
*/
public function Pages($params = array())
{
//设置默认参数
$_defaults_params = array('allow_cache' => true, 'page' => isset($_GET['page']) ? intval($_GET['page']) : 1, 'pagesize' => 10);
$params = array_merge($_defaults_params, $params);
//有开启缓存功能,则从缓存中取数据, 如果有数据,则直接返回结果
if ($params['allow_cache'] && isset($this->cache)) {
$cache_key = 'collect.source.pages.' . serialize($params);
$_r = $this->cache->get($cache_key);
if ($_r && is_array($_r)) {
return $_r;
}
}
//添加条件
//$__addons = array('AND', 'u.game_union_status=:GState');
//$__params = array('GState'=>1);
//
$builds = array('select' => 'COUNT(`u`.`collect_source_id`) AS `COUNT`', 'from' => array('{{collect_source}}', 'u'));
if (isset($params['collect_source_status']) && !empty($params['collect_source_status'])) {
$builds['where'] = array('AND', '`collect_source_status`=:collect_source_status');
$sql_params[':collect_source_status'] = $params['collect_source_status'];
} else {
$builds['where'] = array('AND', '`collect_source_status`>:collect_source_status');
$sql_params[':collect_source_status'] = 0;
}
//
if (isset($params['collect_source_id']) && !empty($params['collect_source_id'])) {
$builds['where'][] = array('AND', 'u.`collect_source_id`=:collect_source_id');
$sql_params[':collect_source_id'] = $params['collect_source_id'];
}
//
if (isset($params['collect_source_name']) && !empty($params['collect_source_name'])) {
$builds['where'][] = array('LIKE', '`u`.`collect_source_name`', ':collect_source_name');
$sql_params[':collect_source_name'] = "%{$params['collect_source_name']}%";
}
//
//
if (isset($params['searchKey']) && $params['searchKey']) {
$builds['where'][] = array('AND', array('OR LIKE', '`g`.`collect_source_name`', ':searchKey'));
$sql_params[':searchKey'] = "%{$params['searchKey']}%";
}
//$command = $this->db->createCommand();
$sql = $this->buildQuery($builds);
//统计数量
$count = $this->db->queryScalar($sql, $sql_params);
//分页处理
$pages = new CPagination($count);
//设置分页大小
$pages->pageSize = $params['pagesize'];
if (isset($params['orderby']) && $params['orderby']) {
$builds['order'] = $params['orderby'];
} else {
$builds['order'] = array('u.collect_source_rank ASC', 'u.collect_source_id DESC');
}
$builds['select'] = '`collect_source_id`, `collect_source_name`, `collect_source_website`, `collect_source_remark`, `collect_source_rank`, `collect_source_status`, `collect_source_lasttime`, `collect_source_dateline`';
$pages->applyLimit($builds);
$sql = $this->buildQuery($builds);
$_r['pages'] = $pages;
$_r['rows'] = $this->db->queryAll($sql, $sql_params);
//有开启缓存,则把结果添加到缓存中
if ($params['allow_cache'] && isset($this->cache)) {
$cache_cache_time = Setting::get_setting_value('COLLECT_SOURCE_PAGES_CACHE_TIME');
$this->cache->set($_cache_key, json_encode($_r), $_cache_cache_time);
unset($cache_cache_time, $cache_key);
}
return $_r;
}
示例2: Pages
/**
*
* Enter description here ...
* @param unknown_type $params
*/
public static function Pages($params = array())
{
//设置默认参数
$_defaults_params = array('allow_cache' => true, 'page' => isset($_GET['page']) ? intval($_GET['page']) : 1, 'pagesize' => 10);
$params = array_merge($_defaults_params, $params);
//有开启缓存功能,则从缓存中取数据, 如果有数据,则直接返回结果
if ($params['allow_cache'] && isset(Yii::app()->cache)) {
$_cache_key = md5('ad.position.pages.' . serialize($params));
$_r = Yii::app()->cache->get($_cache_key);
if ($_r && is_array($_r)) {
return $_r;
}
}
$cmd = Yii::app()->db->createCommand();
$cmd->select('COUNT(gad.ad_data_id) AS COUNT')->from('{{ad_data}} gad');
//添加条件
//$__addons = array('AND', 'u.union_status=:GState');
//$__params = array('GState'=>1);
//
if (isset($params['ad_data_status']) && !empty($params['ad_data_status'])) {
$__addons = array('AND', 'gad.ad_data_status=:ad_data_status');
$__params = array(':ad_data_status' => $params['ad_data_status']);
} else {
$__addons = array('AND', 'gad.ad_data_status>:ad_data_status');
$__params = array(':ad_data_status' => 0);
}
if (isset($params['ad_position_id']) && !empty($params['ad_position_id'])) {
$__addons[] = array('AND', 'gad.ad_position_id=:ad_position_id');
$__params = array_merge($__params, array(':ad_position_id' => $params['ad_position_id']));
}
if (isset($params['search_key']) && !empty($params['search_key'])) {
$__addons[] = array('AND', 'gad.ad_data_subject LIKE :search_key');
$__params = array_merge($__params, array(':search_key' => "%{$params['search_key']}%"));
}
if (is_array($__addons) && is_array($__params)) {
$cmd->where($__addons, $__params);
}
//统计数量
$count = $cmd->queryScalar();
//分页处理
$pages = new CPagination($count);
//设置分页大小
$pages->pageSize = $params['pagesize'];
//清空前面执行过的SQL
$cmd->setText('');
if (isset($params['orderby']) && $params['orderby']) {
$cmd->order($params['orderby']);
} else {
$cmd->order(array('gad.ad_data_rank ASC', 'gad.ad_data_id DESC'));
}
$cmd->select('gad.ad_data_id, gad.ad_data_subject, gad.ad_data_type, gad.ad_data_link, gap.ad_position_name, gad.ad_data_rank, gad.ad_data_is_show,gad.ad_data_relative_id,gad.ad_position_id')->join("{{ad_position}} gap", "gad.ad_position_id=gap.ad_position_id")->limit($pages->getLimit())->offset($pages->getOffset());
$_r['pages'] = $pages;
$_r['rows'] = $cmd->queryAll();
//有开启缓存,则把结果添加到缓存中
if ($params['allow_cache'] && isset(Yii::app()->cache)) {
$_cache_cache_time = Setting::get_setting_value('AD_DATA_PAGES_CACHE_TIME');
Yii::app()->cache->add($_cache_key, json_encode($_r), $_cache_cache_time);
unset($_cache_cache_time, $_cache_key);
}
return $_r;
}
示例3: Pages
/**
*
* Enter description here ...
* @param unknown_type $params
*/
public function Pages($params = array())
{
//设置默认参数
$_defaults_params = array('allow_cache' => true, 'page' => isset($_GET['page']) ? intval($_GET['page']) : 1, 'pagesize' => 10);
$params = array_merge($_defaults_params, $params);
//有开启缓存功能,则从缓存中取数据, 如果有数据,则直接返回结果
if ($params['allow_cache'] && isset($this->cache)) {
$cacheKey = md5('collect.task.pages.' . serialize($params));
$ret = $this->cache->get($cacheKey);
if ($ret && is_array($ret)) {
return $ret;
}
}
//添加条件
$builds = array('select' => 'COUNT(DISTINCT t.collect_task_id) AS COUNT', 'from' => array('{{collect_task}}', 't'), 'join' => array(array('{{collect_template}}', 'tp', '`tp`.`collect_template_id`=`t`.`collect_template_id`'), array('{{collect_model}}', 'm', '`m`.`collect_model_id`=`tp`.`collect_model_id`'), array('{{collect_source}}', 's', '`s`.`collect_source_id`=`tp`.`collect_source_id`')));
if (isset($params['collect_task_status']) && !empty($params['collect_task_status'])) {
$builds['where'][] = array('AND', '`t`.`collect_task_status`=:collect_task_status');
$sql_params[':collect_task_status'] = $params['collect_task_status'];
} else {
$builds['where'][] = array('AND', '`t`.`collect_task_status`>:collect_task_status');
$sql_params[':collect_task_status'] = 0;
}
//
if (isset($params['collect_task_id']) && !empty($params['collect_task_id'])) {
$builds['where'][] = array('AND', '`t`.`collect_task_id`=:collect_task_id');
$sql_params[':collect_task_id'] = $params['collect_task_id'];
}
if (isset($params['collect_template_id']) && !empty($params['collect_template_id'])) {
$builds['where'][] = array('AND', 't.collect_template_id IN(:collect_template_id)');
$sql_params[':collect_template_id'] = $params['collect_template_id'];
}
if ($params['collect_task_name']) {
$builds['where'][] = array('AND', array('OR LIKE', '`t`.`collect_task_name`', ':collect_task_name'));
$sql_params[':collect_task_name'] = "%{$params['collect_task_name']}%";
}
//
if (isset($params['searchKey']) && $params['searchKey']) {
$builds['where'][] = array('AND', array('OR LIKE', 't.collect_task_name', ":searchKey"));
$sql_params[':searchKey'] = "%{$params['searchKey']}%";
}
$sql = $this->buildQuery($builds);
//统计数量
$count = $this->db->queryScalar($sql, $sql_params);
//分页处理
$pages = new CPagination($count);
//设置分页大小
$pages->pageSize = $params['pagesize'];
if (isset($params['orderby']) && $params['orderby']) {
$builds['order'] = $params['orderby'];
} else {
$builds['order'] = array('`t`.`collect_task_rank` ASC', '`t`.`collect_task_id` DESC');
}
$builds['select'] = 't.collect_task_id, t.collect_task_name, tp.collect_template_name, tp.collect_model_id, s.collect_source_name, tp.collect_source_id, m.collect_model_name, t.collect_template_id, t.collect_task_rank, t.collect_task_lastcollecttime, t.collect_task_lasttime, t.collect_task_dateline';
$pages->applyLimit($builds);
$sql = $this->buildQuery($builds);
$ret['pages'] = $pages;
$ret['rows'] = $this->db->queryAll($sql, $sql_params);
//有开启缓存,则把结果添加到缓存中
if ($params['allow_cache'] && isset($this->cache)) {
$cacheTimeout = Setting::get_setting_value('COLLECT_TEMPLATE_PAGES_CACHE_TIME');
$this->cache->set($cacheKey, json_encode($ret), $cacheTimeout);
unset($cacheTimeout, $cacheKey);
}
return $ret;
}
示例4: Pages
/**
*
* Enter description here ...
* @param unknown_type $params
*/
public static function Pages($params = array())
{
//设置默认参数
$_defaults_params = array('allow_cache' => true, 'page' => isset($_GET['page']) ? intval($_GET['page']) : 1, 'pagesize' => 10);
$params = array_merge($_defaults_params, $params);
$cmd = Yii::app()->db->createCommand();
$cmd->select('COUNT(u.collect_list_id) AS COUNT')->from('{{collect_list}} u')->join('{{collect_task}} ct', 'u.collect_task_id=ct.collect_task_id');
if (intval($params['collect_task_id'])) {
$__addons = array('AND', 'u.collect_task_id=:collect_task_id');
$__params = array(':collect_task_id' => $params['collect_task_id']);
} else {
$__addons = array('AND', 'u.collect_task_id!=:collect_task_id');
$__params = array(':collect_task_id' => 0);
}
if ($params['collect_list_check'] !== "") {
$__addons[] = array('AND', 'u.collect_list_check=:collect_list_check');
$__params = array_merge($__params, array(':collect_list_check' => $params['collect_list_check']));
}
if ($params['collect_list_day'] && is_array($params['collect_list_day'])) {
$__addons[] = array('AND', 'u.collect_list_day BETWEEN "' . $params['collect_list_day'][0] . '" AND "' . $params['collect_list_day'][1] . '"');
} elseif ($params['collect_list_day']) {
$__addons[] = array('AND', 'u.collect_list_day=:collect_list_day');
$__params = array_merge($__params, array(':collect_list_day' => $params['collect_list_day']));
}
if ($params['collect_list_title']) {
$__addons[] = array('AND', array('OR LIKE', 'u.collect_list_title', "%{$params[collect_list_title]}%"));
}
if (is_array($__addons) && is_array($__params)) {
$cmd->where($__addons, $__params);
}
//统计数量
$count = $cmd->queryScalar();
//分页处理
$pages = new CPagination($count);
//设置分页大小
$pages->pageSize = $params['pagesize'];
//清空前面执行过的SQL
$cmd->setText('');
if (isset($params['orderby']) && $params['orderby']) {
$cmd->order($params['orderby']);
} else {
$cmd->order(array('u.collect_list_day DESC'));
}
$cmd->select('u.*,ct.collect_task_name')->limit($pages->getLimit())->offset($pages->getOffset());
$_r['pages'] = $pages;
$_r['rows'] = $cmd->queryAll();
//有开启缓存,则把结果添加到缓存中
if ($params['allow_cache'] && isset(Yii::app()->cache)) {
$_cache_cache_time = Setting::get_setting_value('COLLECT_MODEL_PAGES_CACHE_TIME');
Yii::app()->cache->add($_cache_key, json_encode($_r), $_cache_cache_time);
unset($_cache_cache_time, $_cache_key);
}
return $_r;
}