本文整理汇总了PHP中load_auto_cache函数的典型用法代码示例。如果您正苦于以下问题:PHP load_auto_cache函数的具体用法?PHP load_auto_cache怎么用?PHP load_auto_cache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了load_auto_cache函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load
public function load($param)
{
$key = $this->build_key(__CLASS__, $param);
$GLOBALS['fcache']->set_dir(APP_ROOT_PATH . "public/runtime/data/" . __CLASS__ . "/");
$new_hepls = $GLOBALS['fcache']->get($key);
if ($new_hepls === false) {
$new_hepls = load_auto_cache('article_cates');
$article_array = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "article where is_effect=1 order by sort desc ");
foreach ($new_hepls as $k => $v) {
if ($v['type_id'] == 1 && $v['num'] > 0) {
foreach ($article_array as $article_k => $article_v) {
if ($article_v['cate_id'] == $v['id']) {
if ($article_v['rel_url'] == "") {
$article_v['url'] = url('article', array('id' => $article_v['id']));
} else {
$article_v['url'] = $article_v['rel_url'];
}
$new_hepls[$k]['article'][] = $article_v;
}
}
} else {
unset($new_hepls[$k]);
}
}
$new_hepls = array_filter($new_hepls);
$GLOBALS['fcache']->set_dir(APP_ROOT_PATH . "public/runtime/data/" . __CLASS__ . "/");
$GLOBALS['fcache']->set($key, $new_hepls);
}
return $new_hepls;
}
示例2: show
public function show()
{
//获得文章列表
$artilce_cate = load_auto_cache("article_cates");
foreach ($artilce_cate as $k => $v) {
$artilce_cate[$k]['cate_id'] = $v['id'];
$artilce_cate[$k]['titles'] = $v['title'];
if ($id > 0 && $v['id'] == $id) {
$type_id = intval($v['type_id']);
$cate_name = $v['title'];
}
if ($id == $artilce_cate[$k]['cate_id']) {
$artilce_cate[$k]['current'] = 1;
}
}
$GLOBALS['tmpl']->assign("artilce_cate", $artilce_cate);
//文章头部导航
$nav_top = set_nav_top($GLOBALS['module'], $GLOBALS['action']);
$GLOBALS['tmpl']->assign('nav_top', $nav_top);
$GLOBALS['tmpl']->assign('deal_type', 'article_type');
$act = strim($_REQUEST['act']);
$help_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "help where type = '" . $act . "' or id = " . intval($act));
$GLOBALS['tmpl']->assign("help_item", $help_item);
$GLOBALS['tmpl']->assign("page_title", $help_item['title']);
$GLOBALS['tmpl']->display("help_show.html");
}
示例3: edit
public function edit()
{
//输出配送方式
//$consignee_id = $GLOBALS['db']->getOne("select id from ".DB_PREFIX."user_consignee where user_id = ".$GLOBALS['user_info']['id']);
$consignee_id = $_REQUEST['id'];
if ($consignee_id > 0) {
$consignee_data = load_auto_cache("consignee_info", array("consignee_id" => $consignee_id));
$consignee_info = $consignee_data['consignee_info'];
$region_lv1 = $consignee_data['region_lv1'];
$region_lv2 = $consignee_data['region_lv2'];
$region_lv3 = $consignee_data['region_lv3'];
$region_lv4 = $consignee_data['region_lv4'];
$GLOBALS['tmpl']->assign("region_lv1", $region_lv1);
$GLOBALS['tmpl']->assign("region_lv2", $region_lv2);
$GLOBALS['tmpl']->assign("region_lv3", $region_lv3);
$GLOBALS['tmpl']->assign("region_lv4", $region_lv4);
$GLOBALS['tmpl']->assign("consignee_info", $consignee_info);
} else {
$region_lv1 = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "delivery_region where pid = 0");
//一级地址
$GLOBALS['tmpl']->assign("region_lv1", $region_lv1);
}
if ($consignee_info) {
$GLOBALS['tmpl']->assign("consignee_info", $consignee_info);
}
$GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['UC_CONSIGNEE']);
$GLOBALS['tmpl']->assign("inc_file", "inc/uc/uc_consignee_edit.html");
$GLOBALS['tmpl']->display("uc.html");
}
示例4: index
public function index()
{
//require APP_ROOT_PATH.'app/Lib/page.php';
$page = intval($GLOBALS['request']['page']);
if ($page == 0) {
$page = 1;
}
$keywords = trim(htmlspecialchars($GLOBALS['request']['keywords']));
$level = intval($GLOBALS['request']['level']);
$interest = intval($GLOBALS['request']['interest']);
$months = intval($GLOBALS['request']['months']);
$lefttime = intval($GLOBALS['request']['lefttime']);
$deal_status = intval($GLOBALS['request']['deal_status']);
$limit = ($page - 1) * app_conf("DEAL_PAGE_SIZE") . "," . app_conf("DEAL_PAGE_SIZE");
$level_list = load_auto_cache("level");
$cate_id = intval($GLOBALS['request']['cid']);
$n_cate_id = 0;
$condition = " publish_wait = 0 ";
$orderby = "";
if ($cate_id > 0) {
$n_cate_id = $cate_id;
//$condition .= "AND deal_status in(0,1)";
$orderby = "update_time DESC ,sort DESC,id DESC";
} else {
$n_cate_id = 0;
$orderby = "update_time DESC , sort DESC , id DESC";
}
if ($keywords) {
$kw_unicode = str_to_unicode_string($keywords);
$condition .= " and (match(name_match,deal_cate_match,tag_match,type_match) against('" . $kw_unicode . "' IN BOOLEAN MODE))";
}
if ($level > 0) {
$point = $level_list['point'][$level];
$condition .= " AND user_id in(SELECT u.id FROM " . DB_PREFIX . "user u LEFT JOIN " . DB_PREFIX . "user_level ul ON ul.id=u.level_id WHERE ul.point >= {$point})";
}
if ($interest > 0) {
$condition .= " AND rate >= " . $interest;
}
if ($months > 0) {
if ($months == 12) {
$condition .= " AND repay_time <= " . $months;
} elseif ($months == 18) {
$condition .= " AND repay_time >= " . $months;
}
}
if ($lefttime > 0) {
$condition .= " AND (start_time + enddate*24*3600 - " . TIME_UTC . ") <= " . $lefttime * 24 * 3600;
}
if ($deal_status > 0) {
$condition .= " AND deal_status = " . $deal_status;
}
$result = get_deal_list($limit, $n_cate_id, $condition, $orderby);
$root = array();
$root['response_code'] = 1;
$root['item'] = $result['list'];
//$root['DEAL_PAGE_SIZE'] = app_conf("DEAL_PAGE_SIZE");
//$root['count'] = $result['count'];
$root['page'] = array("page" => $page, "page_total" => ceil($result['count'] / app_conf("DEAL_PAGE_SIZE")));
output($root);
}
示例5: index
public function index()
{
$GLOBALS['tmpl']->caching = true;
$cache_id = md5(MODULE_NAME . ACTION_NAME);
if (!$GLOBALS['tmpl']->is_cached('faq_index.html', $cache_id)) {
$faq_list = array();
$faq_group_list = $GLOBALS['db']->getAll("select distinct(`group`) from " . DB_PREFIX . "faq order by sort asc");
foreach ($faq_group_list as $k => $v) {
$faq_list[$v['group']] = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "faq where `group`='" . $v['group'] . "' order by sort asc");
}
$GLOBALS['tmpl']->assign("faq_list", $faq_list);
$GLOBALS['tmpl']->assign("page_title", "常见问题");
}
//获得文章列表
$artilce_cate = load_auto_cache("article_cates");
foreach ($artilce_cate as $k => $v) {
$artilce_cate[$k]['cate_id'] = $v['id'];
$artilce_cate[$k]['titles'] = $v['title'];
if ($id > 0 && $v['id'] == $id) {
$type_id = intval($v['type_id']);
$cate_name = $v['title'];
}
if ($id == $artilce_cate[$k]['cate_id']) {
$artilce_cate[$k]['current'] = 1;
}
}
$GLOBALS['tmpl']->assign("artilce_cate", $artilce_cate);
//文章头部导航
$nav_top = set_nav_top($GLOBALS['module'], $GLOBALS['action']);
$GLOBALS['tmpl']->assign('nav_top', $nav_top);
$GLOBALS['tmpl']->assign('deal_type', 'article_type');
$GLOBALS['tmpl']->display("faq_index.html", $cache_id);
}
示例6: index
public function index()
{
$root = array();
$email = strim($GLOBALS['request']['email']);
//用户名或邮箱
$pwd = strim($GLOBALS['request']['pwd']);
//密码
//检查用户,用户密码
$user = user_check($email, $pwd);
$user_id = intval($user['id']);
$root['user_id'] = $user_id;
if ($user_id > 0) {
require APP_ROOT_PATH . 'app/Lib/uc_func.php';
$root['user_login_status'] = 1;
$root['response_code'] = 1;
$bank_list = $GLOBALS['db']->getAll("SELECT u.id, u.bankcard,u.real_name, b.name as bank_name, b.id as bank_id FROM " . DB_PREFIX . "user_bank u left join " . DB_PREFIX . "bank b on b.id = u.bank_id where u.user_id=" . $user_id . " ORDER BY u.id ASC");
foreach ($bank_list as $k => $v) {
$bank_list[$k]['bankcode'] = str_replace(" ", "", $v['bankcard']);
$bank_list[$k]['img'] = str_replace("/mapi", "", SITE_DOMAIN . APP_ROOT . '/public/bank/' . $v['bank_id'] . '.jpg');
}
$root['item'] = $bank_list;
//手续费
$fee_config = load_auto_cache("user_carry_config");
$json_fee = array();
foreach ($fee_config as $k => $v) {
$json_fee[] = $v;
$fee_config[$k]['fee_format'] = format_price($v['fee']);
}
$root['fee_config'] = $fee_config;
//$root['json_fee'] = json_encode($json_fee);
$root['open_ips'] = intval(app_conf("OPEN_IPS"));
$root['ips_acct_no'] = $user['ips_acct_no'];
$root['idno'] = $user['idno'];
//身份证号
$root['real_name'] = $user['real_name'];
//第三方托管标
if (!empty($user['ips_acct_no']) && intval(app_conf("OPEN_IPS")) > 0) {
$result = GetIpsUserMoney($user_id, 0);
$root['ips_money'] = $result['pBalance'];
//提现 http://p2p.fanwe.net/index.php?ctl=collocation&act=DoDwTrade&user_type=0&from=app&user_id=44&pTrdAmt=10
$app_url = APP_ROOT . "/index.php?ctl=collocation&act=DoDwTrade&user_type=0&pTrdAmt=parm_amt&user_id=" . $user_id . "&from=" . $GLOBALS['request']['from'];
$root['dw_url'] = str_replace("/mapi", "", SITE_DOMAIN . $app_url);
} else {
//申请
$app_url = APP_ROOT . "/index.php?ctl=collocation&act=CreateNewAcct&user_type=0&user_id=" . $user_id . "&from=" . $GLOBALS['request']['from'];
$root['acct_url'] = str_replace("/mapi", "", SITE_DOMAIN . $app_url);
$root['ips_money'] = 0;
}
$root['ips_money_format'] = format_price($root['ips_money']);
//预留 提现金额
$root['ips_money_fee'] = 0;
//预留 提现费用
} else {
$root['response_code'] = 0;
$root['show_err'] = "未登录";
$root['user_login_status'] = 0;
}
$root['program_title'] = "提现";
output($root);
}
示例7: load
public function load($param)
{
static $cate_list;
if ($cate_list) {
return $cate_list;
}
$key = $this->build_key(__CLASS__, $param);
$GLOBALS['fcache']->set_dir(APP_ROOT_PATH . "public/runtime/data/" . __CLASS__ . "/");
$cate_list = $GLOBALS['fcache']->get($key);
if ($cate_list === false) {
$cate_list_rs = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "shop_cate where is_effect = 1 and is_delete = 0");
foreach ($cate_list_rs as $k => $v) {
//输出筛选
$ids = load_auto_cache("shop_sub_parent_cate_ids", array("cate_id" => intval($v['id'])));
$brand_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "brand where shop_cate_id in (" . implode(",", $ids) . ")");
$brand_list[] = array("name" => $GLOBALS['lang']['ALL'], "id" => 0);
$v['brand_list'] = $brand_list;
$filter_group = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "filter_group where is_effect = 1 and cate_id in (" . implode(",", $ids) . ") order by sort desc");
foreach ($filter_group as $kk => $vv) {
$filter_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "filter where filter_group_id = " . $vv['id'] . " limit 20");
$filter_list[] = array("name" => $GLOBALS['lang']['ALL'], "id" => 0);
$filter_group[$kk]['filter_list'] = $filter_list;
}
$v['filter_group'] = $filter_group;
$cate_list[$v['id']] = $v;
if ($v['uname'] != "") {
$cate_list[$v['uname']] = $v;
}
}
$GLOBALS['fcache']->set_dir(APP_ROOT_PATH . "public/runtime/data/" . __CLASS__ . "/");
$GLOBALS['fcache']->set($key, $cate_list);
}
return $cate_list;
}
示例8: index
public function index()
{
$GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['UC_ACCOUNT']);
//扩展字段
$field_list = load_auto_cache("user_field_list");
foreach ($field_list as $k => $v) {
$field_list[$k]['value'] = $GLOBALS['db']->getOne("select value from " . DB_PREFIX . "user_extend where user_id=" . $GLOBALS['user_info']['id'] . " and field_id=" . $v['id']);
}
$GLOBALS['tmpl']->assign("field_list", $field_list);
//地区列表
$region_lv2 = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "region_conf where region_level = 2");
//二级地址
foreach ($region_lv2 as $k => $v) {
if ($v['id'] == intval($GLOBALS['user_info']['province_id'])) {
$region_lv2[$k]['selected'] = 1;
break;
}
}
$GLOBALS['tmpl']->assign("region_lv2", $region_lv2);
$region_lv3 = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "region_conf where pid = " . intval($GLOBALS['user_info']['province_id']));
//三级地址
foreach ($region_lv3 as $k => $v) {
if ($v['id'] == intval($GLOBALS['user_info']['city_id'])) {
$region_lv3[$k]['selected'] = 1;
break;
}
}
$GLOBALS['tmpl']->assign("region_lv3", $region_lv3);
set_uc_right();
$GLOBALS['tmpl']->assign("inc_file", "inc/uc/uc_account_index.html");
$GLOBALS['tmpl']->display("uc.html");
}
示例9: init
public function init()
{
$id = intval($_REQUEST['id']);
$this->space_user = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $id . " and is_effect= 1 and is_delete = 0");
$user_id = intval($GLOBALS['user_info']['id']);
if (!$this->space_user) {
showErr($GLOBALS['lang']['USER_NOT_EXISTS']);
}
$focus_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_focus where focus_user_id = " . $user_id . " and focused_user_id = " . $this->space_user['id']);
if ($focus_data) {
$this->space_user['focused'] = 1;
}
$region_list = load_auto_cache("cache_region_conf");
// $province_str = $GLOBALS['db']->getOne("select name from ".DB_PREFIX."region_conf where id = ".$this->space_user['province_id']);
$province_str = $region_list[$this->space_user['province_id']]['name'];
// $city_str = $GLOBALS['db']->getOne("select name from ".DB_PREFIX."region_conf where id = ".$this->space_user['city_id']);
$city_str = $region_list[$this->space_user['city_id']]['name'];
if ($province_str . $city_str == '') {
$user_location = $GLOBALS['lang']['LOCATION_NULL'];
} else {
$user_location = $province_str . $city_str;
}
$this->space_user['fav_count'] = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "topic where user_id = " . $this->space_user['id'] . " and fav_id <> 0");
$this->space_user['user_location'] = $user_location;
$GLOBALS['tmpl']->assign("space_user", $this->space_user);
//输出粉丝
$fans_list = $GLOBALS['db']->getAll("select focus_user_id as id,focus_user_name as user_name from " . DB_PREFIX . "user_focus where focused_user_id = " . $this->space_user['id'] . " order by rand() limit 5");
$ids = array(0);
foreach ($fans_list as $k => $v) {
$ids[] = $v['id'];
}
$focus_data = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "user_focus where focus_user_id = " . $user_id . " and focused_user_id in (" . implode(",", $ids) . ")");
foreach ($fans_list as $k => $v) {
foreach ($focus_data as $kk => $vv) {
if ($vv['focused_user_id'] == $v['id']) {
$fans_list[$k]['focused'] = 1;
break;
}
}
}
$GLOBALS['tmpl']->assign("rfans_list", $fans_list);
//输出我的关注
$focus_list = $GLOBALS['db']->getAll("select focused_user_id as id,focused_user_name as user_name from " . DB_PREFIX . "user_focus where focus_user_id = " . $this->space_user['id'] . " order by rand() limit 5");
$ids = array(0);
foreach ($focus_list as $k => $v) {
$ids[] = $v['id'];
}
$focus_data = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "user_focus where focus_user_id = " . $user_id . " and focused_user_id in (" . implode(",", $ids) . ")");
foreach ($focus_list as $k => $v) {
foreach ($focus_data as $kk => $vv) {
if ($vv['focused_user_id'] == $v['id']) {
$focus_list[$k]['focused'] = 1;
break;
}
}
}
$GLOBALS['tmpl']->assign("rfocus_list", $focus_list);
}
示例10: index
public function index()
{
$GLOBALS['tmpl']->assign("page_title", "积分兑现");
$list = load_auto_cache("level");
$GLOBALS['tmpl']->assign("list", $list['list']);
$userinfo = $GLOBALS['db']->getRow("SELECT * FROM " . DB_PREFIX . "user WHERE id='" . $GLOBALS['user_info']['id'] . "' and vip_state='1' ");
$GLOBALS['tmpl']->assign('userinfo', $userinfo);
$gradeinfo = $GLOBALS['db']->getRow("SELECT * FROM " . DB_PREFIX . "vip_type WHERE id='" . $userinfo['vip_id'] . "' and is_delete='0' ");
$GLOBALS['tmpl']->assign('gradeinfo', $gradeinfo);
$vip_type = $GLOBALS['db']->getAll("SELECT * FROM " . DB_PREFIX . "vip_type WHERE is_effect='1' and is_delete='0' ");
$GLOBALS['tmpl']->assign('vip_type', $vip_type);
$vip_setting = $GLOBALS['db']->getAll("SELECT * FROM " . DB_PREFIX . "vip_setting v LEFT JOIN " . DB_PREFIX . "vip_type vt ON v.vip_id=vt.id WHERE v.is_effect='1' and v.is_delete='0' ");
$GLOBALS['tmpl']->assign('vip_setting', $vip_setting);
$json_vipinfo = $GLOBALS['db']->getRow("SELECT * FROM " . DB_PREFIX . "vip_setting WHERE vip_id='" . $userinfo['vip_id'] . "' ");
$GLOBALS['tmpl']->assign('json_vipinfo', $json_vipinfo);
$customerinfo = $GLOBALS['db']->getRow("SELECT * FROM " . DB_PREFIX . "customer WHERE id='" . $userinfo['customer_id'] . "' and is_effect='1' ");
$GLOBALS['tmpl']->assign('customerinfo', $customerinfo);
$today = to_date(TIME_UTC, "Y-m-d");
$start_time = to_date(next_replay_month(TIME_UTC, -24), "Y-m-d");
$begin_date = to_date(next_replay_month(TIME_UTC, -3), "Y-m-d");
$user_id = $GLOBALS['user_info']['id'];
$borrow_total = $GLOBALS['db']->getOne("select sum(borrow_amount) FROM " . DB_PREFIX . "deal WHERE start_date>'{$start_time}' and user_id='{$user_id}' and deal_status > 3 ");
$load_total = $GLOBALS['db']->getOne("select sum(dl.money) FROM " . DB_PREFIX . "deal_load dl LEFT JOIN " . DB_PREFIX . "deal d ON dl.deal_id=d.id WHERE dl.create_date>'{$start_time}' and dl.user_id='{$user_id}' and d.deal_status > 3 ");
$t_u_load = $GLOBALS['db']->getRow("SELECT sum(dlr.repay_money) as load_money FROM " . DB_PREFIX . "deal_load_repay dlr LEFT JOIN " . DB_PREFIX . "deal d ON d.id=dlr.deal_id LEFT JOIN " . DB_PREFIX . "deal_load dl ON dl.id=dlr.load_id WHERE d.is_effect=1 and dl.is_repay= 0 and dlr.t_user_id = " . $user_id);
$load_total = floatval($load_total) + floatval($t_u_load['load_money']);
// $load_total = $GLOBALS['db']->getOne("select sum(money) FROM ".DB_PREFIX."deal_load WHERE create_date>'$start_time' and user_id='$user_id' ");
$overdue_total = $GLOBALS['db']->getOne("select sum(repay_money) FROM " . DB_PREFIX . "deal_repay WHERE ((has_repay=1 and repay_date<true_repay_date) or (has_repay=0 and repay_date <'{$today}')) and user_id='{$user_id}' ");
$bl_total = (int) $borrow_total + (int) $load_total;
$yx_total = $bl_total - $overdue_total;
$vipgradeinfo = $GLOBALS['db']->getRow("select * FROM " . DB_PREFIX . "vip_type WHERE lower_limit<='{$yx_total}' and upper_limit>='{$yx_total}' and is_effect='1' and is_delete='0' ");
$grade_cz = $GLOBALS['db']->getRow("SELECT * FROM " . DB_PREFIX . "vip_type where is_effect='1' and is_delete='0' order by lower_limit asc limit 1 ");
if ($grade_cz['lower_limit'] > $yx_total || $userinfo['vip_id'] == 0) {
$chazhi = (int) $grade_cz['lower_limit'] - $yx_total;
if ($chazhi > 0) {
$chazhi = $chazhi;
} else {
$chazhi = 0;
}
$nextgrade = $grade_cz['vip_grade'];
} else {
$chazhi = $vipgradeinfo['upper_limit'] - $yx_total + 1;
$nextgradeinfo = $GLOBALS['db']->getRow("select * FROM " . DB_PREFIX . "vip_type WHERE lower_limit >'" . $vipgradeinfo['upper_limit'] . "' and is_effect='1' and is_delete='0' order by lower_limit asc limit 1 ");
$nextgrade = $nextgradeinfo['vip_grade'];
}
$chazhi = number_format($chazhi);
$bl_total = number_format($bl_total);
$vipgradeinfo = number_format($vipgradeinfo);
$yx_total = number_format($yx_total);
$overdue_total = number_format($overdue_total);
$GLOBALS['tmpl']->assign('bl_total', $bl_total);
$GLOBALS['tmpl']->assign('chazhi', $chazhi);
$GLOBALS['tmpl']->assign('nextgrade', $nextgrade);
$GLOBALS['tmpl']->assign('overdue_total', $overdue_total);
$GLOBALS['tmpl']->assign('yx_total', $yx_total);
$GLOBALS['tmpl']->assign('vipgradeinfo', $vipgradeinfo);
$GLOBALS['tmpl']->assign("inc_file", "inc/uc/uc_score_exchange.html");
$GLOBALS['tmpl']->display("page/uc.html");
}
示例11: get_article_list
/**
* 获取文章列表
*/
function get_article_list($limit, $cate_id = 0, $where = '', $orderby = '', $cached = true)
{
$key = md5("ARTICLE" . $limit . $cate_id . $where . $orderby);
if ($cached) {
$res = $GLOBALS['cache']->get($key);
} else {
$res = false;
}
if ($res === false) {
$count_sql = "select count(*) from " . DB_PREFIX . "article as a left join " . DB_PREFIX . "article_cate as ac on a.cate_id = ac.id where a.is_effect = 1 and a.is_delete = 0 and ac.is_delete = 0 and ac.is_effect = 1 ";
$sql = "select a.*,ac.type_id,ac.title as ctitle from " . DB_PREFIX . "article as a left join " . DB_PREFIX . "article_cate as ac on a.cate_id = ac.id where a.is_effect = 1 and a.is_delete = 0 and ac.is_delete = 0 and ac.is_effect = 1 ";
if ($cate_id > 0) {
$ids = load_auto_cache("deal_shop_acate_belone_ids", array("cate_id" => $cate_id));
$sql .= " and a.cate_id in (" . implode(",", $ids) . ")";
$count_sql .= " and a.cate_id in (" . implode(",", $ids) . ")";
}
if ($where != '') {
$sql .= " and " . $where;
$count_sql .= " and " . $where;
}
if ($orderby == '') {
$sql .= " order by a.sort desc limit " . $limit;
} else {
$sql .= " order by " . $orderby . " limit " . $limit;
}
$articles = $GLOBALS['db']->getAll($sql);
foreach ($articles as $k => $v) {
if ($v['type_id'] == 1) {
$module = "help";
} elseif ($v['type_id'] == 2) {
$module = "notice";
} elseif ($v['type_id'] == 3) {
$module = "sys";
} else {
$module = 'article';
}
if ($v['rel_url'] != '') {
if (!preg_match("/http:\\/\\//i", $v['rel_url'])) {
if (substr($v['rel_url'], 0, 2) == 'u:') {
$aurl = parse_url_tag($v['rel_url']);
} else {
$aurl = APP_ROOT . "/" . $v['rel_url'];
}
} else {
$aurl = $v['rel_url'];
}
} else {
$aurl = url("index", $module . "#" . $v['id']);
}
$articles[$k]['url'] = $aurl;
}
$articles_count = $GLOBALS['db']->getOne($count_sql);
$res = array('list' => $articles, 'count' => $articles_count);
$GLOBALS['cache']->set($key, $res);
}
return $res;
}
示例12: index
public function index()
{
$GLOBALS['tmpl']->caching = true;
//输出文章
$id = intval($_REQUEST['id']);
$article = $GLOBALS['db']->getRow("select a.*,ac.type_id from " . DB_PREFIX . "article as a left join " . DB_PREFIX . "article_cate as ac on ac.id=a.cate_id where a.id={$id}");
//$article_shang 上一篇文章,$article_xia下一篇文章
$article_shang = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "article where id<" . $article['id'] . " and is_delete=0 and is_effect=1 order by id desc limit 0,1");
$article_xia = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "article where id>" . $article['id'] . " and is_delete=0 and is_effect=1 order by id desc limit 0,1");
if ($article_shang['rel_url'] == "") {
$article_shang['url'] = url('article', array('id' => $article_shang['id']));
} else {
$article_shang['url'] = $article_shang['rel_url'];
}
if ($article_xia['rel_url'] == "") {
$article_xia['url'] = url('article', array('id' => $article_xia['id']));
} else {
$article_xia['url'] = $article_xia['rel_url'];
}
$cate_id = $article['cate_id'];
$article['tags_arr'] = preg_split("/[ ,]/", $article['tags']);
$artilce_cate = load_auto_cache("article_cates");
$artilce_cate_new = array();
foreach ($artilce_cate as $k => $v) {
if ($v['type_id'] == $article['type_id'] && $v['id'] != $cate_id && $v['num'] > 0) {
$artilce_cate_new[$k]['cate_id'] = $v['id'];
$artilce_cate_new[$k]['titles'] = $v['title'];
$artilce_cate_new[$k]['url'] = url('article_cate', array('id' => $v['id']));
}
}
$GLOBALS['tmpl']->assign("other_cate", $artilce_cate_new);
//文章详细页面最新更新(控制最新的10条)
$temp_article_list = $GLOBALS['db']->getAllCached("SELECT a.*,c.type_id from " . DB_PREFIX . "article a LEFT JOIN " . DB_PREFIX . "article_cate c on a.cate_id=c.id where 1=1 and a.is_delete=0 and a.is_effect=1 and c.type_id=" . $article['type_id'] . " and a.cate_id={$cate_id} and a.id!={$id} order by update_time desc limit 0,5");
$article_list = array();
foreach ($temp_article_list as $k => $v) {
//最新更新
$article_list[$k]['cate_title'] = $v['title'];
if ($v['rel_url'] == "") {
$article_list[$k]['url'] = url('article', array('id' => $v['id']));
} else {
$article_list[$k]['url'] = $v['rel_url'];
}
}
unset($temp_article_list);
$GLOBALS['tmpl']->assign('deal_type', 'article_type');
//文章头部导航
$nav_top = set_nav_top($GLOBALS['module'], $GLOBALS['action'], $id);
$GLOBALS['tmpl']->assign('nav_top', $nav_top);
$GLOBALS['tmpl']->assign("page_title", $article['seo_title']);
$GLOBALS['tmpl']->assign("page_seo_keyword", $article['seo_keyword']);
$GLOBALS['tmpl']->assign("page_seo_description", $article['seo_description']);
$GLOBALS['tmpl']->assign("article", $article);
$GLOBALS['tmpl']->assign("article_shang", $article_shang);
$GLOBALS['tmpl']->assign("article_xia", $article_xia);
$GLOBALS['tmpl']->assign("article_list", $article_list);
$GLOBALS['tmpl']->display("article_index.html");
}
示例13: index
public function index()
{
init_app_page();
$s_account_info = $GLOBALS["account_info"];
$supplier_id = intval($s_account_info['supplier_id']);
$name = strim($_REQUEST['name']);
$begin_time = strim($_REQUEST['begin_time']);
$end_time = strim($_REQUEST['end_time']);
$begin_time_s = to_timespan($begin_time, "Y-m-d H:i");
$end_time_s = to_timespan($end_time, "Y-m-d H:i");
$condition = "";
if ($name != "") {
$youhui_ids = $GLOBALS['db']->getRow("select group_concat(id SEPARATOR ',') as ids from " . DB_PREFIX . "youhui where name like '%" . $name . "%'");
$condition .= " and log.youhui_id in (" . $youhui_ids['ids'] . ") ";
}
if ($begin_time_s) {
$condition .= " and log.create_time > " . $begin_time_s . " ";
}
if ($end_time_s) {
$condition .= " and log.create_time < " . $end_time_s . " ";
}
$GLOBALS['tmpl']->assign("name", $name);
$GLOBALS['tmpl']->assign("begin_time", $begin_time);
$GLOBALS['tmpl']->assign("end_time", $end_time);
//分页
$page_size = 15;
$page = intval($_REQUEST['p']);
if ($page == 0) {
$page = 1;
}
$limit = ($page - 1) * $page_size . "," . $page_size;
$list = $GLOBALS['db']->getAll("select distinct(log.id),log.* from " . DB_PREFIX . "youhui_log as log left join " . DB_PREFIX . "youhui_location_link as l on l.youhui_id = log.youhui_id where l.location_id in (" . implode(",", $s_account_info['location_ids']) . ") " . $condition . " order by log.create_time desc limit " . $limit);
foreach ($list as $k => $v) {
$list[$k]['user_name'] = load_user($v['user_id']);
$list[$k]['user_name'] = $list[$k]['user_name']['user_name'];
$youhui_info = load_auto_cache("youhui", array('id' => $v['youhui_id']));
$list[$k]['youhui_name'] = $youhui_info['name'];
$location_info = load_auto_cache("store", array('id' => $v['location_id']));
$list[$k]['location_name'] = $location_info['name'];
if ($list[$k]['expire_time'] != 0 && $list[$k]['expire_time'] < NOW_TIME) {
$list[$k]['expire_time'] = "已过期";
} elseif ($list[$k]['expire_time'] == 0) {
$list[$k]['expire_time'] = "永久有效";
} else {
$list[$k]['expire_time'] = to_date($list[$k]['expire_time']);
}
$list[$k]['url'] = url('index', 'youhui#' . $v['youhui_id']);
}
$total = $GLOBALS['db']->getOne("select count(distinct(log.id)) from " . DB_PREFIX . "youhui_log as log left join " . DB_PREFIX . "youhui_location_link as l on l.youhui_id = log.youhui_id where l.location_id in (" . implode(",", $s_account_info['location_ids']) . ") " . $condition);
$page = new Page($total, $page_size);
//初始化分页对象
$p = $page->show();
$GLOBALS['tmpl']->assign('pages', $p);
$GLOBALS['tmpl']->assign("list", $list);
$GLOBALS['tmpl']->assign("head_title", "优惠券下载记录");
$GLOBALS['tmpl']->display("pages/youhuio/index.html");
}
示例14: index
public function index()
{
$root = array();
$page = intval($GLOBALS['request']['page']);
if ($page == 0) {
$page = 1;
}
$keywords = trim(htmlspecialchars($GLOBALS['request']['keywords']));
$level = intval($GLOBALS['request']['level']);
$interest = intval($GLOBALS['request']['interest']);
$months = intval($GLOBALS['request']['months']);
$lefttime = intval($GLOBALS['request']['lefttime']);
$cate_id = intval($GLOBALS['request']['cid']);
$limit = ($page - 1) * app_conf("DEAL_PAGE_SIZE") . "," . app_conf("DEAL_PAGE_SIZE");
$level_list = load_auto_cache("level");
$page_args = array();
$condition = "";
if ($cate_id > 0) {
$condition .= "AND d.deal_status >=4 and cate_id=" . $cate_id;
$orderby = "d.update_time DESC ,d.sort DESC,d.id DESC";
} elseif ($cate_id == 0) {
$orderby = " d.create_time DESC , dlt.id DESC";
}
if ($keywords) {
$kw_unicode = str_to_unicode_string($keywords);
$condition .= " and (match(d.name_match,d.deal_cate_match,d.tag_match,d.type_match) against('" . $kw_unicode . "' IN BOOLEAN MODE))";
}
if ($level > 0) {
$point = $level_list['point'][$level];
$condition .= " AND d.user_id in(SELECT u.id FROM " . DB_PREFIX . "user u LEFT JOIN " . DB_PREFIX . "user_level ul ON ul.id=u.level_id WHERE ul.point >= {$point})";
}
if ($interest > 0) {
$condition .= " AND d.rate >= " . $interest;
}
if ($months > 0) {
if ($months == 12) {
$condition .= " AND d.repay_time <= " . $months;
} elseif ($months == 18) {
$condition .= " AND d.repay_time >= " . $months;
}
}
if ($lefttime > 0) {
$condition .= " AND (d.next_repay_time + 24*3600 - 1 - " . TIME_UTC . ") <= " . $lefttime * 24 * 3600;
}
$extfield = "";
$union_sql = "";
$result = get_transfer_list($limit, $condition, $extfield, $union_sql, $orderby);
$root = array();
$root['response_code'] = 1;
$root['item'] = $result['list'];
//$root['DEAL_PAGE_SIZE'] = app_conf("DEAL_PAGE_SIZE");
//$root['count'] = $result['count'];
$root['page'] = array("page" => $page, "page_total" => ceil($result['rs_count'] / app_conf("DEAL_PAGE_SIZE")), "page_size" => app_conf("DEAL_PAGE_SIZE"));
$root['program_title'] = "债权转让";
output($root);
}
示例15: send
public function send()
{
global_run();
if (check_save_login() != LOGIN_STATUS_LOGINED) {
$data['status'] = 1000;
ajax_return($data);
} else {
$t = strim($_REQUEST['t']);
$id = intval($_REQUEST['id']);
$youhui_log = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "youhui_log where id = " . $id . " and user_id = " . $GLOBALS['user_info']['id']);
$youhui_info = load_auto_cache("youhui", array("id" => $youhui_log['youhui_id']));
if ($youhui_log) {
if ($youhui_log['confirm_time'] > 0) {
$data['status'] = 0;
$data['info'] = "优惠券已使用";
ajax_return($data);
} elseif ($youhui_log['expire_time'] > 0 && $youhui_log['expire_time'] < NOW_TIME) {
$data['status'] = 0;
$data['info'] = "优惠券已过期";
ajax_return($data);
} else {
if ($t == "sms") {
if (app_conf("SMS_ON") == 0 || $youhui_info['is_sms'] == 0) {
$data['status'] = 0;
$data['info'] = "不支持短信发送";
ajax_return($data);
} elseif ($youhui_log['sms_count'] >= app_conf("SMS_COUPON_LIMIT")) {
$data['status'] = 0;
$data['info'] = "短信发送已超过" . app_conf("SMS_COUPON_LIMIT") . "次";
ajax_return($data);
} elseif ($GLOBALS['user_info']['mobile'] == "") {
$data['status'] = 0;
$data['info'] = "请先设置手机号";
$data['jump'] = url("index", "uc_account");
ajax_return($data);
} else {
send_youhui_log_sms($id);
$GLOBALS['db']->query("update " . DB_PREFIX . "youhui_log set sms_count = sms_count + 1 where id = " . $id);
$data['status'] = 1;
$data['info'] = "短信成功发送到" . $GLOBALS['user_info']['mobile'] . ",请注意查收。";
ajax_return($data);
}
} else {
$data['status'] = 0;
$data['info'] = "非法操作";
ajax_return($data);
}
}
} else {
$data['status'] = 0;
$data['info'] = "优惠券不存在";
ajax_return($data);
}
}
}