当前位置: 首页>>代码示例>>PHP>>正文


PHP read_static_cache函数代码示例

本文整理汇总了PHP中read_static_cache函数的典型用法代码示例。如果您正苦于以下问题:PHP read_static_cache函数的具体用法?PHP read_static_cache怎么用?PHP read_static_cache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了read_static_cache函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: is_ban_ip

 /**
  * 是否在ip黑名单
  * @param string $ip
  * @return boolean
  */
 public function is_ban_ip($ip)
 {
     $data = read_static_cache('website_config');
     if (empty($data)) {
         return false;
     } else {
         return strpos($data['ip_blacklist'], $ip) !== false ? true : false;
     }
 }
开发者ID:Bingle-labake,项目名称:coollive.com.cn,代码行数:14,代码来源:member_control_model.php

示例2: __construct

 function __construct()
 {
     $this->CI =& get_instance();
     //变量可以在这里定义,或者来自配置文件,也可以去数据
     $smtp = read_static_cache("smtp_config");
     $website = read_static_cache("website_config");
     $upload = read_static_cache("upload_config");
     $this->CI->load->model("sk_admin/systemconfig_model");
     if (empty($smtp)) {
         $where = array("app_name" => "smtp");
         $smtp_list = $this->CI->systemconfig_model->getAll($where);
         $smtp = array();
         if ($smtp_list && count($smtp_list) > 0) {
             foreach ($smtp_list as $k => $v) {
                 $smtp[$v['paras']] = $v['value'];
             }
         }
         if (!empty($smtp)) {
             write_static_cache("smtp_config", $smtp);
         }
     }
     if (empty($website)) {
         $where = array("app_name" => "website");
         $website_list = $this->CI->systemconfig_model->getAll($where);
         $website = array();
         if ($website_list && count($website_list) > 0) {
             foreach ($website_list as $k => $v) {
                 $website[$v['paras']] = $v['value'];
             }
         }
         if (!empty($website)) {
             write_static_cache("website_config", $website);
         }
     }
     if (empty($upload)) {
         $where = array("app_name" => "upload");
         $upload_list = $this->CI->systemconfig_model->getAll($where);
         $upload = array();
         if ($upload_list && count($upload_list) > 0) {
             foreach ($upload_list as $k => $v) {
                 $upload[$v['paras']] = $v['value'];
             }
         }
         if (!empty($upload)) {
             write_static_cache("upload_config", $upload);
         }
     }
     $this->variable['smtp'] = $smtp;
     $this->variable['website'] = $website;
     $this->variable['upload'] = $upload;
     $this->CI->load->vars($this->variable);
 }
开发者ID:Bingle-labake,项目名称:coollive.com.cn,代码行数:52,代码来源:vars_lib.php

示例3: __construct

 /**
  * 构造函数
  *
  * @access public
  * @return mix
  */
 function __construct()
 {
     parent::__construct();
     $this->model_name = "";
     $this->model_name_config = "sk_credit_config";
     // 金币配置
     $this->model_name_rule = "sk_credit_rule";
     // 金币规则
     $this->model_name_log = "sk_credit_log";
     // 金币日志
     $credit_config = read_static_cache($this->model_name_config);
     $this->config_group = $this->config->item("credit_group");
 }
开发者ID:Bingle-labake,项目名称:coollive.com.cn,代码行数:19,代码来源:glod_model.php

示例4: get_parent_grade

/**
 * 取得最近的上级分类的grade值
 *
 * @access  public
 * @param   int     $cat_id    //当前的cat_id
 *
 * @return int
 */
function get_parent_grade($cat_id)
{
    static $res = NULL;
    if ($res === NULL) {
        $data = read_static_cache('cat_parent_grade_supplier' . $_GET['suppId']);
        if ($data === false) {
            $sql = "SELECT parent_id, cat_id, grade " . " FROM " . $GLOBALS['ecs']->table('supplier_category') . "WHERE supplier_id=" . $_GET['suppId'];
            $res = $GLOBALS['db']->getAll($sql);
            write_static_cache('cat_parent_grade_supplier' . $_GET['suppId'], $res);
        } else {
            $res = $data;
        }
    }
    if (!$res) {
        return 0;
    }
    $parent_arr = array();
    $grade_arr = array();
    foreach ($res as $val) {
        $parent_arr[$val['cat_id']] = $val['parent_id'];
        $grade_arr[$val['cat_id']] = $val['grade'];
    }
    while ($parent_arr[$cat_id] > 0 && $grade_arr[$cat_id] == 0) {
        $cat_id = $parent_arr[$cat_id];
    }
    return $grade_arr[$cat_id];
}
开发者ID:seanguo166,项目名称:yinoos,代码行数:35,代码来源:supplier_category.php

示例5: transport

        $t = new transport();
        $api_comment = $t->request('http://api.ecshop.com/checkver.php', $apiget);
        $api_str = $api_comment["body"];
        //echo $api_str;
        $f = ROOT_PATH . 'data/config.php';
        file_put_contents($f, str_replace("'API_TIME', '" . API_TIME . "'", "'API_TIME', '" . date('d-m-Y H:i:s', time()) . "'", file_get_contents($f)));
        write_static_cache('api_str', $api_str);
    } else {
        echo $data;
    }
} elseif ($_REQUEST['act'] == 'menu_api') {
    if (!admin_priv('all', '', false)) {
        exit;
    }
    require_once ROOT_PATH . '/includes/lib_base.php';
    $data = read_static_cache('menu_api');
    if ($data === false || isset($data['api_time']) && $data['api_time'] < date('dmY')) {
        include_once ROOT_PATH . 'includes/cls_transport.php';
        $ecs_lang = $_CFG['lang'];
        $ecs_charset = strtoupper(EC_CHARSET);
        $ecs_version = VERSION;
        $apiget = "ver= {$ecs_version} &ecs_lang= {$ecs_lang} &charset= {$ecs_charset} ";
        $t = new transport();
        $api_comment = $t->request('http://cloud.ecshop.com/menu_api.php', $apiget);
        $api_str = $api_comment["body"];
        if (!empty($api_str)) {
            include_once ROOT_PATH . 'includes/cls_json.php';
            $json = new JSON();
            $api_arr = @$json->decode($api_str, 1);
            if (!empty($api_arr) && $api_arr['error'] == 0 && md5($api_arr['content']) == $api_arr['hash']) {
                $api_arr['content'] = urldecode($api_arr['content']);
开发者ID:duynhan07,项目名称:ecshop-vietnam,代码行数:31,代码来源:index.php

示例6: load_config

/**
 * 载入配置信息
 *
 * @access  public
 * @return  array
 */
function load_config()
{
    $arr = array();
    $data = read_static_cache('shop_config');
    if ($data === false) {
        $sql = 'SELECT code, value FROM ' . $GLOBALS['ecs']->table('shop_config') . ' WHERE parent_id > 0';
        $res = $GLOBALS['db']->getAll($sql);
        foreach ($res as $row) {
            $arr[$row['code']] = $row['value'];
        }
        /* 对数值型设置处理 */
        $arr['watermark_alpha'] = intval($arr['watermark_alpha']);
        $arr['market_price_rate'] = floatval($arr['market_price_rate']);
        $arr['integral_scale'] = floatval($arr['integral_scale']);
        //$arr['integral_percent']     = floatval($arr['integral_percent']);
        $arr['cache_time'] = intval($arr['cache_time']);
        $arr['thumb_width'] = intval($arr['thumb_width']);
        $arr['thumb_height'] = intval($arr['thumb_height']);
        $arr['image_width'] = intval($arr['image_width']);
        $arr['image_height'] = intval($arr['image_height']);
        $arr['best_number'] = !empty($arr['best_number']) && intval($arr['best_number']) > 0 ? intval($arr['best_number']) : 3;
        $arr['new_number'] = !empty($arr['new_number']) && intval($arr['new_number']) > 0 ? intval($arr['new_number']) : 3;
        $arr['hot_number'] = !empty($arr['hot_number']) && intval($arr['hot_number']) > 0 ? intval($arr['hot_number']) : 3;
        $arr['promote_number'] = !empty($arr['promote_number']) && intval($arr['promote_number']) > 0 ? intval($arr['promote_number']) : 3;
        $arr['top_number'] = intval($arr['top_number']) > 0 ? intval($arr['top_number']) : 10;
        $arr['history_number'] = intval($arr['history_number']) > 0 ? intval($arr['history_number']) : 5;
        $arr['comments_number'] = intval($arr['comments_number']) > 0 ? intval($arr['comments_number']) : 5;
        $arr['article_number'] = intval($arr['article_number']) > 0 ? intval($arr['article_number']) : 5;
        $arr['page_size'] = intval($arr['page_size']) > 0 ? intval($arr['page_size']) : 10;
        $arr['bought_goods'] = intval($arr['bought_goods']);
        $arr['goods_name_length'] = intval($arr['goods_name_length']);
        $arr['top10_time'] = intval($arr['top10_time']);
        $arr['goods_gallery_number'] = intval($arr['goods_gallery_number']) ? intval($arr['goods_gallery_number']) : 5;
        $arr['no_picture'] = !empty($arr['no_picture']) ? str_replace('../', './', $arr['no_picture']) : 'images/no_picture.gif';
        // 修改默认商品图片的路径
        $arr['qq'] = !empty($arr['qq']) ? $arr['qq'] : '';
        $arr['ww'] = !empty($arr['ww']) ? $arr['ww'] : '';
        $arr['default_storage'] = isset($arr['default_storage']) ? intval($arr['default_storage']) : 1;
        $arr['min_goods_amount'] = isset($arr['min_goods_amount']) ? floatval($arr['min_goods_amount']) : 0;
        $arr['one_step_buy'] = empty($arr['one_step_buy']) ? 0 : 1;
        $arr['invoice_type'] = empty($arr['invoice_type']) ? array('type' => array(), 'rate' => array()) : unserialize($arr['invoice_type']);
        $arr['show_order_type'] = isset($arr['show_order_type']) ? $arr['show_order_type'] : 0;
        // 显示方式默认为列表方式
        $arr['help_open'] = isset($arr['help_open']) ? $arr['help_open'] : 1;
        // 显示方式默认为列表方式
        if (!isset($GLOBALS['_CFG']['ecs_version'])) {
            /* 如果没有版本号则默认为2.0.5 */
            $GLOBALS['_CFG']['ecs_version'] = 'v2.0.5';
        }
        //限定语言项
        $lang_array = array('zh_cn', 'zh_tw', 'en_us');
        if (empty($arr['lang']) || !in_array($arr['lang'], $lang_array)) {
            $arr['lang'] = 'zh_cn';
            // 默认语言为简体中文
        }
        if (empty($arr['integrate_code'])) {
            $arr['integrate_code'] = 'ecshop';
            // 默认的会员整合插件为 ecshop
        }
        write_static_cache('shop_config', $arr);
    } else {
        $arr = $data;
    }
    return $arr;
}
开发者ID:jiusanzhou,项目名称:ecapi,代码行数:71,代码来源:lib_common.php

示例7: digui

/**
*@param int $parent_id 父id
*@return array $arr  有层级的数组
*/
function digui($arrayinfo = array(), $parent_id = 0)
{
    global $db, $ecs;
    $data = read_static_cache('city_tree_68');
    if ($data !== false && is_array($data)) {
        return $data;
    }
    if (empty($arrayinfo)) {
        $sql = "select * from " . $ecs->table('region');
        $arrayinfo = $db->getAll($sql);
    }
    $arr = array();
    foreach ($arrayinfo as $key => $val) {
        if ($val['parent_id'] == $parent_id) {
            $region_id = $val['region_id'];
            $arr[$region_id] = array('id' => $region_id, 'text' => $val['region_name'], 'level' => $val['region_type'], 'parent_id' => $val['parent_id']);
            unset($arrayinfo[$key]);
            $arr[$region_id]['child'] = digui($arrayinfo, $region_id);
            if (empty($arr[$region_id]['child'])) {
                $arr[$region_id]['child'] = null;
            }
        }
    }
    write_static_cache('city_tree_68', $arr);
    return $arr;
}
开发者ID:moonlight-wang,项目名称:feilun,代码行数:30,代码来源:lib_common.php

示例8: get_naviHtml_by_position_20141107

function get_naviHtml_by_position_20141107($curr_app_name = "", $posi = 'index_top')
{
    $home_navi = read_static_cache("home_navi");
    $navi_list = isset($home_navi[$posi]) ? $home_navi[$posi] : array();
    if (!empty($navi_list)) {
        $html = '';
        foreach ($navi_list as $navi) {
            $class = '';
            if (!empty($navi['class_name'])) {
                $class = ' class="' . $navi['class_name'] . '"';
            }
            $target = '';
            if (!empty($navi['target'])) {
                $target = ' target="_' . $navi['target'] . '"';
            }
            if ($curr_app_name == $navi['app_name']) {
                $html .= '<a href="' . $navi['href'] . '" ' . $target . '>' . $navi['name'] . '</a>';
            } else {
                $html .= '<a href="' . $navi['href'] . '" ' . $target . '>' . $navi['name'] . '</a>';
            }
        }
        return $html;
    }
    return '';
}
开发者ID:Bingle-labake,项目名称:coollive.com.cn,代码行数:25,代码来源:common_helper.php

示例9: get_recommend_goods

/**
 * 获得推荐商品
 *
 * @access  public
 * @param   string      $type       推荐类型,可以是 best, new, hot
 * @return  array
 */
function get_recommend_goods($type = '', $cats = '')
{
    if (!in_array($type, array('best', 'new', 'hot'))) {
        return array();
    }
    //取不同推荐对应的商品
    static $type_goods = array();
    if (empty($type_goods[$type])) {
        //初始化数据
        $type_goods['best'] = array();
        $type_goods['new'] = array();
        $type_goods['hot'] = array();
        $data = read_static_cache('recommend_goods');
        if ($data === false) {
            $sql = 'SELECT g.goods_id, g.is_best, g.is_new, g.is_hot, g.is_promote, b.brand_name,g.sort_order ' . ' FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' . ' LEFT JOIN ' . $GLOBALS['ecs']->table('brand') . ' AS b ON b.brand_id = g.brand_id ' . ' WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 AND (g.is_best = 1 OR g.is_new =1 OR g.is_hot = 1)' . ' ORDER BY g.sort_order, g.last_update DESC';
            $goods_res = $GLOBALS['db']->getAll($sql);
            //定义推荐,最新,热门,促销商品
            $goods_data['best'] = array();
            $goods_data['new'] = array();
            $goods_data['hot'] = array();
            $goods_data['brand'] = array();
            if (!empty($goods_res)) {
                foreach ($goods_res as $data) {
                    if ($data['is_best'] == 1) {
                        $goods_data['best'][] = array('goods_id' => $data['goods_id'], 'sort_order' => $data['sort_order']);
                    }
                    if ($data['is_new'] == 1) {
                        $goods_data['new'][] = array('goods_id' => $data['goods_id'], 'sort_order' => $data['sort_order']);
                    }
                    if ($data['is_hot'] == 1) {
                        $goods_data['hot'][] = array('goods_id' => $data['goods_id'], 'sort_order' => $data['sort_order']);
                    }
                    if ($data['brand_name'] != '') {
                        $goods_data['brand'][$data['goods_id']] = $data['brand_name'];
                    }
                }
            }
            write_static_cache('recommend_goods', $goods_data);
        } else {
            $goods_data = $data;
        }
        $time = gmtime();
        $order_type = $GLOBALS['_CFG']['recommend_order'];
        //按推荐数量及排序取每一项推荐显示的商品 order_type可以根据后台设定进行各种条件显示
        static $type_array = array();
        $type2lib = array('best' => 'recommend_best', 'new' => 'recommend_new', 'hot' => 'recommend_hot');
        if (empty($type_array)) {
            foreach ($type2lib as $key => $data) {
                if (!empty($goods_data[$key])) {
                    $num = get_library_number($data);
                    $data_count = count($goods_data[$key]);
                    $num = $data_count > $num ? $num : $data_count;
                    if ($order_type == 0) {
                        //usort($goods_data[$key], 'goods_sort');
                        $rand_key = array_slice($goods_data[$key], 0, $num);
                        foreach ($rand_key as $key_data) {
                            $type_array[$key][] = $key_data['goods_id'];
                        }
                    } else {
                        $rand_key = array_rand($goods_data[$key], $num);
                        if ($num == 1) {
                            $type_array[$key][] = $goods_data[$key][$rand_key]['goods_id'];
                        } else {
                            foreach ($rand_key as $key_data) {
                                $type_array[$key][] = $goods_data[$key][$key_data]['goods_id'];
                            }
                        }
                    }
                } else {
                    $type_array[$key] = array();
                }
            }
        }
        //取出所有符合条件的商品数据,并将结果存入对应的推荐类型数组中
        $sql = 'SELECT g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.shop_price AS org_price, g.promote_price, ' . "IFNULL(mp.user_price, g.shop_price * '{$_SESSION['discount']}') AS shop_price, " . "promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb, g.goods_img, RAND() AS rnd " . 'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' . "LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp " . "ON mp.goods_id = g.goods_id AND mp.user_rank = '{$_SESSION['user_rank']}' ";
        $type_merge = array_merge($type_array['new'], $type_array['best'], $type_array['hot']);
        $type_merge = array_unique($type_merge);
        $sql .= ' WHERE g.goods_id ' . db_create_in($type_merge);
        $sql .= ' ORDER BY g.sort_order, g.last_update DESC';
        $result = $GLOBALS['db']->getAll($sql);
        foreach ($result as $idx => $row) {
            if ($row['promote_price'] > 0) {
                $promote_price = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']);
                $goods[$idx]['promote_price'] = $promote_price > 0 ? price_format($promote_price) : '';
            } else {
                $goods[$idx]['promote_price'] = '';
            }
            $goods[$idx]['id'] = $row['goods_id'];
            $goods[$idx]['name'] = $row['goods_name'];
            $goods[$idx]['brief'] = $row['goods_brief'];
            $goods[$idx]['brand_name'] = isset($goods_data['brand'][$row['goods_id']]) ? $goods_data['brand'][$row['goods_id']] : '';
            $goods[$idx]['goods_style_name'] = add_style($row['goods_name'], $row['goods_name_style']);
            $goods[$idx]['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];
//.........这里部分代码省略.........
开发者ID:shaoslu,项目名称:jumei,代码行数:101,代码来源:lib_goods.php

示例10: cat_list_host_category

/**
 * ccx 2015-03-17 获取主站的商品分类 start 
 * 获得指定分类下的子分类的数组
 *
 * @access  public
 * @param   int     $cat_id     分类的ID
 * @param   int     $selected   当前选中分类的ID
 * @param   boolean $re_type    返回的类型: 值为真时返回下拉列表,否则返回数组
 * @param   int     $level      限定返回的级数。为0时返回所有级数
 * @param   int     $is_show_all 如果为true显示所有分类,如果为false隐藏不可见分类。
 * @return  mix
 */
function cat_list_host_category($cat_id = 0, $selected = 0, $re_type = true, $level = 0, $is_show_all = true)
{
    static $res = NULL;
    $where = "WHERE c.host_cat = 1 ";
    if ($res === NULL) {
        $data = read_static_cache('cat_pid_releate');
        $data = false;
        if ($data === false) {
            $sql = "SELECT c.host_cat,c.agency_cat,c.cat_id, c.cat_name, c.measure_unit, c.parent_id, c.is_show," . "c.show_in_nav, c.grade, c.sort_order, COUNT(s.cat_id) AS has_children " . 'FROM ' . $GLOBALS['ecs']->table('category') . " AS c " . "LEFT JOIN " . $GLOBALS['ecs']->table('category') . " AS s ON s.parent_id=c.cat_id " . " {$where} GROUP BY c.cat_id " . 'ORDER BY c.parent_id, c.sort_order ASC';
            $res = $GLOBALS['db']->getAll($sql);
            $sql = "SELECT cat_id, COUNT(*) AS goods_num " . " FROM " . $GLOBALS['ecs']->table('goods') . " WHERE is_delete = 0 AND is_on_sale = 1 " . " GROUP BY cat_id";
            $res2 = $GLOBALS['db']->getAll($sql);
            $sql = "SELECT gc.cat_id, COUNT(*) AS goods_num " . " FROM " . $GLOBALS['ecs']->table('goods_cat') . " AS gc , " . $GLOBALS['ecs']->table('goods') . " AS g " . " WHERE g.goods_id = gc.goods_id AND g.is_delete = 0 AND g.is_on_sale = 1 " . " GROUP BY gc.cat_id";
            $res3 = $GLOBALS['db']->getAll($sql);
            $newres = array();
            foreach ($res2 as $k => $v) {
                $newres[$v['cat_id']] = $v['goods_num'];
                foreach ($res3 as $ks => $vs) {
                    if ($v['cat_id'] == $vs['cat_id']) {
                        $newres[$v['cat_id']] = $v['goods_num'] + $vs['goods_num'];
                    }
                }
            }
            foreach ($res as $k => $v) {
                $res[$k]['goods_num'] = !empty($newres[$v['cat_id']]) ? $newres[$v['cat_id']] : 0;
                if (admin_agency_id()) {
                    $res[$k]['agency_state'] = strpos($v['agency_cat'], ',' . admin_agency_id() . ',') !== false ? 1 : 0;
                    $sql = "select cat_id from " . $GLOBALS['ecs']->table('category') . " where host_cat = " . $v['cat_id'] . " AND agency_cat = '," . admin_agency_id() . ",'";
                    $is_lead = $GLOBALS['db']->GetOne($sql);
                    if ($is_lead > 0) {
                        $res[$k]['is_lead'] = 1;
                        //该分类被引用了
                    } else {
                        $res[$k]['is_lead'] = 0;
                        //该分类未被引用
                    }
                }
            }
            //如果数组过大,不采用静态缓存方式
            if (count($res) <= 1000) {
                //write_static_cache('cat_pid_releate', $res);
            }
        } else {
            $res = $data;
        }
    }
    if (empty($res) == true) {
        return $re_type ? '' : array();
    }
    $options = cat_options($cat_id, $res);
    // 获得指定分类下的子分类的数组
    $children_level = 99999;
    //大于这个分类的将被删除
    if ($is_show_all == false) {
        foreach ($options as $key => $val) {
            if ($val['level'] > $children_level) {
                unset($options[$key]);
            } else {
                if ($val['is_show'] == 0) {
                    unset($options[$key]);
                    if ($children_level > $val['level']) {
                        $children_level = $val['level'];
                        //标记一下,这样子分类也能删除
                    }
                } else {
                    $children_level = 99999;
                    //恢复初始值
                }
            }
        }
    }
    /* 截取到指定的缩减级别 */
    if ($level > 0) {
        if ($cat_id == 0) {
            $end_level = $level;
        } else {
            $first_item = reset($options);
            // 获取第一个元素
            $end_level = $first_item['level'] + $level;
        }
        /* 保留level小于end_level的部分 */
        foreach ($options as $key => $val) {
            if ($val['level'] >= $end_level) {
                unset($options[$key]);
            }
        }
    }
    if ($re_type == true) {
//.........这里部分代码省略.........
开发者ID:dlpc,项目名称:ecshop,代码行数:101,代码来源:lib_common.php

示例11: intval

    $city_id = $_POST['city_id'] ? intval($_POST['city_id']) : 0;
    $sql_url = "SELECT agency_url FROM " . $ecs->table('agency_url') . 'WHERE region_id =' . $city_id;
    $agency_url = $db->getOne($sql_url);
    //header("Location:http://".$agency_url);
    $result_url = array();
    $result_url['url'] = $agency_url;
    die($json->encode($result_url));
} elseif ($_POST['act'] == 'word_search') {
    $keyword = !empty($_POST['keyword']) ? $_POST['keyword'] : '';
    $sql = "SELECT region_id,region_name,pinyin FROM " . $ecs->table('region') . " WHERE region_name LIKE '{$keyword}%' OR pinyin LIKE '{$keyword}%'";
    $rows = $db->getAll($sql);
    //dump($rows);
    die($json->encode($rows));
} elseif ($_POST['act'] == 'capital_search') {
    #读取缓存
    $rows = read_static_cache('region');
    if ($rows === false) {
        $sql = "SELECT region_id,region_name,capital FROM " . $ecs->table('region') . " WHERE region_type = 2 ORDER BY capital ASC";
        $rows = array();
        $rows = $db->getAll($sql);
        #写入缓存
        write_static_cache('region', $rows);
    }
    /* 对数据进行组装 start */
    $arr = array();
    foreach ($rows as $key => $value) {
        $arr[$value['capital']][] = $value;
    }
    $html = '';
    foreach ($arr as $k => $v) {
        $city = '';
开发者ID:dlpc,项目名称:ecshop,代码行数:31,代码来源:region.php

示例12: digui

/**
*@param int $parent_id 父id
*@return array $arr  有层级的数组
*/
function digui($arrayinfo = array(), $parent_id = 0)
{
    global $db, $ecs;
    $data = read_static_cache('city_tree_68');
    //if($data !== false && is_array($data)){
    //	return $data;
    //}
    $select_region = create_ever_sql();
    if (count($select_region) > 0) {
        $where = " where region_id not in (" . implode(',', $select_region) . ")";
    } else {
        $where = '';
    }
    $sql = "select * from " . $ecs->table('region') . $where;
    $arrayinfo = $db->getAll($sql);
    $arr = array();
    $arr = sss($arrayinfo, 0);
    write_static_cache('city_tree_68', $arr);
    return $arr;
}
开发者ID:moonlight-wang,项目名称:feilun,代码行数:24,代码来源:lib_common.php

示例13: load_config

 /**
  * 载入配置信息
  * @access  public
  * @return  array
  */
 public function load_config()
 {
     $data = read_static_cache('touch_shop_config');
     if ($data === false) {
         $sql = 'SELECT code, value FROM ' . $this->pre . 'touch_shop_config WHERE parent_id > 0';
         $res = $this->query($sql);
         $arr1 = array();
         foreach ($res as $row) {
             $arr1[$row['code']] = $row['value'];
         }
         $sql = 'SELECT code, value FROM ' . $this->pre . 'shop_config WHERE parent_id > 0';
         $res = $this->query($sql);
         $arr2 = array();
         foreach ($res as $row) {
             $arr2[$row['code']] = $row['value'];
         }
         $arr = array_merge($arr2, $arr1);
         /* 对数值型设置处理 */
         $arr['watermark_alpha'] = intval($arr['watermark_alpha']);
         $arr['market_price_rate'] = floatval($arr['market_price_rate']);
         $arr['integral_scale'] = floatval($arr['integral_scale']);
         //$arr['integral_percent']     = floatval($arr['integral_percent']);
         $arr['cache_time'] = intval($arr['cache_time']);
         $arr['thumb_width'] = intval($arr['thumb_width']);
         $arr['thumb_height'] = intval($arr['thumb_height']);
         $arr['image_width'] = intval($arr['image_width']);
         $arr['image_height'] = intval($arr['image_height']);
         $arr['best_number'] = !empty($arr['best_number']) && intval($arr['best_number']) > 0 ? intval($arr['best_number']) : 3;
         $arr['new_number'] = !empty($arr['new_number']) && intval($arr['new_number']) > 0 ? intval($arr['new_number']) : 3;
         $arr['hot_number'] = !empty($arr['hot_number']) && intval($arr['hot_number']) > 0 ? intval($arr['hot_number']) : 3;
         $arr['promote_number'] = !empty($arr['promote_number']) && intval($arr['promote_number']) > 0 ? intval($arr['promote_number']) : 3;
         $arr['top_number'] = intval($arr['top_number']) > 0 ? intval($arr['top_number']) : 10;
         $arr['history_number'] = intval($arr['history_number']) > 0 ? intval($arr['history_number']) : 5;
         $arr['comments_number'] = intval($arr['comments_number']) > 0 ? intval($arr['comments_number']) : 5;
         $arr['article_number'] = intval($arr['article_number']) > 0 ? intval($arr['article_number']) : 5;
         $arr['page_size'] = intval($arr['page_size']) > 0 ? intval($arr['page_size']) : 10;
         $arr['bought_goods'] = intval($arr['bought_goods']);
         $arr['goods_name_length'] = intval($arr['goods_name_length']);
         $arr['top10_time'] = intval($arr['top10_time']);
         $arr['goods_gallery_number'] = intval($arr['goods_gallery_number']) ? intval($arr['goods_gallery_number']) : 5;
         $arr['no_picture'] = !empty($arr['no_picture']) ? str_replace('./', '/', $arr['no_picture']) : __ROOT__ . '/data/common/images/no_picture.gif';
         // 修改默认商品图片的路径
         $arr['qq'] = !empty($arr['qq']) ? $arr['qq'] : '';
         $arr['ww'] = !empty($arr['ww']) ? $arr['ww'] : '';
         $arr['default_storage'] = isset($arr['default_storage']) ? intval($arr['default_storage']) : 1;
         $arr['min_goods_amount'] = isset($arr['min_goods_amount']) ? floatval($arr['min_goods_amount']) : 0;
         $arr['one_step_buy'] = empty($arr['one_step_buy']) ? 0 : 1;
         $arr['invoice_type'] = empty($arr['invoice_type']) ? array('type' => array(), 'rate' => array()) : unserialize($arr['invoice_type']);
         $arr['show_order_type'] = isset($arr['show_order_type']) ? $arr['show_order_type'] : 0;
         // 显示方式默认为列表方式
         $arr['help_open'] = isset($arr['help_open']) ? $arr['help_open'] : 1;
         // 显示方式默认为列表方式
         $ecs_version = C('ecs_version');
         if (!isset($ecs_version)) {
             /* 如果没有版本号则默认为2.0.5 */
             C('ecs_version', 'v2.7.3');
         }
         //限定语言项
         $lang_array = array('zh_cn', 'zh_tw', 'en_us');
         if (empty($arr['lang']) || !in_array($arr['lang'], $lang_array)) {
             $arr['lang'] = 'zh_cn';
             // 默认语言为简体中文
         }
         if (empty($arr['integrate_code'])) {
             $arr['integrate_code'] = 'ecshop';
             // 默认的会员整合插件为 ecshop
         }
         write_static_cache('touch_shop_config', $arr);
     } else {
         $arr = $data;
     }
     $config = array();
     foreach ($arr as $key => $vo) {
         $config[strtoupper($key)] = $vo;
     }
     return $config;
 }
开发者ID:noikiy,项目名称:shop-3,代码行数:82,代码来源:BaseModel.class.php

示例14: get_parent_grade

/**
 * 取得最近的上级分类的grade值.
 *
 * @param int $cat_id //当前的cat_id
 *
 * @return int
 */
function get_parent_grade($cat_id)
{
    static $res = null;
    if ($res === null) {
        $data = read_static_cache('cat_parent_grade');
        if ($data === false) {
            $sql = 'SELECT parent_id, cat_id, grade ' . ' FROM ' . $GLOBALS['ecs']->table('category');
            $res = $GLOBALS['db']->getAll($sql);
            write_static_cache('cat_parent_grade', $res);
        } else {
            $res = $data;
        }
    }
    if (!$res) {
        return 0;
    }
    $parent_arr = array();
    $grade_arr = array();
    foreach ($res as $val) {
        $parent_arr[$val['cat_id']] = $val['parent_id'];
        $grade_arr[$val['cat_id']] = $val['grade'];
    }
    while ($parent_arr[$cat_id] > 0 && $grade_arr[$cat_id] == 0) {
        $cat_id = $parent_arr[$cat_id];
    }
    return $grade_arr[$cat_id];
}
开发者ID:netroby,项目名称:ecshop,代码行数:34,代码来源:category.php

示例15: date

                    //ecs_iconv('UTF-8',$data['charset'],$api_arr['content']);去除模板汤的左边的目录
                }
                $api_arr['api_time'] = date('Ymd');
                write_static_cache('menu_api', $api_arr);
                make_json_result($api_arr['content']);
            } else {
                make_json_result('0');
            }
        } else {
            make_json_result('0');
        }
    } else {
        make_json_result($api_data['content']);
    }
} elseif ($act == 'cloud_remind') {
    $api_data = read_static_cache('cloud_remind');
    if ($api_data === false || isset($api_data['api_time']) && $api_data['api_time'] < date('Ymd')) {
        $t = new transport('-1', 5);
        $apiget = "ver={$data['version']}&ecs_lang={$data['ecs_lang']}&charset={$data['charset']}&certificate_id={$data['certificate_id']}&ent_id={$data['ent_id']}";
        $api_comment = $t->request('http://ecshop.ecmoban.com/cloud_remind.php', $apiget);
        $api_str = $api_comment["body"];
        $json = new Services_JSON();
        $api_arr = @$json->decode($api_str, 1);
        if (!empty($api_str)) {
            if (!empty($api_arr) && $api_arr['error'] == 0 && md5($api_arr['content']) == $api_arr['hash']) {
                $api_arr['content'] = urldecode($api_arr['content']);
                $message = explode('|', $api_arr['content']);
                $api_arr['content'] = '<li  class="cloud_close">' . $message['0'] . '<img onclick="cloud_close(' . $message['1'] . ')" src="images/no.gif"></li>';
                if ($data['charset'] != 'UTF-8') {
                    $api_arr['content'] = ecs_iconv('UTF-8', $data['charset'], $api_arr['content']);
                }
开发者ID:xiaoxiaowu007,项目名称:jicai,代码行数:31,代码来源:cloud.php


注:本文中的read_static_cache函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。