Esempio n. 1
0
 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;
 }
 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");
 }
 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");
 }
Esempio n. 4
0
 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);
 }
 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);
 }
Esempio n. 6
0
 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);
 }
 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;
 }
 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");
 }
 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);
 }
 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");
 }
Esempio n. 11
0
/**
 * 获取文章列表
 */
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;
}
 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");
 }
Esempio n. 13
0
 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");
 }
 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);
 }
Esempio n. 15
0
 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);
         }
     }
 }
Esempio n. 16
0
 public function index()
 {
     global_run();
     init_app_page();
     $GLOBALS['tmpl']->assign("no_nav", true);
     //无分类下拉
     $title = $GLOBALS['lang']['GROUP_FORUM'];
     $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => url("index", "index"));
     $site_nav[] = array('name' => $title, 'url' => url("index", "group"));
     $GLOBALS['tmpl']->assign("site_nav", $site_nav);
     //输出热门小组
     $hot_group = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "topic_group where is_effect = 1 order by topic_count desc,user_count desc limit 4");
     $GLOBALS['tmpl']->assign("hot_group", $hot_group);
     if (intval($_REQUEST['id']) > 0) {
         $page_size = 20;
         $page = intval($_REQUEST['p']);
         if ($page <= 0) {
             $page = 1;
         }
         $limit = ($page - 1) * $page_size . "," . $page_size;
         $cate_condition = " and id = " . intval($_REQUEST['id']);
     } else {
         $limit = 6;
         $cate_condition = " and 1=1 ";
     }
     //输出分类列表
     $cate_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "topic_group_cate where is_effect = 1 " . $cate_condition . " order by sort desc");
     foreach ($cate_list as $k => $v) {
         $sql = " select * from " . DB_PREFIX . "topic_group where is_effect = 1  and cate_id = " . $v['id'] . " order by sort asc limit " . $limit;
         $cate_list[$k]['list'] = $GLOBALS['db']->getAll($sql);
         if (intval($_REQUEST['id']) > 0) {
             $sql_count = "select count(*) from " . DB_PREFIX . "topic_group where is_effect = 1 and cate_id = " . $v['id'] . " order by sort asc";
             $count = $GLOBALS['db']->getOne($sql_count);
         }
     }
     $GLOBALS['tmpl']->assign("cate_list", $cate_list);
     //print_r($cate_list);
     if (intval($_REQUEST['id']) > 0) {
         $page = new Page($count, $page_size);
         //初始化分页对象
         $p = $page->show();
         $GLOBALS['tmpl']->assign('pages', $p);
     }
     //输出优秀小组长
     $group_adm_list = $GLOBALS['db']->getAll("select id,name,user_count,user_id from " . DB_PREFIX . "topic_group  where is_effect = 1 and user_id <> 0 group by user_id order by topic_count desc limit 5");
     $GLOBALS['tmpl']->assign("group_adm_list", $group_adm_list);
     //输出推荐的主题
     $rec_topic_list = load_auto_cache("recommend_forum_topic");
     $GLOBALS['tmpl']->assign("rec_topic_list", $rec_topic_list);
     $GLOBALS['tmpl']->assign("page_title", $title);
     $GLOBALS['tmpl']->assign("page_keyword", $title . ",");
     $GLOBALS['tmpl']->assign("page_description", $title . ",");
     $GLOBALS['tmpl']->display("group_index.html");
 }
 public function edit()
 {
     $id = intval($_REQUEST['id']);
     $condition['id'] = $id;
     $vo = M(MODULE_NAME)->where($condition)->find();
     if ($vo['deal_status'] == 0) {
         $level_list = load_auto_cache("level");
         $u_level = M("User")->where("id=" . $vo['user_id'])->getField("level_id");
         $vo['services_fee'] = $level_list['services_fee'][$u_level];
     }
     $user_info = M("User")->getById($vo['user_id']);
     $old_imgdata_str = unserialize($user_info['view_info']);
     foreach ($old_imgdata_str as $k => $v) {
         $old_imgdata_str[$k]['key'] = $k;
         /*+一个key*/
     }
     $this->assign("user_info", $user_info);
     $this->assign("old_imgdata_str", $old_imgdata_str);
     $vo['view_info'] = unserialize($vo['view_info']);
     if ($vo['status'] == 0) {
         $vo['manage_fee'] = app_conf("MANAGE_FEE");
         $vo['user_loan_manage_fee'] = app_conf("USER_LOAN_MANAGE_FEE");
         $vo['manage_impose_fee_day1'] = app_conf("MANAGE_IMPOSE_FEE_DAY1");
         $vo['manage_impose_fee_day2'] = app_conf("MANAGE_IMPOSE_FEE_DAY2");
         $vo['impose_fee_day1'] = app_conf("IMPOSE_FEE_DAY1");
         $vo['impose_fee_day2'] = app_conf("IMPOSE_FEE_DAY2");
         $vo['user_load_transfer_fee'] = app_conf("USER_LOAD_TRANSFER_FEE");
         $vo['compensate_fee'] = app_conf("COMPENSATE_FEE");
         $vo['user_bid_rebate'] = app_conf("USER_BID_REBATE");
         $vo['generation_position'] = 100;
     }
     $this->assign("vo", $vo);
     $citys = M("DealCity")->where('is_delete= 0 and is_effect=1 ')->findAll();
     $citys_link = unserialize($vo['citys']);
     foreach ($citys as $k => $v) {
         foreach ($citys_link as $kk => $vv) {
             if ($vv == $v['id']) {
                 $citys[$k]['is_selected'] = 1;
             }
         }
     }
     $this->assign('citys', $citys);
     $deal_cate_tree = M("DealCate")->where('is_delete = 0')->findAll();
     $deal_cate_tree = D("DealCate")->toFormatTree($deal_cate_tree, 'name');
     $this->assign("deal_cate_tree", $deal_cate_tree);
     $deal_agency = M("DealAgency")->where('is_effect = 1')->order('sort DESC')->findAll();
     $this->assign("deal_agency", $deal_agency);
     $deal_type_tree = M("DealLoanType")->findAll();
     $deal_type_tree = D("DealLoanType")->toFormatTree($deal_type_tree, 'name');
     $this->assign("deal_type_tree", $deal_type_tree);
     $loantype_list = load_auto_cache("loantype_list");
     $this->assign("loantype_list", $loantype_list);
     $this->display();
 }
Esempio n. 18
0
 public function futures()
 {
     $GLOBALS['tmpl']->caching = true;
     $cache_id = md5(MODULE_NAME . ACTION_NAME);
     if (!$GLOBALS['tmpl']->is_cached('peizi/weekwin.html', $cache_id)) {
         $peizi_conf = load_auto_cache("peizi_conf", array('type' => 3));
         $GLOBALS['tmpl']->assign("is_show_today", 1);
         $GLOBALS['tmpl']->assign("peizi_conf_json", json_encode($peizi_conf));
         $GLOBALS['tmpl']->assign("peizi_conf", $peizi_conf);
     }
     $GLOBALS['tmpl']->display("peizi/futures.html", $cache_id);
 }
Esempio n. 19
0
 public function register()
 {
     init_app_page();
     if ($GLOBALS['user_info']) {
         $GLOBALS['tmpl']->assign("user_info", $GLOBALS['user_info']);
     }
     $step = intval($_REQUEST['step']);
     if (empty($step)) {
         $step = 1;
     }
     if ($step == 2) {
         $cate_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate where is_effect = 1 and is_delete = 0 order by sort desc");
         $GLOBALS['tmpl']->assign("cate_list", $cate_list);
         $deal_city_list = load_auto_cache("city_list_result");
         $GLOBALS['tmpl']->assign("city_list", $deal_city_list['ls']);
     } elseif ($step == 3) {
         if ($_POST) {
             $data['name'] = addslashes(htmlspecialchars(trim($_REQUEST['name'])));
             $data['deal_cate_id'] = intval($_REQUEST['deal_cate_id']);
             foreach ($_REQUEST['deal_cate_type_id'] as $type) {
                 $data['deal_cate_type_id'][] = intval($type);
             }
             foreach ($_REQUEST['area_id'] as $area) {
                 $data['area_id'][] = intval($area);
             }
             $data['address'] = strim($_REQUEST['address']);
             $data['xpoint'] = doubleval($_REQUEST['xpoint']);
             $data['ypoint'] = doubleval($_REQUEST['ypoint']);
             $data['tel'] = strim($_REQUEST['tel']);
             $data['open_time'] = strim($_REQUEST['open_time']);
             $data['location_id'] = 0;
             $data['city_id'] = intval($_REQUEST['city_id']);
         } else {
             app_redirect(url("biz", "user#register"));
         }
         $GLOBALS['tmpl']->assign("base_data", base64_encode(serialize($data)));
         $user_id = intval($GLOBALS['user_info']['id']);
         if ($user_id) {
             $GLOBALS['tmpl']->assign("user_info", $GLOBALS['user_info']);
         }
     } elseif ($step == 4) {
         $sid = $_REQUEST['sid'];
         if ($sid > 0) {
             $supplier_data = $GLOBALS['db']->getRow("SELECT * FROM " . DB_PREFIX . "supplier_submit WHERE id=" . $sid);
             $supplier_data['h_bank_info'] = preg_replace("/(\\d{4})(?=\\d)/", "\$1 ", $supplier_data['h_bank_info']);
             $GLOBALS['tmpl']->assign("supplier_data", $supplier_data);
         }
     }
     $GLOBALS['tmpl']->assign("sms_lesstime", load_sms_lesstime());
     $GLOBALS['tmpl']->assign("sms_ipcount", load_sms_ipcount());
     $GLOBALS['tmpl']->assign("step", $step);
     $GLOBALS['tmpl']->display("register.html");
 }
 public function index()
 {
     $root = array();
     $root['response_code'] = 1;
     $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'];
     }
     $GLOBALS['tmpl']->assign("artilce_cate", $artilce_cate);
     $temp_artilce_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 order by update_time asc");
     $hot_article = array();
     $week_article = array();
     $artilce_item = array();
     foreach ($temp_artilce_list as $k => $v) {
         //最新智能头条 type_id==0帮助文章,is_hot==1热门,is_week==1本周必读
         if ($v['type_id'] == 0 && $v['is_delete'] == 0 && $v['is_effect'] == 1) {
             $artilce_item[$k]['cate_title'] = $v['title'];
             $artilce_item[$k]['seo_keyword'] = $v['seo_keyword'];
             $artilce_item[$k]['title'] = $v['title'];
             $artilce_item[$k]['content'] = $v['content'];
             $artilce_item[$k]['update_time'] = $v['update_time'];
             if ($v['rel_url'] == "") {
                 $artilce_item[$k]['url'] = url('article', array('id' => $v['id']));
             } else {
                 $artilce_item[$k]['url'] = $v['rel_url'];
             }
         }
         //热门话题
         if ($v['is_hot'] == 1 && ($v['is_effect'] = 1 && $v['is_delete'] == 0 && $v['type_id'] == 0)) {
             $hot_article[$k]['title'] = $v['title'];
             if ($v['rel_url'] == "") {
                 $hot_article[$k]['url'] = url('article', array('id' => $v['id']));
             } else {
                 $hot_article[$k]['url'] = $v['rel_url'];
             }
         }
         //每周必读
         if ($v['is_week'] == 1 && $v['is_effect'] == 1 && $v['is_delete'] == 0 && $v['type_id'] == 0) {
             $week_article[$k]['title'] = $v['title'];
             if ($v['rel_url'] == "") {
                 $week_article[$k]['url'] = url('article', array('id' => $v['id']));
             } else {
                 $week_article[$k]['url'] = $v['rel_url'];
             }
         }
     }
     unset($temp_artilce_list);
     $root['artilce_list'] = $artilce_item;
     $root['hot_1'] = $hot_article;
     $root['hot_2'] = $week_article;
     output($root);
 }
Esempio n. 21
0
 public function index()
 {
     global_run();
     init_app_page();
     $GLOBALS['tmpl']->assign("no_nav", true);
     //无分类下拉
     if (check_save_login() != LOGIN_STATUS_LOGINED) {
         app_redirect(url("index", "user#login"));
     }
     $GLOBALS['tmpl']->assign("page_title", "我的点评");
     assign_uc_nav_list();
     //begin review
     require_once APP_ROOT_PATH . "system/model/review.php";
     require_once APP_ROOT_PATH . "app/Lib/page.php";
     //分页
     $page_size = 10;
     $page = intval($_REQUEST['p']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * $page_size . "," . $page_size;
     $dp_res = get_dp_list($limit, "", " user_id = " . $GLOBALS['user_info']['id']);
     $dp_list = $dp_res['list'];
     $total = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "supplier_location_dp  where " . $dp_res['condition']);
     $page = new Page($total, $page_size);
     //初始化分页对象
     $p = $page->show();
     $GLOBALS['tmpl']->assign('pages', $p);
     foreach ($dp_list as $k => $v) {
         if ($v['deal_id'] > 0) {
             $data_info = load_auto_cache("deal", array("id" => $v['deal_id']));
         } elseif ($v['youhui_id'] > 0) {
             $data_info = load_auto_cache("youhui", array("id" => $v['youhui_id']));
         } elseif ($v['event_id'] > 0) {
             $data_info = load_auto_cache("event", array("id" => $v['event_id']));
         }
         if (empty($data_info)) {
             $data_info = load_auto_cache("store", array("id" => $v['supplier_location_id']));
         }
         $dp_list[$k]['data_info'] = $data_info;
     }
     $GLOBALS['tmpl']->assign('dp_list', $dp_list);
     require_once APP_ROOT_PATH . "system/model/topic.php";
     global $no_lazy;
     $no_lazy = true;
     $review_html = decode_topic_without_img($GLOBALS['tmpl']->fetch("inc/uc_review_list.html"));
     $GLOBALS['tmpl']->assign("review_html", $review_html);
     //end review
     $no_lazy = false;
     $GLOBALS['tmpl']->display("uc/uc_review_index.html");
 }
Esempio n. 22
0
 public function index()
 {
     $title = $GLOBALS['lang']['GROUP_FORUM'];
     $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => APP_ROOT . "/");
     $site_nav[] = array('name' => $title, 'url' => url("shop", "group"));
     $GLOBALS['tmpl']->assign("site_nav", $site_nav);
     $GLOBALS['tmpl']->assign("page_title", $title);
     $GLOBALS['tmpl']->assign("page_keyword", $title . ",");
     $GLOBALS['tmpl']->assign("page_description", $title . ",");
     $cate_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "topic_group_cate where id = " . intval($_REQUEST['id']));
     $cate_id = intval($cate_item['id']);
     $GLOBALS['tmpl']->assign("cate_id", $cate_id);
     //输出热门小组
     $hot_group = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "topic_group where is_effect = 1 order by topic_count desc,user_count desc limit 4");
     $GLOBALS['tmpl']->assign("hot_group", $hot_group);
     //输出分类列表
     $cate_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "topic_group_cate where is_effect = 1 order by sort desc");
     $GLOBALS['tmpl']->assign("cate_list", $cate_list);
     //输出优秀小组长
     $group_adm_list = $GLOBALS['db']->getAll("select id,name,user_count,user_id from " . DB_PREFIX . "topic_group  where is_effect = 1 and user_id <> 0 group by user_id order by topic_count desc limit 5");
     $GLOBALS['tmpl']->assign("group_adm_list", $group_adm_list);
     $page_size = 20;
     $page = intval($_REQUEST['p']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * $page_size . "," . $page_size;
     if ($cate_id > 0) {
         $cate_condition = " and cate_id = " . $cate_id;
     }
     $sql = " select * from " . DB_PREFIX . "topic_group where is_effect = 1 {$cate_condition} order by sort desc limit " . $limit;
     $sql_count = "select count(*) from " . DB_PREFIX . "topic_group where is_effect = 1 {$cate_condition} ";
     $list = $GLOBALS['db']->getAll($sql);
     $count = $GLOBALS['db']->getOne($sql_count);
     $GLOBALS['tmpl']->assign("list", $list);
     $page = new Page($count, $page_size);
     //初始化分页对象
     $p = $page->show();
     $GLOBALS['tmpl']->assign('pages', $p);
     //输出最新主题
     $new_topic_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "topic where group_id <> 0 and is_effect = 1 and is_delete = 0 order by create_time desc limit 10");
     foreach ($new_topic_list as $k => $v) {
         $new_topic_list[$k]['group_name'] = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "topic_group where id = " . $v['group_id']);
     }
     $GLOBALS['tmpl']->assign('new_topic_list', $new_topic_list);
     //输出推荐的主题
     $rec_topic_list = load_auto_cache("recommend_forum_topic");
     $GLOBALS['tmpl']->assign("rec_topic_list", $rec_topic_list);
     $GLOBALS['tmpl']->display("group_index.html");
 }
Esempio n. 23
0
function get_supplier_list($limit, $cate_id = 0, $city_id = 0, $where = '')
{
    $condition = " is_effect = 1 ";
    if ($cate_id > 0) {
        $ids = load_auto_cache("deal_sub_parent_cate_ids", array("cate_id" => $cate_id));
        $condition .= " and cate_id in (" . implode(",", $ids) . ")";
    }
    if ($city_id == 0) {
        $city = get_current_deal_city();
        $city_id = $city['id'];
    }
    if ($city_id > 0) {
        $ids = load_auto_cache("deal_city_belone_ids", array("city_id" => $city_id));
        if ($ids) {
            $condition .= " and city_id in (" . implode(",", $ids) . ")";
        }
    }
    if ($where != '') {
        $condition .= " and " . $where;
    }
    $sql = "select * from " . DB_PREFIX . "supplier where " . $condition . " order by sort desc limit " . $limit;
    $count_sql = "select count(*) from " . DB_PREFIX . "supplier where " . $condition;
    $suppliers = $GLOBALS['db']->getAll($sql);
    $suppliers_count = $GLOBALS['db']->getOne($count_sql);
    foreach ($suppliers as $k => $v) {
        $suppliers[$k]['url'] = url("shop", "brand", array("id" => $v['id']));
        $main_location = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_location where supplier_id = " . $v['id'] . " and is_main = 1");
        $suppliers[$k]['tel'] = $main_location['tel'];
        $suppliers[$k]['address'] = $main_location['address'];
        $suppliers[$k]['contact'] = $main_location['contact'];
        $suppliers[$k]['brief'] = $main_location['brief'];
        $suppliers[$k]['deal_count'] = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal where supplier_id = " . $v['id'] . " and is_effect = 1 and is_delete = 0 and buy_type <> 1 and time_status > 0");
        $max_price = $GLOBALS['db']->getOne("select max(current_price) from " . DB_PREFIX . "deal where supplier_id = " . $v['id'] . " and is_effect = 1 and is_delete = 0 and buy_type <> 1");
        $min_price = $GLOBALS['db']->getOne("select min(current_price) from " . DB_PREFIX . "deal where supplier_id = " . $v['id'] . " and is_effect = 1 and is_delete = 0 and buy_type <> 1");
        if ($max_price == $min_price) {
            $suppliers[$k]['deal_price'] = format_price($max_price);
        } else {
            $suppliers[$k]['deal_price'] = format_price($min_price) . " - " . format_price($max_price);
        }
        $suppliers[$k]['comment_count'] = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "message where rel_table='supplier' and rel_id = " . $v['id']);
        $suppliers[$k]['comment1_count'] = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "message where rel_table='supplier' and rel_id = " . $v['id'] . " and point = 1");
        //差
        $suppliers[$k]['comment2_count'] = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "message where rel_table='supplier' and rel_id = " . $v['id'] . " and point = 2");
        //中
        $suppliers[$k]['comment3_count'] = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "message where rel_table='supplier' and rel_id = " . $v['id'] . " and point = 3");
        //好
    }
    return array('list' => $suppliers, 'count' => $suppliers_count);
}
Esempio n. 24
0
 function index()
 {
     $GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['UC_AUTO_BID']);
     $deal_cates = load_auto_cache("cache_deal_cate");
     $GLOBALS['tmpl']->assign("deal_cates", $deal_cates);
     $autobid = $GLOBALS['db']->getRow("SELECT * FROM " . DB_PREFIX . "user_autobid WHERE user_id = '" . $GLOBALS['user_info']['id'] . "'");
     $autobid['deal_cates'] = explode(",", $autobid['deal_cates']);
     $GLOBALS['tmpl']->assign("autobid", $autobid);
     $level = $GLOBALS['db']->getAll("SELECT * FROM " . DB_PREFIX . "user_level order by id \tASC");
     $GLOBALS['tmpl']->assign("min_level", $level);
     rsort($level);
     $GLOBALS['tmpl']->assign("max_level", $level);
     $GLOBALS['tmpl']->assign("inc_file", "inc/uc/uc_autobid.html");
     $GLOBALS['tmpl']->display("page/uc.html");
 }
Esempio n. 25
0
 public function register()
 {
     $GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['USER_REGISTER']);
     $field_list = load_auto_cache("user_field_list");
     $api_uinfo = es_session::get("api_user_info");
     $GLOBALS['tmpl']->assign("reg_name", $api_uinfo['name']);
     $GLOBALS['tmpl']->assign("field_list", $field_list);
     $GLOBALS['tmpl']->assign("agreement", app_conf("AGREEMENT"));
     $GLOBALS['tmpl']->assign("privacy", app_conf("PRIVACY"));
     $referer = "";
     if (isset($_REQUEST['r'])) {
         $referer = strim(base64_decode($_REQUEST['r']));
     }
     $GLOBALS['tmpl']->assign("referer", $referer);
     $GLOBALS['tmpl']->display("user_register.html");
 }
 function add()
 {
     $GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['UC_AUTO_BID']);
     $deal_cates = load_auto_cache("cache_deal_cate");
     $GLOBALS['tmpl']->assign("deal_cates", $deal_cates);
     $level_list = load_auto_cache("level");
     $range_date = array();
     $rate_list = array();
     foreach ($level_list['repaytime_list'] as $k => $v) {
         foreach ($v as $kk => $vv) {
             if ($vv[1] == 1) {
                 $range_date[(int) $vv[0]] = $vv[0];
             }
             $rate_list[(int) $vv[2]] = $vv[2];
             $rate_list[(int) $vv[3]] = $vv[3];
         }
     }
     asort($range_date);
     sort($range_date);
     $GLOBALS['tmpl']->assign("min_date", $range_date);
     rsort($range_date);
     $GLOBALS['tmpl']->assign("max_date", $range_date);
     asort($rate_list);
     sort($rate_list);
     $rateinfo = $GLOBALS['db']->getRowCached("SELECT max(rate) as max_rate,min(rate) as min_rate FROM " . DB_PREFIX . "deal ");
     if ((double) $rateinfo['max_rate'] > (int) max($rate_list)) {
         $rate_list[] = intval($rateinfo['max_rate']);
     }
     if ((double) $rateinfo['min_rate'] < (int) min($rate_list)) {
         $rate_list[0] = intval($rateinfo['min_rate']);
     }
     $GLOBALS['tmpl']->assign("min_rate", $rate_list);
     rsort($rate_list);
     $GLOBALS['tmpl']->assign("max_rate", $rate_list);
     if ($id = intval($_REQUEST['id'])) {
         $autobid = $GLOBALS['db']->getRow("SELECT * FROM " . DB_PREFIX . "user_autobid WHERE id = {$id}");
         $autobid['deal_cates'] = explode(",", $autobid['deal_cates']);
     }
     $GLOBALS['tmpl']->assign("autobid", $autobid);
     $level = $level_list['list'];
     $GLOBALS['tmpl']->assign("max_level", $level);
     krsort($level);
     $GLOBALS['tmpl']->assign("min_level", $level);
     $GLOBALS['tmpl']->assign("inc_file", "inc/uc/uc_autobid.html");
     $GLOBALS['tmpl']->display("page/uc.html");
 }
Esempio n. 27
0
/**
 * 获取正在进行的投标列表
 */
function get_deal_list($limit = "", $cate_id = 0, $where = '', $orderby = '', $user_name = '', $user_pwd = '', $is_all = false)
{
    $time = TIME_UTC;
    $count_sql = "select count(*) from " . DB_PREFIX . "deal where 1=1 ";
    if ($is_all == false) {
        $count_sql .= " and is_effect = 1 and is_delete = 0 ";
    }
    if (es_cookie::get("shop_sort_field") == "ulevel") {
        $extfield = ",(SELECT u.level_id FROM fanwe_user u WHERE u.id=user_id ) as ulevel";
    }
    $sql = "select *,start_time as last_time,(load_money/borrow_amount*100) as progress_point,(start_time + enddate*24*3600 - " . $time . ") as remain_time {$extfield} from " . DB_PREFIX . "deal where 1 = 1 ";
    if ($is_all == false) {
        $sql .= " and is_effect = 1 and is_delete = 0 ";
    }
    if ($cate_id > 0) {
        $ids = load_auto_cache("deal_sub_parent_cate_ids", array("cate_id" => $cate_id));
        $sql .= " and cate_id in (" . implode(",", $ids) . ")";
        $count_sql .= " and cate_id in (" . implode(",", $ids) . ")";
    }
    if ($where != '') {
        $sql .= " and " . $where;
        $count_sql .= " and " . $where;
    }
    if ($orderby == '') {
        $sql .= " order by sort desc ";
    } else {
        $sql .= " order by " . $orderby;
    }
    if ($limit != "") {
        $sql .= " limit " . $limit;
    }
    $deals_count = $GLOBALS['db']->getOne($count_sql);
    if ($deals_count > 0) {
        $deals = $GLOBALS['db']->getAll($sql);
        //echo $sql;
        if ($deals) {
            foreach ($deals as $k => $deal) {
                format_deal_item($deal, $user_name, $user_pwd);
                $deals[$k] = $deal;
            }
        }
    } else {
        $deals = array();
    }
    return array('list' => $deals, 'count' => $deals_count);
}
Esempio n. 28
0
 public function __construct($appId = "", $appSecret = "")
 {
     $this->appId = $appId;
     $this->appSecret = $appSecret;
     $weixin_conf = load_auto_cache("weixin_conf");
     if ($weixin_conf['platform_status']) {
         $this->is_platform = 1;
         $this->component_appid = $weixin_conf['platform_appid'];
         $this->component_access_token = $weixin_conf['platform_component_access_token'];
         $this->option = array('platform_token' => $weixin_conf['platform_token'], 'platform_encodingAesKey' => $weixin_conf['platform_encodingAesKey'], 'platform_appid' => $weixin_conf['platform_appid'], 'platform_appsecret' => $weixin_conf['platform_appsecret'], 'platform_component_verify_ticket' => $weixin_conf['platform_component_verify_ticket'], 'platform_component_access_token' => $weixin_conf['platform_component_access_token'], 'platform_pre_auth_code' => $weixin_conf['platform_pre_auth_code'], 'platform_component_access_token_expire' => $weixin_conf['platform_component_access_token_expire'], 'platform_pre_auth_code_expire' => $weixin_conf['platform_pre_auth_code_expire'], 'logcallback' => 'log_result', 'debug' => true);
         $this->platform = new PlatformWechat($this->option);
         $new_token = $this->platform->check_platform_access_token();
         if ($new_token != $this->component_access_token) {
             $this->component_access_token = $new_token;
         }
     }
 }
Esempio n. 29
0
 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']);
         $lottery = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "lottery where id = " . $id . " and user_id = " . $GLOBALS['user_info']['id']);
         $deal = load_auto_cache("deal", array("id" => $lottery['deal_id']));
         if ($lottery) {
             if ($t == "sms") {
                 if (app_conf("SMS_ON") == 0 || app_conf("LOTTERY_SN_SMS") == 0) {
                     $data['status'] = 0;
                     $data['info'] = "不支持短信发送";
                     ajax_return($data);
                 } elseif ($lottery['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_lottery_sms($id);
                     $GLOBALS['db']->query("update " . DB_PREFIX . "lottery 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);
         }
     }
 }
Esempio n. 30
0
 public function daijin_index()
 {
     $GLOBALS['tmpl']->caching = true;
     $GLOBALS['tmpl']->cache_lifetime = 600;
     //代金券首页缓存10分钟
     $cache_id = md5(MODULE_NAME . ACTION_NAME . $GLOBALS['deal_city']['id']);
     if (!$GLOBALS['tmpl']->is_cached('daijin_index.html', $cache_id)) {
         make_deal_cate_js();
         make_deal_region_js();
         $result = load_auto_cache("byouhui_filter_nav_cache", array('city_id' => $GLOBALS['deal_city']['id']));
         $GLOBALS['tmpl']->assign("cate_list", $result['cate_list']);
         $GLOBALS['tmpl']->assign("area_list", $result['area_list']);
         //输出右侧的优惠列表
         $result = search_youhui_list(5, 0, "", "", false, "", $GLOBALS['deal_city']['id']);
         $daijin_list = $result['list'];
         $GLOBALS['tmpl']->assign("daijin_list", $daijin_list);
         $right_daijin_html = $GLOBALS['tmpl']->fetch("index/index_right_daijin.html");
         $GLOBALS['tmpl']->assign("right_daijin_html", $right_daijin_html);
         //输出右侧商家
         $city_ids = load_auto_cache("deal_city_belone_ids", array("city_id" => intval($GLOBALS['deal_city']['id'])));
         if ($city_ids) {
             $store_list = $GLOBALS['db']->getAll("SELECT * FROM " . DB_PREFIX . "supplier_location use index(avg_point) WHERE  city_id in(" . implode(",", $city_ids) . ") and is_effect = 1 order by avg_point desc limit 5");
         } else {
             $store_list = $GLOBALS['db']->getAll("SELECT * FROM " . DB_PREFIX . "supplier_location use index(avg_point) WHERE  is_effect = 1 order by avg_point desc limit 5");
         }
         $GLOBALS['tmpl']->assign("store_list", $store_list);
         $right_store_html = $GLOBALS['tmpl']->fetch("index/index_right_store.html");
         $GLOBALS['tmpl']->assign("right_store_html", $right_store_html);
         //输出左侧推荐分类
         $recommend_cate = $GLOBALS['db']->getAll("select id,name from " . DB_PREFIX . "deal_cate where rec_daijin = 1 order by sort desc");
         $recommend_cate_html = "";
         foreach ($recommend_cate as $cate) {
             $daijin_list = search_youhui_list(8, $cate['id'], "", "", false, "", $GLOBALS['deal_city']['id']);
             $daijin_list = $daijin_list['list'];
             $GLOBALS['tmpl']->assign("daijin_list", $daijin_list);
             $scate_list = $GLOBALS['db']->getAll("select t.* from " . DB_PREFIX . "deal_cate_type as t left join " . DB_PREFIX . "deal_cate_type_link as l on l.deal_cate_type_id = t.id where t.is_recommend = 1 and l.cate_id = " . $cate['id'] . " order by sort desc");
             $GLOBALS['tmpl']->assign("scate_list", $scate_list);
             $GLOBALS['tmpl']->assign("bcate_item", $cate);
             $recommend_cate_html .= $GLOBALS['tmpl']->fetch("inc/recommend_cate_daijin.html");
         }
         $GLOBALS['tmpl']->assign("recommend_cate_html", $recommend_cate_html);
     }
     $GLOBALS['tmpl']->display("daijin_index.html", $cache_id);
 }