예제 #1
0
 public function fav()
 {
     if (!$GLOBALS['user_info']) {
         app_redirect(url("user#login"));
     }
     $GLOBALS['tmpl']->assign("page_title", "我关注的项目动态");
     $cate_result = load_dynamic_cache("INDEX_CATE_LIST");
     if ($cate_result === false) {
         $cate_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate order by sort asc");
         $cate_result = array();
         foreach ($cate_list as $k => $v) {
             $cate_result[$v['id']] = $v;
         }
         set_dynamic_cache("INDEX_CATE_LIST", $cate_result);
     }
     $GLOBALS['tmpl']->assign("cate_list", $cate_result);
     $rand_deals = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal where is_delete = 0 and is_effect = 1 and begin_time < " . NOW_TIME . " and (end_time >" . NOW_TIME . " or end_time = 0) order by rand() limit 3");
     $GLOBALS['tmpl']->assign("rand_deals", $rand_deals);
     $page_size = DEALUPDATE_PAGE_SIZE;
     $step_size = DEALUPDATE_STEP_SIZE;
     $step = intval($_REQUEST['step']);
     if ($step == 0) {
         $step = 1;
     }
     $page = intval($_REQUEST['p']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * $page_size + ($step - 1) * $step_size . "," . $step_size;
     $GLOBALS['tmpl']->assign("current_page", $page);
     $sql = "select dl.* from " . DB_PREFIX . "deal_log as dl left join " . DB_PREFIX . "deal_focus_log as dfl on dl.deal_id = dfl.deal_id where dfl.user_id = " . intval($GLOBALS['user_info']['id']) . " order by dl.create_time desc limit " . $limit;
     $sql_count = "select count(*) from " . DB_PREFIX . "deal_log as dl left join " . DB_PREFIX . "deal_focus_log as dfl on dl.deal_id = dfl.deal_id where dfl.user_id = " . intval($GLOBALS['user_info']['id']);
     $log_list = $GLOBALS['db']->getAll($sql);
     $log_count = $GLOBALS['db']->getOne($sql_count);
     foreach ($log_list as $k => $v) {
         $log_list[$k]['pass_time'] = pass_date($v['create_time']);
         $online_time = online_date($v['create_time'], $deal_info['begin_time']);
         $log_list[$k]['online_time'] = $online_time['info'];
         $log_list[$k]['comment_count'] = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_comment where log_id = " . $v['id']);
         $log_list[$k]['comment_list'] = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_comment where log_id = " . $v['id'] . " order by create_time desc limit 3");
         if ($log_list[$k]['comment_count'] <= count($log_list[$k]['comment_list'])) {
             $log_list[$k]['more_comment'] = false;
         } else {
             $log_list[$k]['more_comment'] = true;
         }
         $log_list[$k]['deal_info'] = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id = " . $v['deal_id']);
         if ($log_list[$k]['deal_info']) {
             $log_list[$k]['deal_info']['remain_days'] = floor(($log_list[$k]['deal_info']['end_time'] - NOW_TIME) / (24 * 3600));
             $log_list[$k]['deal_info']['percent'] = round($log_list[$k]['deal_info']['support_amount'] / $log_list[$k]['deal_info']['limit_price'] * 100);
         }
     }
     $GLOBALS['tmpl']->assign('log_list', $log_list);
     $pager = new Page($log_count, $page_size);
     //初始化分页对象
     $p = $pager->show();
     $GLOBALS['tmpl']->assign('pages', $p);
     $GLOBALS['tmpl']->assign("ajaxurl", url("ajax#newsfav", array("p" => $page)));
     $GLOBALS['tmpl']->display("news.html");
 }
 public function index()
 {
     $image_list = load_dynamic_cache("INDEX_IMAGE_LIST");
     if ($image_list === false) {
         $image_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "index_image order by sort asc");
         set_dynamic_cache("INDEX_IMAGE_LIST", $image_list);
     }
     $GLOBALS['tmpl']->assign("image_list", $image_list);
     $cate_result = load_dynamic_cache("INDEX_CATE_LIST");
     if ($cate_result === false) {
         $cate_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate order by sort asc");
         $cate_result = array();
         foreach ($cate_list as $k => $v) {
             $cate_result[$v['id']] = $v;
         }
         set_dynamic_cache("INDEX_CATE_LIST", $cate_result);
     }
     $GLOBALS['tmpl']->assign("cate_list", $cate_result);
     $page_size = DEAL_PAGE_SIZE;
     $step_size = DEAL_STEP_SIZE;
     $step = intval($_REQUEST['step']);
     if ($step == 0) {
         $step = 1;
     }
     $page = intval($_REQUEST['p']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * $page_size + ($step - 1) * $step_size . "," . $step_size;
     $GLOBALS['tmpl']->assign("current_page", $page);
     $deal_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal where is_effect = 1 and is_recommend = 1 and is_delete = 0 order by sort asc limit " . $limit);
     //$deal_count = $GLOBALS['db']->getOne("select count(*) from ".DB_PREFIX."deal where is_effect = 1 and is_recommend = 1 and is_delete = 0");
     foreach ($deal_list as $k => $v) {
         $deal_list[$k]['remain_days'] = floor(($v['end_time'] - NOW_TIME) / (24 * 3600));
         $deal_list[$k]['percent'] = round($v['support_amount'] / $v['limit_price'] * 100);
     }
     $GLOBALS['tmpl']->assign("deal_list", $deal_list);
     //add by fjl begin
     //热门项目
     //add by fjl end
     //$page = new Page($deal_count,$page_size);   //初始化分页对象
     //$p  =  $page->show();
     //$GLOBALS['tmpl']->assign('pages',$p);
     $GLOBALS['tmpl']->display("index.html");
 }
예제 #3
0
 public function index()
 {
     $root = array();
     $page = intval($GLOBALS['request']['page']);
     // 分页
     $page = $page == 0 ? 1 : $page;
     $root['response_code'] = 1;
     $param = array();
     // 参数集合
     // 数据来源参数
     $r = strim($_REQUEST['r']);
     // 推荐类型
     $param['r'] = $r ? $r : '';
     $id = intval($_REQUEST['id']);
     // 分类id3
     $param['id'] = $id;
     // ios标志
     if ($id == 0) {
         $isAll = 1;
     } else {
         $isAll = 0;
     }
     $loc = strim($_REQUEST['loc']);
     // 地区
     $param['loc'] = $loc;
     $GLOBALS['tmpl']->assign("p_loc", $loc);
     $state = intval($_REQUEST['state']);
     // 状态1
     $param['state'] = $state;
     $tag = strim($_REQUEST['tag']);
     // 标签
     $param['tag'] = $tag;
     $GLOBALS['tmpl']->assign("p_tag", $tag);
     $kw = strim($_REQUEST['key']);
     // 关键词
     $param['kw'] = $kw;
     $cate_list = load_dynamic_cache("INDEX_CATE_LIST");
     if (!$cate_list) {
         $cate_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate order by sort asc");
         set_dynamic_cache("INDEX_CATE_LIST", $cate_list);
     }
     $cate_result = array();
     $cate_result[0]['id'] = '0';
     $cate_result[0]['name'] = "全部";
     foreach ($cate_list as $k => $v) {
         $temp_param = $param;
         $cate_result[$k + 1]['id'] = $v['id'];
         $cate_result[$k + 1]['name'] = $v['name'];
         $temp_param['id'] = $v['id'];
     }
     $root['cate_list'] = $cate_result;
     $pid = 0;
     // 获取父类id
     if ($cate_list) {
         foreach ($cate_list as $k => $v) {
             if ($v['id'] == $id) {
                 if ($v['pid'] > 0) {
                     $pid = $v['pid'];
                 } else {
                     $pid = $id;
                 }
             }
         }
     }
     /* 子分类 start */
     $cate_ids = array();
     $is_has_child = false;
     $temp_cate_ids = array();
     if ($cate_list) {
         $child_cate_result = array();
         foreach ($cate_list as $k => $v) {
             if ($v['pid'] == $pid) {
                 if ($v['pid'] > 0) {
                     $temp_param = $param;
                     $child_cate_result[$v['id']]['id'] = $v['id'];
                     $child_cate_result[$v['id']]['name'] = $v['name'];
                     $temp_param['id'] = $v['id'];
                     $child_cate_result[$v['id']]['url'] = url_mapi("deals", $temp_param);
                     if ($v['id'] == $id) {
                         $is_has_child = true;
                     }
                 }
             }
             if ($v['pid'] == $pid || $pid == 0) {
                 $temp_cate_ids[] = $v['id'];
             }
         }
     }
     // 假如选择了子类 那么使用子类ID 否则使用 父类和其子类
     if ($is_has_child) {
         $cate_ids[] = $id;
     } else {
         $cate_ids[] = $pid;
         $cate_ids = array_merge($cate_ids, $temp_cate_ids);
     }
     $root['child_cate_list'] = $child_cate_result;
     $root['pid'] = $pid;
     /* 子分类 end */
     $city_list = load_dynamic_cache("INDEX_CITY_LIST");
     if (!$city_list) {
         $city_list = $GLOBALS['db']->getAll("select province from " . DB_PREFIX . "deal group by province order by sort asc");
         set_dynamic_cache("INDEX_CITY_LIST", $city_list);
     }
     foreach ($city_list as $k => $v) {
         $temp_param = $param;
         $temp_param['loc'] = $v['province'];
         $city_list[$k]['url'] = url_mapi("deals", $temp_param);
     }
     $root['city_list'] = $city_list;
     $state_list = array(0 => array("name" => "全部"), 1 => array("name" => "筹资成功"), 2 => array("name" => "筹资失败"), 3 => array("name" => "筹资中"));
     foreach ($state_list as $k => $v) {
         $temp_param = $param;
         $temp_param['state'] = $k;
         $state_list[$k]['url'] = url_mapi("deals", $temp_param);
     }
     $root['state_list'] = $state_list;
     $page_size = $GLOBALS['m_config']['page_size'];
     $page = intval($_REQUEST['p']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * $page_size . "," . $page_size;
     $condition = " is_delete = 0 and is_effect = 1 ";
     if ($r != "") {
         if ($r == "new") {
             $condition .= " and " . NOW_TIME . " - begin_time < " . 24 * 3600 . " and " . NOW_TIME . " - begin_time > 0 ";
             // 上线不超过一天
             $GLOBALS['tmpl']->assign("page_title", "最新上线");
         }
         if ($r == "rec") {
             $condition .= " and " . NOW_TIME . " <= end_time AND " . NOW_TIME . " >= begin_time and is_recommend = 1 ";
             $GLOBALS['tmpl']->assign("page_title", "推荐项目");
         }
         if ($r == "yure") {
             $condition .= " and " . NOW_TIME . " - begin_time < " . 24 * 3600 . " and " . NOW_TIME . " - begin_time <  0 ";
             // 上线不超过一天
             $GLOBALS['tmpl']->assign("page_title", "正在预热");
         }
         if ($r == "nend") {
             $condition .= " and end_time - " . NOW_TIME . " < " . 24 * 3600 . " and end_time - " . NOW_TIME . " > 0 ";
             // 当天就要结束
             $GLOBALS['tmpl']->assign("page_title", "即将结束");
         }
         if ($r == "classic") {
             $condition .= " and is_classic = 1 ";
             $GLOBALS['tmpl']->assign("page_title", "经典项目");
         }
         if ($r == "limit_price") {
             $condition .= " and max(limit_price) ";
             $GLOBALS['tmpl']->assign("page_title", "最高目标金额");
         }
     }
     switch ($state) {
         // 筹资中
         case 0:
             $GLOBALS['tmpl']->assign("page_title", "全部");
             break;
             // 筹资成功
         // 筹资成功
         case 1:
             $condition .= " and end_time < " . NOW_TIME . "  and support_amount >= limit_price";
             $GLOBALS['tmpl']->assign("page_title", "筹资成功");
             break;
             // 筹资失败
         // 筹资失败
         case 2:
             $condition .= " and end_time < " . NOW_TIME . "  and  support_amount < limit_price ";
             $GLOBALS['tmpl']->assign("page_title", "筹资失败");
             break;
             // 筹资中
         // 筹资中
         case 3:
             $condition .= " and end_time > " . NOW_TIME . "  and begin_time < " . NOW_TIME . " ";
             $GLOBALS['tmpl']->assign("page_title", "筹资中");
             break;
     }
     if (count($cate_ids) > 0) {
         $condition .= " and cate_id in (" . implode(",", $cate_ids) . ")";
         $GLOBALS['tmpl']->assign("page_title", $cate_result[$id]['name']);
     }
     if ($loc != "") {
         $condition .= " and (province = '" . $loc . "' or city = '" . $loc . "') ";
         $GLOBALS['tmpl']->assign("page_title", $loc);
     }
     if ($tag != "") {
         $unicode_tag = str_to_unicode_string($tag);
         $condition .= " and match(tags_match) against('" . $unicode_tag . "'  IN BOOLEAN MODE) ";
         $GLOBALS['tmpl']->assign("page_title", $tag);
     }
     if ($kw != "") {
         $kws_div = div_str($kw);
         foreach ($kws_div as $k => $item) {
             $kws[$k] = str_to_unicode_string($item);
         }
         $ukeyword = implode(" ", $kws);
         $condition .= " and (match(name_match) against('" . $ukeyword . "'  IN BOOLEAN MODE) or match(tags_match) against('" . $ukeyword . "'  IN BOOLEAN MODE)  or name like '%" . $kw . "%') ";
         $GLOBALS['tmpl']->assign("page_title", $kw);
     }
     // 权限浏览控制
     if ($GLOBALS['user_info']['user_level'] != 0) {
         $condition .= " AND (user_level ='' or user_level=0 or user_level <=" . $GLOBALS['user_info']['user_level'] . ") ";
     } else {
         $condition .= " AND (user_level =0 or user_level =1 or user_level ='') ";
     }
     $deal_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal where " . $condition);
     /* (所需项目)准备虚拟数据 start */
     $deal_list = array();
     if ($deal_count > 0) {
         $now_time = get_gmtime();
         // $deal_list = $GLOBALS['db']->getAll("select * from
         // ".DB_PREFIX."deal where ".$condition." order by sort asc ");
         $deal_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal where " . $condition . " order by sort asc limit " . $limit);
         $deal_ids = array();
         foreach ($deal_list as $k => $v) {
             // $deal_list['percent'] =
             // round($deal_list['support_amount']/$deal_list['limit_price']*100);
         }
         // 获取当前项目列表下的所有子项目
         $temp_virtual_person_list = $GLOBALS['db']->getAll("select deal_id,virtual_person,price from " . DB_PREFIX . "deal_item where deal_id in(" . implode(",", $deal_ids) . ") ");
         $virtual_person_list = array();
         // 重新组装一个以项目ID为KEY的 统计所有的虚拟人数和虚拟价格
         foreach ($temp_virtual_person_list as $k => $v) {
             $virtual_person_list[$v['deal_id']]['total_virtual_person'] += $v['virtual_person'];
             $virtual_person_list[$v['deal_id']]['total_virtual_price'] += $v['price'] * $v['virtual_person'];
         }
         unset($temp_virtual_person_list);
         // 将获取到的虚拟人数和虚拟价格拿到项目列表里面进行统计
         foreach ($deal_list as $k => $v) {
             $deal_list[$k]['virtual_person'] = $virtual_person_list[$v['id']]['total_virtual_person'];
             $deal_list[$k]['percent'] = round(($v['support_amount'] + $virtual_person_list[$v['id']]['total_virtual_price']) / $v['limit_price'] * 100);
             $deal_list[$k]['support_count'] += $deal_list[$k]['virtual_person'];
             $deal_list[$k]['support_amount'] += $virtual_person_list[$v['id']]['total_virtual_price'];
             /*
              *
              * $deal_list[$k]['description']=get_abs_img_root(get_spec_image($v['description'],640,240,1));
              * $deal_list[$k]['content']=get_abs_img_root(get_spec_image($v['description'],640,240,1));
              * $deal_list[$k]['content_1']=get_abs_img_root(get_spec_image($v['description_1'],640,240,1));
              * $deal_list[$k]['deal_extra_cache']=null;
              */
             $deal_list[$k]['image'] = get_abs_img_root(get_spec_image($v['image'], 640, 240, 1));
             if ($v['end_time'] > 0 && $v['end_time'] > $now_time) {
                 $deal_list[$k]['remain_days'] = floor(($v['end_time'] - $now_time) / (24 * 3600));
             } elseif ($v['end_time'] > 0 && $v['end_time'] <= $now_time) {
                 $deal_list[$k]['remain_days'] = 0;
             }
             if ($v['begin_time'] > $now_time) {
                 $deal_list[$k]['left_days'] = intval(($now_time - $v['create_time']) / 24 / 3600);
             } else {
                 $deal_list[$k]['left_days'] = 0;
             }
             $deal_list[$k]['num_days'] = floor(($v['end_time'] - $v['begin_time']) / (24 * 3600));
             // $deal_list[$k]['status']值0表示即将开始;1表示已成功;2表示筹资失败;3表示筹资中;4表示长期项目
             if ($v['begin_time'] > $now_time) {
                 $deal_list[$k]['status'] = '0';
             } elseif ($v['end_time'] < $now_time && $v['end_time'] > 0) {
                 if ($deal_list[$k]['percent'] >= 100) {
                     $deal_list[$k]['status'] = '1';
                 } else {
                     if ($deal_list[$k]['percent'] >= 0) {
                         $deal_list[$k]['status'] = '2';
                     }
                 }
             } else {
                 if ($v['end_time'] > 0) {
                     if ($deal_list[$k]['percent'] >= 100) {
                         $deal_list[$k]['status'] = '1';
                     } else {
                         $deal_list[$k]['status'] = '3';
                     }
                 } else {
                     $deal_list[$k]['status'] = '4';
                 }
             }
             $deal_list[$k]['end_time'] = to_date($v['end_time'], 'Y-m-d');
             $deal_list[$k]['begin_time'] = to_date($v['begin_time'], 'Y-m-d');
             $deal_list[$k]['create_time'] = to_date($v['create_time'], 'Y-m-d');
             $deal_ids[] = $v['id'];
             // 查询出对应项目id的user_level
             $deal_list[$k]['deal_level'] = $GLOBALS['db']->getOne("select level from " . DB_PREFIX . "deal_level where id=" . intval($deal_list[$k]['user_level']));
         }
     }
     /* (所需项目)准备虚拟数据 end */
     $root['isAll'] = $isAll;
     $root['deal_list'] = $deal_list;
     $root['deal_count'] = $deal_count;
     $root['page'] = array("page" => $page, "page_total" => ceil($deal_count / $page_size), "page_size" => intval($page_size), 'total' => intval($deal_count));
     output($root);
 }
 public function savesetting()
 {
     if ($GLOBALS['user_info']['id'] > 0) {
         $data['user_id'] = intval($GLOBALS['user_info']['id']);
         $data['mail_asked'] = intval($_REQUEST['mail_asked']);
         $data['sms_asked'] = intval($_REQUEST['sms_asked']);
         $data['mail_bid'] = intval($_REQUEST['mail_bid']);
         $data['sms_bid'] = intval($_REQUEST['sms_bid']);
         $data['mail_myfail'] = intval($_REQUEST['mail_myfail']);
         $data['sms_myfail'] = intval($_REQUEST['sms_myfail']);
         $data['mail_half'] = intval($_REQUEST['mail_half']);
         $data['sms_half'] = intval($_REQUEST['sms_half']);
         $data['mail_bidsuccess'] = intval($_REQUEST['mail_bidsuccess']);
         $data['sms_bidsuccess'] = intval($_REQUEST['sms_bidsuccess']);
         $data['mail_fail'] = intval($_REQUEST['mail_fail']);
         $data['sms_fail'] = intval($_REQUEST['sms_fail']);
         $data['mail_bidrepaid'] = intval($_REQUEST['mail_bidrepaid']);
         $data['sms_bidrepaid'] = intval($_REQUEST['sms_bidrepaid']);
         $data['mail_answer'] = intval($_REQUEST['mail_answer']);
         $data['sms_answer'] = intval($_REQUEST['sms_answer']);
         $data['mail_transferfail'] = intval($_REQUEST['mail_transferfail']);
         $data['sms_transferfail'] = intval($_REQUEST['sms_transferfail']);
         $data['mail_transfer'] = intval($_REQUEST['mail_transfer']);
         $data['sms_transfer'] = intval($_REQUEST['sms_transfer']);
         if ($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "msg_conf where user_id = " . $data['user_id']) == 0) {
             //添加
             $GLOBALS['db']->autoExecute(DB_PREFIX . "msg_conf", $data, "INSERT");
         } else {
             //编辑
             $GLOBALS['db']->autoExecute(DB_PREFIX . "msg_conf", $data, "UPDATE", "user_id=" . $data['user_id']);
         }
         $key = md5("USER_MSG_CONF_" . $data['user_id']);
         //更新配置缓存
         set_dynamic_cache($key, $data);
         showSuccess($GLOBALS['lang']['MESSAGE_POST_SUCCESS']);
     } else {
         app_redirect(url("index", "user#login"));
     }
 }
예제 #5
0
function url($app_index, $route = "index", $param = array())
{
    $key = md5("URL_KEY_" . $app_index . $route . serialize($param));
    if ($GLOBALS['request']['from'] != "wap") {
        if (isset($GLOBALS[$key])) {
            $url = $GLOBALS[$key];
            return $url;
        }
        $url = load_dynamic_cache($key);
        if ($url !== false) {
            $GLOBALS[$key] = $url;
            return $url;
        }
    }
    $route_array = explode("#", $route);
    if (isset($param) && $param != '' && !is_array($param)) {
        $param['id'] = $param;
    }
    $module = strtolower(trim($route_array[0]));
    $action = strtolower(trim($route_array[1]));
    if (!$module || $module == 'index') {
        $module = "";
    }
    if (!$action || $action == 'index') {
        $action = "";
    }
    if (app_conf("URL_MODEL") == 0 || $GLOBALS['request']['from'] == "wap") {
        //过滤主要的应用url
        if ($app_index == app_conf("MAIN_APP")) {
            $app_index = "index";
        }
        //原始模式
        $url = APP_ROOT . "/" . $app_index . ".php";
        if ($module != '' || $action != '' || count($param) > 0) {
            $url .= "?";
        }
        if ($module && $module != '') {
            $url .= "ctl=" . $module . "&";
        }
        if ($action && $action != '') {
            $url .= "act=" . $action . "&";
        }
        if (count($param) > 0) {
            foreach ($param as $k => $v) {
                if ($k && $v) {
                    $url = $url . $k . "=" . urlencode($v) . "&";
                }
            }
        }
        if (substr($url, -1, 1) == '&' || substr($url, -1, 1) == '?') {
            $url = substr($url, 0, -1);
        }
        if ($GLOBALS['request']['from'] != "wap") {
            $GLOBALS[$key] = $url;
            set_dynamic_cache($key, $url);
        }
        return $url;
    } else {
        //重写的默认
        $url = APP_ROOT;
        if ($app_index != 'index') {
            $url .= "/" . $app_index;
        }
        if ($module && $module != '') {
            $url .= "/" . $module;
        }
        if ($action && $action != '') {
            $url .= "-" . $action;
        }
        if (count($param) > 0) {
            $url .= "/";
            foreach ($param as $k => $v) {
                $url = $url . $k . "-" . urlencode($v) . "-";
            }
        }
        //过滤主要的应用url
        if ($app_index == app_conf("MAIN_APP")) {
            $url = str_replace("/" . app_conf("MAIN_APP"), "", $url);
        }
        $route = $module . "#" . $action;
        switch ($route) {
            case "xxx":
                break;
            default:
                break;
        }
        if (substr($url, -1, 1) == '/' || substr($url, -1, 1) == '-') {
            $url = substr($url, 0, -1);
        }
        if ($url == '') {
            $url = "/";
        }
        $GLOBALS[$key] = $url;
        set_dynamic_cache($key, $url);
        return $url;
    }
}
예제 #6
0
 public function index()
 {
     get_mortgate();
     $GLOBALS['tmpl']->caching = true;
     $cache_id = md5(MODULE_NAME . ACTION_NAME);
     $image_list = load_dynamic_cache("INDEX_IMAGE_LIST");
     if ($image_list === false) {
         $image_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "index_image order by sort asc");
         set_dynamic_cache("INDEX_IMAGE_LIST", $image_list);
     }
     $GLOBALS['tmpl']->assign("image_list", $image_list);
     $cate_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate where is_delete=0 order by sort asc");
     $cate_result = array();
     foreach ($cate_list as $k => $v) {
         $cate_result[$v['id']] = $v;
     }
     $GLOBALS['tmpl']->assign("cate_list", $cate_result);
     send_deal_success_1();
     send_deal_fail_1();
     //===============首页项目列表START===================
     $page_size = 5;
     $limit = "0,5";
     $GLOBALS['tmpl']->assign("current_page", 1);
     $deal_result = get_deal_list($limit, 'is_recommend=1');
     $GLOBALS['tmpl']->assign("deal_list", $deal_result['list']);
     $deal_invest_result = get_deal_list($limit, '');
     $GLOBALS['tmpl']->assign("deal_list_invest", $deal_invest_result['list']);
     $shu = $GLOBALS['db']->getAll("select count(*) from " . DB_PREFIX . "deal where is_recommend=1 and type=0");
     $shu = $shu[0]['count(*)'];
     $GLOBALS['tmpl']->assign("shu", $shu);
     $all_shu = $GLOBALS['db']->getAll("select count(*) from " . DB_PREFIX . "deal where type=0");
     $all_shu = $all_shu[0]['count(*)'];
     $GLOBALS['tmpl']->assign("all_shu", $all_shu);
     //===============首页项目列表END===================
     //links
     $g_links = get_link_by_id();
     /*虚拟的累计项目总个数,支持总人数,项目支持总金额*/
     if (app_conf("INVEST_STATUS") == 0) {
         $condition = " and 1=1 ";
     } elseif (app_conf("INVEST_STATUS") == 1) {
         $condition = " and type=0 ";
     } elseif (app_conf("INVEST_STATUS") == 2) {
         $condition = " and type=1 ";
     }
     $virtual_effect = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal where is_effect = 1 and is_delete=0 {$condition}");
     $virtual_person = $GLOBALS['db']->getOne("select sum((support_count+virtual_num)) from " . DB_PREFIX . "deal where is_effect = 1 and is_delete=0 {$condition}");
     $virtual_money = $GLOBALS['db']->getOne("select sum(support_amount+virtual_price) from " . DB_PREFIX . "deal where is_effect = 1 and is_delete=0 {$condition}");
     $zhuce_num = $GLOBALS['db']->getOne("select count(*) as num from " . DB_PREFIX . "user where is_effect = 1");
     $GLOBALS['tmpl']->assign("zhuce_num", $zhuce_num);
     $virtual_effect = floor($virtual_effect * 2.3);
     $GLOBALS['tmpl']->assign("virtual_effect", $virtual_effect);
     //项目总个数
     $virtual_person = floor($virtual_person * 2.7);
     $GLOBALS['tmpl']->assign("virtual_person", $virtual_person);
     //累计支持人
     //$virtual_money = floor($virtual_money*2.1);
     $GLOBALS['tmpl']->assign("virtual_money", number_format($virtual_money, 2));
     //筹资总金额
     /*虚拟的累计项目总个数,支持总人数,项目支持总金额 结束*/
     //首页TAB选项卡
     if (app_conf("INVEST_STATUS") == 0) {
         $condition = " d.is_delete = 0 and d.is_effect = 1 ";
     } elseif (app_conf("INVEST_STATUS") == 1) {
         $condition = " d.is_delete = 0 and d.is_effect = 1 and d.type=0 ";
     } elseif (app_conf("INVEST_STATUS") == 2) {
         $condition = " d.is_delete = 0 and d.is_effect = 1 and d.type=1 ";
     }
     if ($GLOBALS['user_info']['user_level'] != 0) {
         $level = $GLOBALS['db']->getOne("SELECT level from " . DB_PREFIX . "user_level where id=" . $GLOBALS['user_info']['user_level']);
         $condition .= " AND (d.user_level ='' or d.user_level=0 or d.user_level <={$level})   ";
     } else {
         $condition .= " AND (d.user_level =0 or d.user_level =1 or d.user_level ='') AND d.is_recommend='1'";
     }
     //最后发起的项目,如果被设置为推荐,被选项卡显示
     $deal_cate_array = $GLOBALS['db']->getAll("select d.* from (select * from " . DB_PREFIX . "deal order by sort asc)  as d left join " . DB_PREFIX . "deal_cate as dc on dc.id=d.cate_id where {$condition} group by d.cate_id order by dc.sort asc ");
     $deal_cate = array();
     $now_time = NOW_TIME;
     foreach ($deal_cate_array as $k => $v) {
         if ($v['id'] > 0) {
             $v['cate_name'] = $cate_result[$v['cate_id']]['name'];
             $v['percent'] = round($v['support_amount'] / $v['limit_price'] * 100);
             $v['num_days'] = ceil(($v['end_time'] - $v['begin_time']) / (24 * 3600));
             $v['remain_days'] = ceil(($v['end_time'] - $now_time) / (24 * 3600));
             if ($v['begin_time'] > $now_time) {
                 $v['left_days'] = intval(($now_time - $v['create_time']) / 24 / 3600);
             }
             $v['num_days'] = ceil(($v['end_time'] - $v['begin_time']) / (24 * 3600));
             $deal_ids[] = $v['id'];
             $deal_cate[$v['id']] = $v;
         }
     }
     //将获取到的虚拟人数和虚拟价格拿到项目列表里面进行统计
     foreach ($deal_cate as $k => $v) {
         if ($v['type'] == 1) {
             $deal_cate[$k]['virtual_person'] = $deal_cate[$k]['invote_num'];
             $deal_cate[$k]['support_count'] = $deal_cate[$k]['invote_num'];
             $deal_cate[$k]['support_amount'] = $deal_cate[$k]['invote_money'];
             $deal_cate[$k]['percent'] = round($deal_cate[$k]['support_amount'] / $v['limit_price'] * 100);
         } else {
             $deal_cate[$k]['virtual_person'] = $deal_cate[$k]['virtual_num'];
             $deal_cate[$k]['support_count'] = $deal_cate[$k]['virtual_num'] + $deal_cate[$k]['support_count'];
             $deal_cate[$k]['support_amount'] = $deal_cate[$k]['virtual_price'] + $deal_cate[$k]['support_amount'];
             $deal_cate[$k]['percent'] = round($deal_cate[$k]['support_amount'] / $v['limit_price'] * 100);
         }
     }
     $GLOBALS['tmpl']->assign("deal_cate", $deal_cate);
     $GLOBALS['tmpl']->assign("g_links", $g_links);
     //获取专题列表
     $topic_num = $GLOBALS['db']->getOne("select count(*) as num from " . DB_PREFIX . "zhuanti where 1 ");
     $GLOBALS['tmpl']->assign("topic_num", $topic_num);
     $topic_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "zhuanti where state=1 order by sort desc limit 0,3");
     $GLOBALS['tmpl']->assign("topic_list", $topic_list);
     $GLOBALS['tmpl']->display("index.html");
 }
예제 #7
0
파일: common.php 프로젝트: eliu03/fanweP2P
function parse_url_tag($str)
{
    $key = md5("URL_TAG_" . $str);
    if (isset($GLOBALS[$key])) {
        return $GLOBALS[$key];
    }
    $url = load_dynamic_cache($key);
    if ($url !== false) {
        $GLOBALS[$key] = $url;
        return $url;
    }
    $str = substr($str, 2);
    $str_array = explode("|", $str);
    $app_index = $str_array[0];
    $route = $str_array[1];
    $param_tmp = explode("&", $str_array[2]);
    $param = array();
    foreach ($param_tmp as $item) {
        if ($item != '') {
            $item_arr = explode("=", $item);
        }
        if ($item_arr[0] && $item_arr[1]) {
            $param[$item_arr[0]] = $item_arr[1];
        }
    }
    $GLOBALS[$key] = url($app_index, $route, $param);
    set_dynamic_cache($key, $GLOBALS[$key]);
    return $GLOBALS[$key];
}
예제 #8
0
 public function region()
 {
     $city_list = load_dynamic_cache("INDEX_CITY_LIST");
     if (!$city_list) {
         $city_list = $GLOBALS['db']->getAll("select province from " . DB_PREFIX . "deal group by province order by sort asc");
         set_dynamic_cache("INDEX_CITY_LIST", $city_list);
     }
     foreach ($city_list as $k => $v) {
         $temp_param = $param;
         $temp_param['loc'] = $v['province'];
         $city_list[$k]['url'] = url("deals", $temp_param);
     }
     $GLOBALS['tmpl']->assign("city_list", $city_list);
     //============region_conf============
     $area_list = $GLOBALS['db']->getAll("select rc.* from " . DB_PREFIX . "region_conf as rc where rc.name in (select province from " . DB_PREFIX . "deal) or  rc.name in (select city from " . DB_PREFIX . "deal) or rc.is_hot=1 ");
     $area = array();
     $hot_area = array();
     foreach ($area_list as $k => $v) {
         $temp_param['loc'] = $v['name'];
         $area[strtoupper($v['py'][0])][$v['name']] = array('url' => url("deals", $temp_param), 'name' => $v['name']);
         if ($v['is_hot']) {
             $hot_area[] = array('url' => url("deals", $temp_param), 'name' => $v['name']);
         }
     }
     ksort($area);
     $area_array = array();
     $area_array = array_chunk(array_filter($area), 4, true);
     $area_array_num = array();
     foreach ($area_array as $k => $v) {
         foreach ($v as $k1 => $v1) {
             $area_array_str[$k] .= $k1;
         }
     }
     $GLOBALS['tmpl']->assign("area_array", $area_array);
     $GLOBALS['tmpl']->assign("area_array_str", $area_array_str);
     $GLOBALS['tmpl']->assign("hot_area", array_filter($hot_area));
     $GLOBALS['tmpl']->display("inc/region.html");
 }
예제 #9
0
 public function deals()
 {
     $r = strim($_REQUEST['r']);
     //推荐类型
     $id = intval($_REQUEST['id']);
     //分类id
     $loc = strim($_REQUEST['loc']);
     //地区
     $tag = strim($_REQUEST['tag']);
     //标签
     $kw = strim($_REQUEST['k']);
     //关键词
     $state = intval($_REQUEST['state']);
     //状态
     $step = intval($_REQUEST['step']);
     $page_size = DEAL_PAGE_SIZE;
     $step_size = DEAL_STEP_SIZE;
     if ($step == 0) {
         $step = 1;
     }
     $page = intval($_REQUEST['p']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * $page_size + ($step - 1) * $step_size . "," . $step_size;
     $condition = " is_delete = 0 and is_effect = 1 ";
     if ($r != "") {
         if ($r == "new") {
             $condition .= " and " . NOW_TIME . " - begin_time < " . 24 * 3600 . " and " . NOW_TIME . " - begin_time > 0 ";
             //上线不超过一天
         }
         if ($r == "rec") {
             $condition .= " and " . NOW_TIME . " <= end_time AND " . NOW_TIME . " >= begin_time and is_recommend = 1 ";
         }
         if ($r == "yure") {
             $condition .= " and " . NOW_TIME . " - begin_time < " . 24 * 3600 . " and " . NOW_TIME . " - begin_time <  0 ";
             //上线不超过一天
         }
         if ($r == "nend") {
             $condition .= " and end_time - " . NOW_TIME . " < " . 24 * 3600 . " and end_time - " . NOW_TIME . " > 0 ";
             //当天就要结束
         }
         if ($r == "classic") {
             $condition .= " and is_classic = 1 ";
         }
         if ($r == "limit_price") {
             $condition .= " and max(limit_price) ";
         }
     }
     switch ($state) {
         //筹资成功
         case 1:
             $condition .= " and end_time < " . NOW_TIME . "  and support_amount >= limit_price";
             $GLOBALS['tmpl']->assign("page_title", "筹资成功");
             break;
             //筹资失败
         //筹资失败
         case 2:
             $condition .= " and end_time < " . NOW_TIME . "  and  support_amount < limit_price ";
             $GLOBALS['tmpl']->assign("page_title", "筹资失败");
             break;
             //筹资中
         //筹资中
         case 3:
             $condition .= " and end_time > " . NOW_TIME . "  and begin_time < " . NOW_TIME . " ";
             $GLOBALS['tmpl']->assign("page_title", "筹资中");
             break;
     }
     $cate_list = load_dynamic_cache("INDEX_CATE_LIST");
     if (!$cate_list) {
         $cate_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate order by sort asc");
         set_dynamic_cache("INDEX_CATE_LIST", $cate_list);
     }
     $cate_result = array();
     $kk = 0;
     foreach ($cate_list as $k => $v) {
         if ($v['pid'] == 0) {
             $temp_param = $param;
             $cate_result[$k + 1]['id'] = $v['id'];
             $cate_result[$k + 1]['name'] = $v['name'];
             $temp_param['id'] = $v['id'];
             $cate_result[$k + 1]['url'] = url("deals", $temp_param);
             $kk++;
         }
     }
     $GLOBALS['tmpl']->assign("cate_list", $cate_result);
     $pid = 0;
     //获取父类id
     if ($cate_list) {
         foreach ($cate_list as $k => $v) {
             if ($v['id'] == $id) {
                 if ($v['pid'] > 0) {
                     $pid = $v['pid'];
                 } else {
                     $pid = $id;
                 }
             }
         }
     }
     /*子分类 start*/
     $cate_ids = array();
     $is_has_child = false;
     $temp_cate_ids = array();
     if ($cate_list) {
         $child_cate_result = array();
         foreach ($cate_list as $k => $v) {
             if ($v['pid'] == $pid) {
                 if ($v['pid'] > 0) {
                     $temp_param = $param;
                     $child_cate_result[$v['id']]['id'] = $v['id'];
                     $child_cate_result[$v['id']]['name'] = $v['name'];
                     $temp_param['id'] = $v['id'];
                     $child_cate_result[$v['id']]['url'] = url("deals", $temp_param);
                     if ($v['id'] == $id) {
                         $is_has_child = true;
                     }
                 }
             }
             if ($v['pid'] == $pid || $pid == 0) {
                 $temp_cate_ids[] = $v['id'];
             }
         }
     }
     //假如选择了子类 那么使用子类ID  否则使用 父类和其子类
     if ($is_has_child) {
         $cate_ids[] = $id;
     } else {
         $cate_ids[] = $pid;
         $cate_ids = array_merge($cate_ids, $temp_cate_ids);
     }
     if (count($cate_ids) > 0) {
         $condition .= " and cate_id in (" . implode(",", $cate_ids) . ")";
     }
     if ($loc != "") {
         $condition .= " and (province = '" . $loc . "' or city = '" . $loc . "') ";
     }
     if ($tag != "") {
         $unicode_tag = str_to_unicode_string($tag);
         $condition .= " and match(tags_match) against('" . $unicode_tag . "'  IN BOOLEAN MODE) ";
     }
     if ($kw != "") {
         $kws_div = div_str($kw);
         foreach ($kws_div as $k => $item) {
             $kws[$k] = str_to_unicode_string($item);
         }
         $ukeyword = implode(" ", $kws);
         $condition .= " and (match(name_match) against('" . $ukeyword . "'  IN BOOLEAN MODE) or match(tags_match) against('" . $ukeyword . "'  IN BOOLEAN MODE)  or name like '%" . $kw . "%') ";
     }
     $result = get_deal_list($limit, $condition);
     $GLOBALS['tmpl']->assign("deal_list", $result['list']);
     $data['html'] = $GLOBALS['tmpl']->fetch("inc/deal_list.html");
     if ($step * $step_size < $page_size) {
         if ($result['rs_count'] <= ($page - 1) * $page_size + ($step - 1) * $step_size + $step_size) {
             $data['step'] = 0;
             ajax_return($data);
         } else {
             $data['step'] = $step + 1;
             ajax_return($data);
         }
     } else {
         $data['step'] = 0;
         ajax_return($data);
     }
 }
예제 #10
0
 public function index()
 {
     $r = strim($_REQUEST['r']);
     //推荐类型
     $GLOBALS['tmpl']->assign("p_r", $r);
     $id = intval($_REQUEST['id']);
     //分类id
     $GLOBALS['tmpl']->assign("p_id", $id);
     $loc = strim($_REQUEST['loc']);
     //地区
     $GLOBALS['tmpl']->assign("p_loc", $loc);
     $tag = strim($_REQUEST['tag']);
     //标签
     $GLOBALS['tmpl']->assign("p_tag", $tag);
     $kw = strim($_REQUEST['k']);
     //关键词
     $GLOBALS['tmpl']->assign("p_k", $kw);
     if (intval($_REQUEST['redirect']) == 1) {
         $param = array();
         if ($r != "") {
             $param = array_merge($param, array("r" => $r));
         }
         if ($id > 0) {
             $param = array_merge($param, array("id" => $id));
         }
         if ($loc != "") {
             $param = array_merge($param, array("loc" => $loc));
         }
         if ($tag != "") {
             $param = array_merge($param, array("tag" => $tag));
         }
         if ($kw != "") {
             $param = array_merge($param, array("k" => $kw));
         }
         app_redirect(url("deals", $param));
     }
     $image_list = load_dynamic_cache("INDEX_IMAGE_LIST");
     if ($image_list === false) {
         $image_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "index_image order by sort asc");
         set_dynamic_cache("INDEX_IMAGE_LIST", $image_list);
     }
     $GLOBALS['tmpl']->assign("image_list", $image_list);
     $cate_result = load_dynamic_cache("INDEX_CATE_LIST");
     if ($cate_result === false) {
         $cate_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate order by sort asc");
         $cate_result = array();
         foreach ($cate_list as $k => $v) {
             $cate_result[$v['id']] = $v;
         }
         set_dynamic_cache("INDEX_CATE_LIST", $cate_result);
     }
     $GLOBALS['tmpl']->assign("cate_list", $cate_result);
     $page_size = DEAL_PAGE_SIZE;
     $step_size = DEAL_STEP_SIZE;
     $step = intval($_REQUEST['step']);
     if ($step == 0) {
         $step = 1;
     }
     $page = intval($_REQUEST['p']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * $page_size + ($step - 1) * $step_size . "," . $step_size;
     $GLOBALS['tmpl']->assign("current_page", $page);
     $condition = " is_delete = 0 and is_effect = 1 ";
     if ($r != "") {
         if ($r == "new") {
             $condition .= " and " . NOW_TIME . " - begin_time < " . 24 * 3600 . " and " . NOW_TIME . " - begin_time > 0 ";
             //上线不超过一天
             $GLOBALS['tmpl']->assign("page_title", "最新上线");
         }
         if ($r == "nend") {
             $condition .= " and end_time - " . NOW_TIME . " < " . 24 * 3600 . " and end_time - " . NOW_TIME . " > 0 ";
             //当天就要结束
             $GLOBALS['tmpl']->assign("page_title", "即将结束");
         }
         if ($r == "classic") {
             $condition .= " and is_classic = 1 ";
             $GLOBALS['tmpl']->assign("page_title", "经典项目");
         }
     }
     if ($id > 0) {
         $condition .= " and cate_id = " . $id;
         $GLOBALS['tmpl']->assign("page_title", $cate_result[$id]['name']);
     }
     if ($loc != "") {
         $condition .= " and (province = '" . $loc . "' or city = '" . $loc . "') ";
         $GLOBALS['tmpl']->assign("page_title", $loc);
     }
     if ($tag != "") {
         $unicode_tag = str_to_unicode_string($tag);
         $condition .= " and match(tags_match) against('" . $unicode_tag . "'  IN BOOLEAN MODE) ";
         $GLOBALS['tmpl']->assign("page_title", $tag);
     }
     if ($kw != "") {
         $kws_div = div_str($kw);
         foreach ($kws_div as $k => $item) {
             $kws[$k] = str_to_unicode_string($item);
         }
         $ukeyword = implode(" ", $kws);
         $condition .= " and (match(name_match) against('" . $ukeyword . "'  IN BOOLEAN MODE) or match(tags_match) against('" . $ukeyword . "'  IN BOOLEAN MODE)  or name like '%" . $kw . "%') ";
         $GLOBALS['tmpl']->assign("page_title", $kw);
     }
     $deal_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal where " . $condition . " order by sort asc limit " . $limit);
     $deal_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal where " . $condition);
     foreach ($deal_list as $k => $v) {
         $deal_list[$k]['remain_days'] = floor(($v['end_time'] - NOW_TIME) / (24 * 3600));
         $deal_list[$k]['percent'] = round($v['support_amount'] / $v['limit_price'] * 100);
     }
     $GLOBALS['tmpl']->assign("deal_list", $deal_list);
     $page = new Page($deal_count, $page_size);
     //初始化分页对象
     $p = $page->show();
     $GLOBALS['tmpl']->assign('pages', $p);
     $GLOBALS['tmpl']->display("deals_index.html");
 }
예제 #11
0
 public function search()
 {
     //获取可以相关的用户
     $user_list = get_rand_user(4);
     $user_id = intval($GLOBALS['user_info']['id']);
     $ids = array(0);
     foreach ($user_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 ($user_list as $k => $v) {
         foreach ($focus_data as $kk => $vv) {
             if ($vv['focused_user_id'] == $v['id']) {
                 $user_list[$k]['focused'] = 1;
                 break;
             }
         }
         if ($v['city_id'] != 0 && $v['city_id'] == $GLOBALS['deal_city']['id']) {
             $user_list[$k]['same_city'] = 1;
         } else {
             $user_list[$k]['same_city'] = 0;
         }
     }
     $GLOBALS['tmpl']->assign("user_list", $user_list);
     convert_req($_REQUEST);
     $type = intval($_REQUEST['type']);
     $filter = intval($_REQUEST['filter']);
     $keyword = addslashes(htmlspecialchars(trim($_REQUEST['keyword'])));
     $GLOBALS['tmpl']->assign("keyword", $keyword);
     $GLOBALS['tmpl']->assign("type", $type);
     $GLOBALS['tmpl']->assign("filter", $filter);
     $url_param = array("type" => $type, "filter" => $filter, "keyword" => $keyword);
     if ($type == 0) {
         unset($url_param['type']);
     }
     if ($filter == 0) {
         unset($url_param['filter']);
     }
     if (intval($_REQUEST['is_redirect']) == 1) {
         if ($type > 0) {
             app_redirect(url("shop", "topic#search", $url_param));
         } else {
             app_redirect(url("shop", "topic#search", $url_param));
         }
     }
     $type_navs = array(array("type" => 0, "name" => $GLOBALS['lang']['TOPIC_TYPE_ALL']), array("type" => 1, "name" => $GLOBALS['lang']['TOPIC_TYPE_DEAL']), array("type" => 2, "name" => $GLOBALS['lang']['TOPIC_TYPE_STORE']), array("type" => 3, "name" => $GLOBALS['lang']['TOPIC_TYPE_RECOMMEND']));
     foreach ($type_navs as $k => $v) {
         $tmp_url_param = $url_param;
         if ($v['type'] != 0) {
             $tmp_url_param['type'] = $v['type'];
         } else {
             unset($tmp_url_param['type']);
         }
         $type_navs[$k]['url'] = url("shop", "topic#search", $tmp_url_param);
         if ($v['type'] == $type) {
             $type_navs[$k]['act'] = true;
         }
     }
     $filter_navs = array(array("filter" => 0, "name" => $GLOBALS['lang']['TOPIC_FILTER_ALL']), array("filter" => 1, "name" => $GLOBALS['lang']['TOPIC_FILTER_MYFOCUS']), array("filter" => 2, "name" => $GLOBALS['lang']['TOPIC_FILTER_DAREN']), array("filter" => 3, "name" => $GLOBALS['lang']['TOPIC_FILTER_MERCHANT']));
     foreach ($filter_navs as $k => $v) {
         $tmp_url_param = $url_param;
         if ($v['filter'] != 0) {
             $tmp_url_param['filter'] = $v['filter'];
         } else {
             unset($tmp_url_param['filter']);
         }
         $filter_navs[$k]['url'] = url("shop", "topic#search", $tmp_url_param);
         if ($v['filter'] == $filter) {
             $filter_navs[$k]['act'] = true;
         }
     }
     $condition = " 1=1 ";
     if ($type == 0) {
         //所有分享
         $condition .= "";
         $search_title = $GLOBALS['lang']['TOPIC_TYPE_ALL'];
     } elseif ($type == 1) {
         $condition .= " and (t.type='tuancomment' or t.type='shopcomment' or t.type='youhuicomment' ) ";
         $search_title = $GLOBALS['lang']['TOPIC_TYPE_DEAL'];
     } elseif ($type == 2) {
         $condition .= " and t.type='slocationcomment' ";
         $search_title = $GLOBALS['lang']['TOPIC_TYPE_STORE'];
     } elseif ($type == 3) {
         $condition .= " and t.title like '" . $keyword . "' ";
         $search_title = $GLOBALS['lang']['TOPIC_TYPE_RECOMMEND'];
     }
     if ($filter == 0) {
         //全部
         //$search_title.= " - ".$GLOBALS['lang']['TOPIC_FILTER_ALL'];
     } elseif ($filter == 1) {
         $search_title .= " - " . $GLOBALS['lang']['TOPIC_FILTER_MYFOCUS'];
         $condition .= " and uf.focus_user_id =  " . intval($GLOBALS['user_info']['id']);
     } elseif ($filter == 2) {
         $search_title .= " - " . $GLOBALS['lang']['TOPIC_FILTER_DAREN'];
         $condition .= " and u.is_daren = 1 ";
     } elseif ($filter == 3) {
         $search_title .= " - " . $GLOBALS['lang']['TOPIC_FILTER_MERCHANT'];
         $condition .= " and u.is_merchant = 1 ";
     }
     if ($keyword) {
         $search_title .= " - " . $keyword;
         $kws_div = div_str($keyword);
         foreach ($kws_div as $k => $item) {
             $kw[$k] = str_to_unicode_string($item);
         }
         $ukeyword = implode(" ", $kw);
         $condition .= " and match(t.keyword_match) against('" . $ukeyword . "'  IN BOOLEAN MODE) ";
     }
     $GLOBALS['tmpl']->assign("kws_div", $kws_div);
     $GLOBALS['tmpl']->assign("page_title", $search_title);
     $GLOBALS['tmpl']->assign("page_keyword", $search_title . ",");
     $GLOBALS['tmpl']->assign("page_description", $search_title . ",");
     //分页
     $page = intval($_REQUEST['p']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE");
     //		$result = get_topic_list($limit,$condition,"",$kws_div);
     $orderby = 't.create_time desc';
     $condition = " and " . $condition;
     $list = $GLOBALS['db']->getAll("select t.* from " . DB_PREFIX . "topic as t left join " . DB_PREFIX . "user as u on t.user_id = u.id left join " . DB_PREFIX . "user_focus as uf on uf.focused_user_id = t.user_id where t.is_effect = 1 and t.is_delete = 0 " . $condition . " group by t.id order by " . $orderby . " limit " . $limit);
     $total = $GLOBALS['db']->getOne("select count(distinct(t.id)) from " . DB_PREFIX . "topic as t left join " . DB_PREFIX . "user as u on t.user_id = u.id left join " . DB_PREFIX . "user_focus as uf on uf.focused_user_id = t.user_id where t.is_effect = 1 and t.is_delete = 0  " . $condition);
     foreach ($list as $k => $v) {
         $list[$k] = get_topic_item($v, $kws_div);
         if (msubstr(preg_replace("/<[^>]+>/i", "", $list[$k]['content']), 0, 50) != preg_replace("/<[^>]+>/i", "", $list[$k]['content'])) {
             $list[$k]['short_content'] = msubstr(preg_replace("/<[^>]+>/i", "", $list[$k]['content']), 0, 50);
         } else {
             $list[$k]['short_content'] = preg_replace("/<br[^>]+>/i", "", $list[$k]['content']);
         }
         if ($list[$k]['origin']) {
             if (msubstr(preg_replace("/<[^>]+>/i", "", $list[$k]['origin']['content']), 0, 50) != preg_replace("/<[^>]+>/i", "", $list[$k]['origin']['content'])) {
                 $list[$k]['origin']['short_content'] = msubstr(preg_replace("/<[^>]+>/i", "", $list[$k]['origin']['content']), 0, 50);
             } else {
                 $list[$k]['origin']['short_content'] = preg_replace("/<br[^>]+>/i", "", $list[$k]['origin']['content']);
             }
         }
     }
     $result = array('list' => $list, 'total' => $total);
     if ($result['total'] > 0) {
         if (check_ipop_limit(get_client_ip(), "topic_search", 10, $keyword)) {
             $GLOBALS['db']->query("update " . DB_PREFIX . "topic_tag set count = count + 1 where name = '" . $keyword . "'");
         }
     }
     //$result['list'] = div_to_col($result['list']);
     $GLOBALS['tmpl']->assign("topic_list", $result['list']);
     $page = new Page($result['total'], app_conf("PAGE_SIZE"));
     //初始化分页对象
     $p = $page->show();
     $GLOBALS['tmpl']->assign('pages', $p);
     $GLOBALS['tmpl']->assign('user_auth', get_user_auth());
     $list_html = load_topic_list();
     //$list_html = decode_topic_without_img($GLOBALS['tmpl']->fetch("inc/topic_col_list.html"));
     $GLOBALS['tmpl']->assign("list_html", $list_html);
     $GLOBALS['tmpl']->assign("type_navs", $type_navs);
     $GLOBALS['tmpl']->assign("filter_navs", $filter_navs);
     $res = load_dynamic_cache("topic_search_hot");
     if ($res === false) {
         $res['hot_tag_list'] = $GLOBALS['db']->getAll("select name,color from " . DB_PREFIX . "topic_tag where is_recommend = 1 order by sort desc, count desc limit 10");
         $res['hot_title_list'] = $GLOBALS['db']->getAll("select name,color from " . DB_PREFIX . "topic_title where is_recommend = 1 order by sort desc,count desc limit 10");
         set_dynamic_cache("topic_search_hot", $res);
     }
     //输出搜索热词
     $GLOBALS['tmpl']->assign("hot_tag_list", $res['hot_tag_list']);
     $GLOBALS['tmpl']->assign("hot_title_list", $res['hot_title_list']);
     //输出推荐分享
     $recommend_topic = load_auto_cache("recommend_uc_topic");
     $GLOBALS['tmpl']->assign("recommend_topic", $recommend_topic);
     $GLOBALS['tmpl']->display("topic_search.html");
 }
예제 #12
0
function set_uc_right()
{
    //获取可以相关的用户
    $user_id = intval($GLOBALS['user_info']['id']);
    $user_list = get_rand_user(5, 0, $user_id);
    $GLOBALS['tmpl']->assign("user_list", $user_list);
    //输出粉丝
    $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 = " . $user_id . " 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("fans_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 = " . $user_id . " 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("focus_list", $focus_list);
    $res = load_dynamic_cache("topic_search_hot");
    if ($res === false) {
        $res['hot_tag_list'] = $GLOBALS['db']->getAll("select name,color from " . DB_PREFIX . "topic_tag where is_recommend = 1 order by sort desc, count desc limit 10");
        $res['hot_title_list'] = $GLOBALS['db']->getAll("select name,color from " . DB_PREFIX . "topic_title where is_recommend = 1 order by sort desc,count desc limit 10");
        set_dynamic_cache("topic_search_hot", $res);
    }
    //输出搜索热词
    $GLOBALS['tmpl']->assign("hot_tag_list", $res['hot_tag_list']);
    $GLOBALS['tmpl']->assign("hot_title_list", $res['hot_title_list']);
    //输出推荐分享
    $recommend_topic = load_auto_cache("recommend_uc_topic");
    $GLOBALS['tmpl']->assign("recommend_topic", $recommend_topic);
    $GLOBALS['tmpl']->assign("has_right", 1);
}
예제 #13
0
파일: main_lib.php 프로젝트: macall/jsd
function get_user_name($id, $show_tag = true)
{
    $key = md5("USER_NAME_LINK_" . $id);
    if (isset($GLOBALS[$key])) {
        return $GLOBALS[$key];
    } else {
        $uname = load_dynamic_cache($key);
        if ($uname === false) {
            $u = $GLOBALS['db']->getRow("select id,user_name,is_merchant,is_daren,daren_title from " . DB_PREFIX . "user where id = " . intval($id));
            $uname = "<a href='" . url("index", "uc_home", array("id" => $id)) . "'  class='user_name'  onmouseover='userCard.load(this,\"" . $u['id'] . "\");' >" . $u['user_name'] . "</a>";
            if ($show_tag) {
                $uname = "<a href='" . url("index", "uc_home", array("id" => $id)) . "' onmouseover='userCard.load(this,\"" . $u['id'] . "\");'>" . msubstr($u['user_name'], 0, 5) . "</a>";
                if ($u['is_merchant']) {
                    $uname = $uname . "<font class='is_merchant' title='认证商家'></font>";
                }
                if ($u['is_daren']) {
                    $uname = $uname . "<font class='is_daren' title='" . $u['daren_title'] . "'></font>";
                }
            } else {
                $uname = "<a href='" . url("index", "uc_home", array("id" => $id)) . "' onmouseover='userCard.load(this,\"" . $u['id'] . "\");'>" . $u['user_name'] . "</a>";
            }
            set_dynamic_cache($key, $uname);
        }
        $GLOBALS[$key] = $uname;
        return $GLOBALS[$key];
    }
}
예제 #14
0
 public function invester_list($from = 'wap')
 {
     $g_links = get_link_by_id(14);
     $GLOBALS['tmpl']->assign("g_links", $g_links);
     $GLOBALS['tmpl']->assign("page_title", "天使投资人列表");
     $param = array();
     //参数集合
     //数据来源参数
     $r = strim($_REQUEST['r']);
     //投资人类型
     $param['r'] = $r ? $r : '';
     $GLOBALS['tmpl']->assign("p_r", $r);
     $loc = strim($_REQUEST['loc']);
     //地区
     $param['loc'] = $loc;
     $GLOBALS['tmpl']->assign("p_loc", $loc);
     $city = strim($_REQUEST['city']);
     //地区
     $param['city'] = $city;
     $GLOBALS['tmpl']->assign("p_city", $city);
     if (intval($_REQUEST['redirect']) == 1) {
         $param = array();
         if ($r != "") {
             $param = array_merge($param, array("r" => $r));
         }
         if ($loc != "") {
             $param = array_merge($param, array("loc" => $loc));
         }
         if ($city != "") {
             $param = array_merge($param, array("city" => $city));
         }
     }
     $city_list = load_dynamic_cache("INDEX_CITY_LIST");
     if (!$city_list) {
         $city_list = $GLOBALS['db']->getAll("select province from " . DB_PREFIX . "user group by province order by create_time desc");
         set_dynamic_cache("INDEX_CITY_LIST", $city_list);
     }
     foreach ($city_list as $k => $v) {
         $temp_param = $param;
         unset($temp_param['city']);
         $temp_param['loc'] = $v['province'];
         if ($from == 'web') {
             $city_list[$k]['url'] = url("investor#invester_list", $temp_param);
         } elseif ($from == 'wap') {
             $city_list[$k]['url'] = url_wap("investor#invester_list", $temp_param);
         }
     }
     $GLOBALS['tmpl']->assign("city_list", $city_list);
     $next_pid = 0;
     $region_lv2 = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "region_conf where region_level = 2 order by py asc");
     //二级地址
     foreach ($region_lv2 as $k => $v) {
         $temp_param = $param;
         unset($temp_param['city']);
         $temp_param['loc'] = $v['name'];
         if ($from == 'web') {
             $region_lv2[$k]['url'] = url("investor#invester_list", $temp_param);
         } elseif ($from == 'wap') {
             $region_lv2[$k]['url'] = url_wap("investor#invester_list", $temp_param);
         }
         if ($loc == $v['name']) {
             $next_pid = $v['id'];
         }
     }
     $GLOBALS['tmpl']->assign("region_lv2", $region_lv2);
     if ($next_pid > 0) {
         $region_lv3 = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "region_conf where region_level = 3 and `pid`='" . $next_pid . "' order by py asc");
         //二级地址
         foreach ($region_lv3 as $k => $v) {
             $temp_param = $param;
             $temp_param['city'] = $v['name'];
             if ($from == 'web') {
                 $region_lv3[$k]['url'] = url("investor#invester_list", $temp_param);
             } elseif ($from == 'wap') {
                 $region_lv3[$k]['url'] = url_wap("investor#invester_list", $temp_param);
             }
         }
         $GLOBALS['tmpl']->assign("region_lv3", $region_lv3);
     }
     //	print_r($region_lv2);exit;
     $page_size = 20;
     $page = intval($_REQUEST['p']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * $page_size . "," . $page_size;
     $GLOBALS['tmpl']->assign("current_page", $page);
     $condition = "is_effect = 1 ";
     if ($r != "") {
         if ($r == "ordinary_user") {
             $condition .= " and is_investor = 0 ";
             $GLOBALS['tmpl']->assign("page_title", "普通用户");
         }
         if ($r == "invester") {
             $condition .= " and is_investor = 1 ";
             $GLOBALS['tmpl']->assign("page_title", "投资人");
         }
         if ($r == "institutions_invester") {
             $condition .= " and is_investor = 2 ";
             $GLOBALS['tmpl']->assign("page_title", "机构投资人");
         }
     }
     if ($loc != "") {
         $condition .= " and (province = '" . $loc . "') ";
         $GLOBALS['tmpl']->assign("page_title", $loc);
     }
     if ($city != "") {
         $condition .= " and (province = '" . $loc . "' and city = '" . $city . "') ";
         $GLOBALS['tmpl']->assign("page_title", $city);
     }
     /*投资人列表*/
     $invester_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "user where " . $condition . " order by create_time desc limit " . $limit);
     foreach ($invester_list as $k => $v) {
         $invester_list[$k]['image'] = get_user_avatar($v["id"], "middle");
         //用户头像
     }
     $invester_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user where " . $condition);
     $GLOBALS['tmpl']->assign("invester_count", $invester_count);
     require APP_ROOT_PATH . 'app/Lib/page.php';
     $page = new Page($invester_count, $page_size);
     //初始化分页对象
     $p = $page->show();
     $GLOBALS['tmpl']->assign('pages', $p);
     $GLOBALS['tmpl']->assign("invester_list", $invester_list);
     /*投资人推荐*/
     $new_invester = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "user where investor_status = 1 and is_effect = 1 and (is_investor = 1 or is_investor = 2) order by create_time desc ");
     foreach ($new_invester as $kk => $vv) {
         $new_invester[$kk]['image'] = get_user_avatar($vv["id"], "middle");
         //用户头像
     }
     $GLOBALS['tmpl']->assign("new_invester", $new_invester);
     $GLOBALS['tmpl']->display("invester_list.html");
 }
 public function invester_list($from = 'web')
 {
     $GLOBALS['tmpl']->assign("page_title", "天使投资人列表");
     $param = array();
     //参数集合
     get_user_lever_icon(8);
     //数据来源参数
     $r = strim($_REQUEST['r']);
     //投资人类型
     $r = $r ? $r : 'all';
     $param['r'] = $r;
     $GLOBALS['tmpl']->assign("p_r", $r);
     $loc = strim($_REQUEST['loc']);
     //地区
     $param['loc'] = $loc;
     $GLOBALS['tmpl']->assign("p_loc", $loc);
     $city = strim($_REQUEST['city']);
     //地区
     $param['city'] = $city;
     $GLOBALS['tmpl']->assign("p_city", $city);
     if (intval($_REQUEST['redirect']) == 1) {
         $param = array();
         if ($r != "") {
             $param = array_merge($param, array("r" => $r));
         }
         if ($loc != "") {
             $param = array_merge($param, array("loc" => $loc));
         }
         if ($city != "") {
             $param = array_merge($param, array("city" => $city));
         }
     }
     $city_list = load_dynamic_cache("INDEX_CITY_LIST");
     if (!$city_list) {
         $city_list = $GLOBALS['db']->getAll("select province from " . DB_PREFIX . "user group by province order by create_time desc");
         set_dynamic_cache("INDEX_CITY_LIST", $city_list);
     }
     foreach ($city_list as $k => $v) {
         $temp_param = $param;
         unset($temp_param['city']);
         $temp_param['loc'] = $v['province'];
         if ($from == 'web') {
             $city_list[$k]['url'] = url("investor#invester_list", $temp_param);
         } elseif ($from == 'wap') {
             $city_list[$k]['url'] = url_wap("investor#invester_list", $temp_param);
         }
     }
     $GLOBALS['tmpl']->assign("city_list", $city_list);
     $next_pid = 0;
     $region_lv2 = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "region_conf where region_level = 2 order by py asc");
     //二级地址
     foreach ($region_lv2 as $k => $v) {
         $temp_param = $param;
         unset($temp_param['city']);
         $temp_param['loc'] = $v['name'];
         if ($from == 'web') {
             $region_lv2[$k]['url'] = url("investor#invester_list", $temp_param);
         } elseif ($from == 'wap') {
             $region_lv2[$k]['url'] = url_wap("investor#invester_list", $temp_param);
         }
         if ($loc == $v['name']) {
             $next_pid = $v['id'];
         }
     }
     $GLOBALS['tmpl']->assign("region_lv2", $region_lv2);
     if ($next_pid > 0) {
         $region_lv3 = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "region_conf where region_level = 3 and `pid`='" . $next_pid . "' order by py asc");
         //二级地址
         foreach ($region_lv3 as $k => $v) {
             $temp_param = $param;
             $temp_param['city'] = $v['name'];
             if ($from == 'web') {
                 $region_lv3[$k]['url'] = url("investor#invester_list", $temp_param);
             } elseif ($from == 'wap') {
                 $region_lv3[$k]['url'] = url_wap("investor#invester_list", $temp_param);
             }
         }
         $GLOBALS['tmpl']->assign("region_lv3", $region_lv3);
     }
     //	print_r($region_lv2);exit;
     $page_size = 8;
     $page = intval($_REQUEST['p']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * $page_size . "," . $page_size;
     $GLOBALS['tmpl']->assign("current_page", $page);
     $condition = "is_effect = 1 ";
     if ($r != "") {
         if ($r == "all") {
             if (app_conf("AVERAGE_USER_STATUS") == 0 && INVEST_TYPE != 1) {
                 if ($r == "all") {
                     $condition .= " and (is_investor = 1 or is_investor = 2)";
                 }
             }
             $GLOBALS['tmpl']->assign("page_title", "全部");
         }
         if ($r == "ordinary_user") {
             $condition .= " and is_investor = 0 ";
             $GLOBALS['tmpl']->assign("page_title", "普通用户");
         }
         if ($r == "invester") {
             $condition .= " and is_investor = 1 ";
             $GLOBALS['tmpl']->assign("page_title", "投资人");
         }
         if ($r == "institutions_invester") {
             $condition .= " and is_investor = 2 ";
             $GLOBALS['tmpl']->assign("page_title", "机构投资人");
         }
     }
     if ($loc != "") {
         $condition .= " and (province = '" . $loc . "') ";
         $GLOBALS['tmpl']->assign("page_title", $loc);
     }
     if ($city != "") {
         $condition .= " and (province = '" . $loc . "' and city = '" . $city . "') ";
         $GLOBALS['tmpl']->assign("page_title", $city);
     }
     /*投资人列表*/
     $invester_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "user where " . $condition . " order by create_time desc limit " . $limit);
     foreach ($invester_list as $k => $v) {
         $invester_list[$k]['image'] = get_user_avatar($v["id"], "middle");
         //用户头像
         $invester_list[$k]['user_icon'] = $GLOBALS['user_level'][$v['user_level']]['icon'];
         //用户等级图标
         $invester_list[$k]['cate_name'] = unserialize($v["cate_name"]);
         //所在行业领域
     }
     $invester_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user where " . $condition);
     $GLOBALS['tmpl']->assign("invester_count", $invester_count);
     require APP_ROOT_PATH . 'app/Lib/page.php';
     $page = new Page($invester_count, $page_size);
     //初始化分页对象
     $p = $page->para_show("investor#invester_list", $param);
     $GLOBALS['tmpl']->assign('pages', $p);
     $GLOBALS['tmpl']->assign("invester_list", $invester_list);
     /*融资成功的项目*/
     $deal_success_result = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal where is_success = 1 and is_effect = 1 order by support_count desc ");
     $GLOBALS['tmpl']->assign("deal_success_list", $deal_success_result);
     /*星级投资人*/
     $stars_invester_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "user where investor_status = 1 and is_effect = 1 and (is_investor = 1 or is_investor = 2) order by point desc ");
     foreach ($stars_invester_list as $k => $v) {
         $stars_invester_list[$k]['image'] = get_user_avatar($v["id"], "middle");
         //用户头像
         $stars_invester_list[$k]['user_icon'] = $GLOBALS['user_level'][$v['user_level']]['icon'];
         //用户等级图标
         $stars_invester_list[$k]['cate_name'] = unserialize($v["cate_name"]);
         //所在行业领域
     }
     $GLOBALS['tmpl']->assign("stars_invester_list", $stars_invester_list);
     /*最新投资人*/
     $new_invester = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "user where investor_status = 1 and is_effect = 1 and (is_investor = 1 or is_investor = 2) order by update_time desc ");
     foreach ($new_invester as $kk => $vv) {
         $new_invester[$kk]['image'] = get_user_avatar($vv["id"], "middle");
         //用户头像
         $new_invester[$kk]['user_icon'] = $GLOBALS['user_level'][$vv['user_level']]['icon'];
         //用户等级图标
         $new_invester[$kk]['cate_name'] = unserialize($vv["cate_name"]);
         //所在行业领域
     }
     $GLOBALS['tmpl']->assign("new_invester", $new_invester);
     $GLOBALS['tmpl']->display("invester_list.html");
 }
예제 #16
0
 public function index()
 {
     if (strim($_REQUEST['type']) == 1 && app_conf("INVEST_STATUS") == 1) {
         showErr("股权众筹已经关闭");
     }
     if (app_conf("INVEST_STATUS") == 2 && strim($_REQUEST['type']) == null) {
         showErr("产品众筹已经关闭");
     }
     //links
     $g_links = get_link_by_id(14);
     $GLOBALS['tmpl']->assign("g_links", $g_links);
     $GLOBALS['tmpl']->assign("page_title", "最新动态");
     $param = array();
     //参数集合
     //数据来源参数
     $r = strim($_REQUEST['r']);
     //推荐类型
     $param['r'] = $r ? $r : '';
     $GLOBALS['tmpl']->assign("p_r", $r);
     $id = intval($_REQUEST['id']);
     //分类id
     $param['id'] = $id;
     $GLOBALS['tmpl']->assign("p_id", $id);
     $loc = strim($_REQUEST['loc']);
     //地区
     $param['loc'] = $loc;
     $GLOBALS['tmpl']->assign("p_loc", $loc);
     $state = intval($_REQUEST['state']);
     //状态
     $param['state'] = $state;
     $GLOBALS['tmpl']->assign("p_state", $state);
     $tag = strim($_REQUEST['tag']);
     //标签
     $param['tag'] = $tag;
     $GLOBALS['tmpl']->assign("p_tag", $tag);
     $kw = strim($_REQUEST['k']);
     //关键词
     $param['k'] = $kw;
     $GLOBALS['tmpl']->assign("p_k", $kw);
     $type = intval($_REQUEST['type']);
     //推荐类型
     $param['type'] = $type;
     $GLOBALS['tmpl']->assign("p_type", $type);
     if (intval($_REQUEST['redirect']) == 1) {
         app_redirect(url("aps", $param));
     }
     $cate_list = load_dynamic_cache("INDEX_CATE_LIST");
     if (!$cate_list) {
         $cate_list = $GLOBALS['db']->getAll("select a.* from " . DB_PREFIX . "deal_cate as a where a.is_delete=0 and ( SELECT count( b.id ) AS num FROM xlc_deal AS b WHERE b.cate_id = a.id and b.is_ap>0) >0 order by sort asc");
         set_dynamic_cache("INDEX_CATE_LIST", $cate_list);
     }
     $cate_result = array();
     foreach ($cate_list as $k => $v) {
         if ($v['pid'] == 0) {
             $temp_param = $param;
             $cate_result[$k + 1]['id'] = $v['id'];
             $cate_result[$k + 1]['name'] = $v['name'];
             $temp_param['id'] = $v['id'];
             $cate_result[$k + 1]['url'] = url("aps", $temp_param);
         }
     }
     $GLOBALS['tmpl']->assign("cate_list", $cate_result);
     $pid = $id;
     //获取父类id
     if ($cate_list) {
         $pid = $this->get_child($cate_list, $pid);
     }
     /*子分类 start*/
     $cate_ids = array();
     $is_child = false;
     $temp_cate_ids = array();
     if ($cate_list) {
         $child_cate_result = array();
         foreach ($cate_list as $k => $v) {
             if ($v['pid'] == $pid) {
                 if ($v['id'] > 0) {
                     $temp_param = $param;
                     $child_cate_result[$v['id']]['id'] = $v['id'];
                     $child_cate_result[$v['id']]['name'] = $v['name'];
                     $temp_param['id'] = $v['id'];
                     $child_cate_result[$v['id']]['url'] = url("aps", $temp_param);
                     if ($id == $v['id']) {
                         $is_child = true;
                     }
                 }
             }
             if ($v['pid'] == $pid || $pid == 0) {
                 $temp_cate_ids[] = $v['id'];
             }
         }
     }
     //假如选择了子类 那么使用子类ID  否则使用 父类和其子类
     if ($is_child) {
         $cate_ids[] = $id;
     } else {
         $cate_ids[] = $pid;
         $cate_ids = array_merge($cate_ids, $temp_cate_ids);
     }
     $cate_ids = array_filter($cate_ids);
     $GLOBALS['tmpl']->assign("child_cate_list", $child_cate_result);
     $GLOBALS['tmpl']->assign("pid", $pid);
     /*子分类 end*/
     $city_list = load_dynamic_cache("INDEX_CITY_LIST");
     if (!$city_list) {
         $city_list = $GLOBALS['db']->getAll("select province from " . DB_PREFIX . "deal where is_ap>0 group by province order by sort asc");
         set_dynamic_cache("INDEX_CITY_LIST", $city_list);
     }
     foreach ($city_list as $k => $v) {
         $temp_param = $param;
         $temp_param['loc'] = $v['province'];
         $city_list[$k]['url'] = url("aps", $temp_param);
     }
     $GLOBALS['tmpl']->assign("city_list", $city_list);
     //============region_conf============
     $area_list = $GLOBALS['db']->getAll("select rc.* from " . DB_PREFIX . "region_conf as rc where rc.name in (select province from " . DB_PREFIX . "deal where is_ap>0) or  rc.name in (select city from " . DB_PREFIX . "deal where is_ap>0) or rc.is_hot=1 ");
     $area = array();
     $hot_area = array();
     foreach ($area_list as $k => $v) {
         $temp_param['loc'] = $v['name'];
         $area[strtoupper($v['py'][0])][$v['name']] = array('url' => url("aps", $temp_param), 'name' => $v['name']);
         if ($v['is_hot']) {
             $hot_area[] = array('url' => url("aps", $temp_param), 'name' => $v['name']);
         }
     }
     ksort($area);
     $area_array = array();
     $area_array = array_chunk(array_filter($area), 4, true);
     $area_array_num = array();
     foreach ($area_array as $k => $v) {
         foreach ($v as $k1 => $v1) {
             $area_array_str[$k] .= $k1;
         }
     }
     $GLOBALS['tmpl']->assign("area_array", $area_array);
     $GLOBALS['tmpl']->assign("area_array_str", $area_array_str);
     $GLOBALS['tmpl']->assign("hot_area", array_filter($hot_area));
     //=================region_conf==============
     if ($type == 1) {
         $state_list = array(1 => array("name" => "筹资成功"), 2 => array("name" => "筹资失败"), 3 => array("name" => "融资中"));
     } else {
         $state_list = array(1 => array("name" => "筹资成功"), 2 => array("name" => "筹资失败"), 3 => array("name" => "筹资中"));
     }
     foreach ($state_list as $k => $v) {
         $temp_param = $param;
         $temp_param['state'] = $k;
         $state_list[$k]['url'] = url("aps", $temp_param);
     }
     $GLOBALS['tmpl']->assign("state_list", $state_list);
     $page_size = 10;
     $step_size = 10;
     $step = intval($_REQUEST['step']);
     if ($step == 0) {
         $step = 1;
     }
     $page = intval($_REQUEST['p']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * $page_size + ($step - 1) * $step_size . "," . $step_size;
     $GLOBALS['tmpl']->assign("current_page", $page);
     $condition = " d.is_delete = 0 and d.is_effect = 1 and d.is_ap>0";
     if ($r != "") {
         if ($r == "new") {
             $condition .= " and " . NOW_TIME . " - d.begin_time < " . 24 * 3600 . " and " . NOW_TIME . " - d.begin_time > 0 ";
             //上线不超过一天
             $GLOBALS['tmpl']->assign("page_title", "最新上线");
         }
         if ($r == "rec") {
             $condition .= " and " . NOW_TIME . " <= d.end_time AND " . NOW_TIME . " >= d.begin_time and d.is_recommend = 1 ";
             $GLOBALS['tmpl']->assign("page_title", "推荐项目");
         }
         if ($r == "yure") {
             $condition .= " and " . NOW_TIME . " - d.begin_time < " . 24 * 3600 . " and " . NOW_TIME . " - d.begin_time <  0 ";
             //上线不超过一天
             $GLOBALS['tmpl']->assign("page_title", "正在预热");
         }
         if ($r == "nend") {
             $condition .= " and d.end_time - " . NOW_TIME . " < " . 24 * 3600 . " and d.end_time - " . NOW_TIME . " > 0 ";
             //当天就要结束
             $GLOBALS['tmpl']->assign("page_title", "即将结束");
         }
         if ($r == "classic") {
             $condition .= " and d.is_classic = 1 ";
             $GLOBALS['tmpl']->assign("page_title", "经典项目");
             $GLOBALS['tmpl']->assign("is_classic", true);
         }
         if ($r == "limit_price") {
             $condition .= " and max(d.limit_price) ";
             $GLOBALS['tmpl']->assign("page_title", "最高目标金额");
         }
     }
     switch ($state) {
         //筹资成功
         case 1:
             $condition .= " and d.is_success=1  ";
             $GLOBALS['tmpl']->assign("page_title", "筹资成功");
             break;
             //筹资失败
         //筹资失败
         case 2:
             $condition .= " and d.end_time < " . NOW_TIME . " and d.end_time!=0  and d.is_success=0  ";
             $GLOBALS['tmpl']->assign("page_title", "筹资失败");
             break;
             //筹资中
         //筹资中
         case 3:
             $condition .= " and (d.end_time > " . NOW_TIME . " or d.end_time=0 ) and d.begin_time < " . NOW_TIME . " and d.is_success=0  ";
             $GLOBALS['tmpl']->assign("page_title", "筹资中");
             break;
     }
     if (count($cate_ids) > 0) {
         $condition .= " and d.cate_id in (" . implode(",", $cate_ids) . ")";
         $GLOBALS['tmpl']->assign("page_title", $cate_result[$id]['name']);
     }
     if ($loc != "") {
         $condition .= " and (d.province = '" . $loc . "' or city = '" . $loc . "') ";
         $GLOBALS['tmpl']->assign("page_title", $loc);
     }
     if ($type !== "") {
         $type = intval($type);
         $condition .= " and type={$type} ";
         $GLOBALS['tmpl']->assign("page_title", $loc);
     }
     if ($tag != "") {
         $unicode_tag = str_to_unicode_string($tag);
         $condition .= " and match(d.tags_match) against('" . $unicode_tag . "'  IN BOOLEAN MODE) ";
         $GLOBALS['tmpl']->assign("page_title", $tag);
     }
     if ($kw != "") {
         $kws_div = div_str($kw);
         foreach ($kws_div as $k => $item) {
             $kws[$k] = str_to_unicode_string($item);
         }
         $ukeyword = implode(" ", $kws);
         $condition .= " and (match(d.name_match) against('" . $ukeyword . "'  IN BOOLEAN MODE) or match(d.tags_match) against('" . $ukeyword . "'  IN BOOLEAN MODE)  or d.name like '%" . $kw . "%') ";
         $GLOBALS['tmpl']->assign("page_title", $kw);
     }
     $result = get_deal_list($limit, $condition);
     foreach ($result['list'] as $key => $val) {
         $result['list'][$key]['limit_ap'] = $val['limit_price'] * $val['ap_ratio'];
         $result['list'][$key]['ap_amount'] = $val['support_amount'] * $val['ap_ratio'];
     }
     if ($type == 1) {
         $GLOBALS['tmpl']->assign("deal_list_invest", $result['list']);
     } else {
         $GLOBALS['tmpl']->assign("deal_list", $result['list']);
     }
     $GLOBALS['tmpl']->assign("deal_count", $result['rs_count']);
     $page = new Page($result['rs_count'], $page_size);
     //初始化分页对象
     $p = $page->show();
     $GLOBALS['tmpl']->assign('pages', $p);
     if ($type == 1) {
         $GLOBALS['tmpl']->assign('deal_type', 'gq_type');
     } else {
         $GLOBALS['tmpl']->assign('deal_type', 'product_type');
     }
     if ($GLOBALS['tmpl']->_var['page_title'] == '') {
         $page_title = '';
         if ($type == 1) {
             foreach ($GLOBALS['nav_list'] as $k => $v) {
                 if ($v['u_module'] == 'deals' && $v['u_action'] == 'index' && $v['u_param'] == 'type=1') {
                     $page_title = $v['name'];
                 }
             }
             $page_title = $page_title ? $page_title : '股权项目';
         } else {
             foreach ($GLOBALS['nav_list'] as $k => $v) {
                 if ($v['u_module'] == 'deals' && $v['u_action'] == 'index' && $v['u_param'] == '') {
                     $page_title = $v['name'];
                 }
             }
             $page_title = $page_title ? $page_title : '产品项目';
         }
         $GLOBALS['tmpl']->assign("page_title", $page_title);
     }
     $GLOBALS['tmpl']->display("aps_index.html");
 }
예제 #17
0
function url_wap($route = "index", $param = array())
{
    $key = md5("URL_KEY_" . $route . serialize($param));
    if (isset($GLOBALS[$key])) {
        $url = $GLOBALS[$key];
        return $url;
    }
    $url = load_dynamic_cache($key);
    if ($url !== false) {
        $GLOBALS[$key] = $url;
        return $url;
    }
    $route_array = explode("#", $route);
    if (isset($param) && $param != '' && !is_array($param)) {
        $param['id'] = $param;
    }
    $module = strtolower(trim($route_array[0]));
    $action = strtolower(trim($route_array[1]));
    if (!$module || $module == 'index') {
        $module = "";
    }
    if (!$action || $action == 'index') {
        $action = "";
    }
    if (true) {
        //原始模式
        $url = APP_ROOT . "/wap/index.php";
        if ($module != '' || $action != '' || count($param) > 0) {
            $url .= "?";
        }
        if ($module && $module != '') {
            $url .= "ctl=" . $module . "&";
        }
        if ($action && $action != '') {
            $url .= "act=" . $action . "&";
        }
        if (count($param) > 0) {
            foreach ($param as $k => $v) {
                if ($k && $v) {
                    $url = $url . $k . "=" . urlencode($v) . "&";
                }
            }
        }
        if (substr($url, -1, 1) == '&' || substr($url, -1, 1) == '?') {
            $url = substr($url, 0, -1);
        }
        $GLOBALS[$key] = $url;
        set_dynamic_cache($key, $url);
        return $url;
    } else {
        //重写的默认
        $url = APP_ROOT . "/wap";
        if ($module && $module != '') {
            $url .= "/" . $module;
        }
        if ($action && $action != '') {
            $url .= "-" . $action;
        }
        if (count($param) > 0) {
            $url .= "/";
            foreach ($param as $k => $v) {
                $url = $url . $k . "-" . urlencode($v) . "-";
            }
        }
        $route = $module . "#" . $action;
        switch ($route) {
            case "xxx":
                break;
            default:
                break;
        }
        if (substr($url, -1, 1) == '/' || substr($url, -1, 1) == '-') {
            $url = substr($url, 0, -1);
        }
        if ($url == '') {
            $url = "/";
        }
        $GLOBALS[$key] = $url;
        set_dynamic_cache($key, $url);
        return $url;
    }
}
예제 #18
0
/**
 * 链接到mapi/html
 */
function url_mapi_html($route = "index", $param = array())
{
    $key = md5("URL_MAPI_HTML_KEY_" . $route . serialize($param));
    if (isset($GLOBALS[$key])) {
        $url = $GLOBALS[$key];
        return $url;
    }
    $url = load_dynamic_cache($key);
    if ($url !== false) {
        $GLOBALS[$key] = $url;
        return $url;
    }
    $route_array = explode("#", $route);
    if (isset($param) && $param != '' && !is_array($param)) {
        $param['id'] = $param;
    }
    $module = strtolower(trim($route_array[0]));
    $action = strtolower(trim($route_array[1]));
    if (!$module || $module == 'index') {
        $module = "";
    }
    if (!$action || $action == 'index') {
        $action = "";
    }
    //原始模式
    $html_app_root = str_replace('/mapi/html', "", APP_ROOT);
    $html_app_root = str_replace('/mapi', "", APP_ROOT);
    $url = $html_app_root . "/mapi/html/index.php";
    if ($module != '' || $action != '' || count($param) > 0) {
        $url .= "?";
    }
    if ($module && $module != '') {
        $url .= "ctl=" . $module . "&";
    }
    if ($action && $action != '') {
        $url .= "act=" . $action . "&";
    }
    if (count($param) > 0) {
        foreach ($param as $k => $v) {
            if ($k && $v) {
                $url = $url . $k . "=" . urlencode($v) . "&";
            }
        }
    }
    if (substr($url, -1, 1) == '&' || substr($url, -1, 1) == '?') {
        $url = substr($url, 0, -1);
    }
    $GLOBALS[$key] = $url;
    set_dynamic_cache($key, $url);
    return $url;
}
예제 #19
0
파일: index.php 프로젝트: xinlechou/wap
}
$GLOBALS['tmpl']->assign("site_name", $m_config['program_title'] ? $m_config['program_title'] : app_conf("SITE_NAME"));
$GLOBALS['tmpl']->assign("site_logo", $m_config['logo'] ? $m_config['logo'] : app_conf("SITE_LOGO"));
$class = strtolower(strim($_REQUEST['ctl'])) ? strtolower(strim($_REQUEST['ctl'])) : "index";
$act2 = strtolower(strim($_REQUEST['act'])) ? strtolower(strim($_REQUEST['act'])) : "index";
$city_id = intval($request['city_id']);
define('ACT', $class);
//act常量
define('ACT_2', $act2);
$GLOBALS['tmpl']->assign("class", $class);
$GLOBALS['tmpl']->assign("act", $act2);
get_pre_wap();
$cate_list = load_dynamic_cache("INDEX_CATE_LIST");
if (!$cate_list) {
    $cate_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate order by sort asc");
    set_dynamic_cache("INDEX_CATE_LIST", $cate_list);
}
$is_weixin = isWeixin();
$GLOBALS['tmpl']->assign("is_weixin", $is_weixin);
$GLOBALS['tmpl']->assign("cate_list", $cate_list);
if ($_REQUEST['code'] && $_REQUEST['state'] == 1 && $m_config['wx_appid'] && $m_config['wx_secrit'] && !$user_info) {
    //file_put_contents('./t.txt',var_export($_REQUEST,TRUE)."\n",FILE_APPEND);
    //require '../system/utils/weixin.php';
    $weixin = new weixin($m_config['wx_appid'], $m_config['wx_secrit'], get_domain() . APP_ROOT . "/wap");
    $wx_info = $weixin->scope_get_userinfo($_REQUEST['code']);
    if ($wx_info['openid']) {
        $wx_user_info = get_user_has('wx_openid', $wx_info['openid']);
        if ($wx_user_info) {
            require_once APP_ROOT_PATH . "system/libs/user.php";
            //如果会员存在,直接登录
            do_login_user($wx_user_info['mobile'], $wx_user_info['user_pwd']);
예제 #20
0
 public function index()
 {
     $GLOBALS['tmpl']->assign("page_title", "最新动态");
     $param = array();
     //参数集合
     //数据来源参数
     $r = strim($_REQUEST['r']);
     //推荐类型
     $param['r'] = $r ? $r : '';
     $GLOBALS['tmpl']->assign("p_r", $r);
     $id = intval($_REQUEST['id']);
     //分类id
     $param['id'] = $id;
     $GLOBALS['tmpl']->assign("p_id", $id);
     $loc = strim($_REQUEST['loc']);
     //地区
     $param['loc'] = $loc;
     $GLOBALS['tmpl']->assign("p_loc", $loc);
     $state = intval($_REQUEST['state']);
     //状态
     $param['state'] = $state;
     $GLOBALS['tmpl']->assign("p_state", $state);
     $tag = strim($_REQUEST['tag']);
     //标签
     $param['tag'] = $tag;
     $GLOBALS['tmpl']->assign("p_tag", $tag);
     $kw = strim($_REQUEST['k']);
     //关键词
     $param['k'] = $kw;
     $GLOBALS['tmpl']->assign("p_k", $kw);
     $type = intval($_REQUEST['type']);
     //推荐类型
     $param['type'] = $type;
     $GLOBALS['tmpl']->assign("p_type", $type);
     if (intval($_REQUEST['redirect']) == 1) {
         $param = array();
         if ($r != "") {
             $param = array_merge($param, array("r" => $r));
         }
         if ($id > 0) {
             $param = array_merge($param, array("id" => $id));
         }
         if ($loc != "") {
             $param = array_merge($param, array("loc" => $loc));
         }
         if ($state != "") {
             $param = array_merge($param, array("state" => $state));
         }
         if ($tag != "") {
             $param = array_merge($param, array("tag" => $tag));
         }
         if ($kw != "") {
             $param = array_merge($param, array("k" => $kw));
         }
         if ($type != "") {
             $param = array_merge($param, array("type" => $type));
         }
         app_redirect(url_wap("deals", $param));
     }
     $image_list = load_dynamic_cache("INDEX_IMAGE_LIST");
     if ($image_list === false) {
         $image_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "index_image order by sort asc");
         set_dynamic_cache("INDEX_IMAGE_LIST", $image_list);
     }
     $GLOBALS['tmpl']->assign("image_list", $image_list);
     $cate_list = load_dynamic_cache("INDEX_CATE_LIST");
     if (!$cate_list) {
         $cate_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate order by sort asc");
         set_dynamic_cache("INDEX_CATE_LIST", $cate_list);
     }
     $cate_result = array();
     foreach ($cate_list as $k => $v) {
         if ($v['pid'] == 0) {
             $temp_param = $param;
             $cate_result[$v['id']]['id'] = $v['id'];
             $cate_result[$v['id']]['name'] = $v['name'];
             $temp_param['id'] = $v['id'];
             $cate_result[$v['id']]['url'] = url_wap("deals", $temp_param);
         } else {
             if ($v['pid'] > 0) {
                 $temp_param['id'] = $v['id'];
                 $cate_result[$v['pid']]['child'][] = array('id' => $v['id'], 'name' => $v['name'], 'url' => url_wap("deals", $temp_param));
             }
         }
         if ($v['id'] == $id) {
             $GLOBALS['tmpl']->assign("cate_name", $v['name']);
         }
     }
     $GLOBALS['tmpl']->assign("cate_list", $cate_result);
     $pid = $id;
     //获取父类id
     if ($cate_list) {
         $pid = $this->get_child($cate_list, $pid);
     }
     /*子分类 start*/
     $cate_ids = array();
     $is_child = false;
     $temp_cate_ids = array();
     if ($cate_list) {
         $child_cate_result = array();
         foreach ($cate_list as $k => $v) {
             if ($v['pid'] == $pid) {
                 if ($v['id'] > 0) {
                     $temp_param = $param;
                     $child_cate_result[$v['id']]['id'] = $v['id'];
                     $child_cate_result[$v['id']]['name'] = $v['name'];
                     $temp_param['id'] = $v['id'];
                     $child_cate_result[$v['id']]['url'] = url_wap("deals", $temp_param);
                     if ($id == $v['id']) {
                         $is_child = true;
                     }
                 }
             }
             if ($v['pid'] == $pid || $pid == 0) {
                 $temp_cate_ids[] = $v['id'];
             }
         }
     }
     //假如选择了子类 那么使用子类ID  否则使用 父类和其子类
     if ($is_child) {
         $cate_ids[] = $id;
     } else {
         $cate_ids[] = $pid;
         $cate_ids = array_merge($cate_ids, $temp_cate_ids);
     }
     $cate_ids = array_filter($cate_ids);
     $GLOBALS['tmpl']->assign("child_cate_list", $child_cate_result);
     $GLOBALS['tmpl']->assign("pid", $pid);
     /*子分类 end*/
     $city_list = load_dynamic_cache("INDEX_CITY_LIST");
     if ($type == 1) {
         if (!$city_list) {
             $city_list = $GLOBALS['db']->getAll("select province from " . DB_PREFIX . "deal where type=1 and is_effect =1 group by province  order by sort asc");
             //	set_dynamic_cache("INDEX_CITY_LIST",$city_list);
         }
     }
     if ($type == 0) {
         if (!$city_list) {
             $city_list = $GLOBALS['db']->getAll("select province from " . DB_PREFIX . "deal where type=0 and is_effect =1 group by province  order by sort asc");
             //	set_dynamic_cache("INDEX_CITY_LIST",$city_list);
         }
     }
     foreach ($city_list as $k => $v) {
         $temp_param = $param;
         $temp_param['loc'] = $v['province'];
         $city_list[$k]['url'] = url_wap("deals", $temp_param);
         if ($v['id']) {
             $child = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "region_conf where pid=" . $v['id']);
             if ($child) {
                 foreach ($child as $k1 => $v1) {
                     $temp_param['loc'] = $v1['name'];
                     $child[$k1]['url'] = url_wap("deals", $temp_param);
                 }
                 $city_list[$k]['child'] = $child;
             }
         }
     }
     $GLOBALS['tmpl']->assign("city_list", $city_list);
     //=================region_conf==============
     $state_list = array(1 => array("name" => "筹资成功"), 2 => array("name" => "筹资失败"), 3 => array("name" => "筹资中"));
     foreach ($state_list as $k => $v) {
         $temp_param = $param;
         $temp_param['state'] = $k;
         $state_list[$k]['url'] = url_wap("deals", $temp_param);
     }
     if ($state == 0) {
         $GLOBALS['tmpl']->assign("state_name", "所有项目");
     } else {
         $GLOBALS['tmpl']->assign("state_name", $state_list[$state]['name']);
     }
     $GLOBALS['tmpl']->assign("state_list", $state_list);
     $page_size = PAGE_SIZE;
     $step_size = PAGE_SIZE;
     $step = intval($_REQUEST['step']);
     if ($step == 0) {
         $step = 1;
     }
     $page = intval($_REQUEST['p']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * $page_size + ($step - 1) * $step_size . "," . $step_size;
     $GLOBALS['tmpl']->assign("current_page", $page);
     $condition = " d.is_delete = 0 and d.is_effect = 1 ";
     if ($r != "") {
         if ($r == "new") {
             $condition .= " and " . NOW_TIME . " - d.begin_time < " . 7 * 24 * 3600 . " and " . NOW_TIME . " - d.begin_time > 0 ";
             //上线不超过一天
             $GLOBALS['tmpl']->assign("page_title", "最新上线");
         } elseif ($r == "rec") {
             $condition .= " and d.is_recommend = 1 ";
             $GLOBALS['tmpl']->assign("page_title", "推荐项目");
         } elseif ($r == "yure") {
             $condition .= "   and " . NOW_TIME . " <  d.begin_time ";
             $GLOBALS['tmpl']->assign("page_title", "正在预热");
         } elseif ($r == "nend") {
             $condition .= " and d.end_time - " . NOW_TIME . " < " . 7 * 24 * 3600 . " and d.end_time - " . NOW_TIME . " > 0 ";
             //三天就要结束
             $GLOBALS['tmpl']->assign("page_title", "即将结束");
         } elseif ($r == "classic") {
             $condition .= " and d.is_classic = 1 ";
             $GLOBALS['tmpl']->assign("page_title", "经典项目");
             $GLOBALS['tmpl']->assign("is_classic", true);
         } elseif ($r == "limit_price") {
             $condition .= " and max(d.limit_price) ";
             $GLOBALS['tmpl']->assign("page_title", "最高目标金额");
         }
     }
     switch ($state) {
         //筹资成功
         case 1:
             $condition .= " and d.is_success=1  and d.end_time < " . NOW_TIME;
             $GLOBALS['tmpl']->assign("page_title", "筹资成功");
             break;
             //筹资失败
         //筹资失败
         case 2:
             $condition .= " and d.end_time < " . NOW_TIME . " and d.end_time!=0  and d.is_success=0  ";
             $GLOBALS['tmpl']->assign("page_title", "筹资失败");
             break;
             //筹资中
         //筹资中
         case 3:
             $condition .= " and (d.end_time > " . NOW_TIME . " or d.end_time=0 ) and d.begin_time < " . NOW_TIME . "   ";
             $GLOBALS['tmpl']->assign("page_title", "筹资中");
             break;
     }
     if (count($cate_ids) > 0) {
         $condition .= " and d.cate_id in (" . implode(",", $cate_ids) . ")";
         $GLOBALS['tmpl']->assign("page_title", $cate_result[$id]['name']);
     }
     if ($loc != "") {
         $condition .= " and (d.province = '" . $loc . "' or city = '" . $loc . "') ";
         $GLOBALS['tmpl']->assign("page_title", $loc);
     }
     if ($tag != "") {
         $unicode_tag = str_to_unicode_string($tag);
         $condition .= " and match(d.tags_match) against('" . $unicode_tag . "'  IN BOOLEAN MODE) ";
         $GLOBALS['tmpl']->assign("page_title", $tag);
     }
     if ($type !== "") {
         $type = intval($type);
         $condition .= " and type={$type} ";
     }
     if ($kw != "") {
         $kws_div = div_str($kw);
         foreach ($kws_div as $k => $item) {
             $kws[$k] = str_to_unicode_string($item);
         }
         $ukeyword = implode(" ", $kws);
         $condition .= " and (match(d.name_match) against('" . $ukeyword . "'  IN BOOLEAN MODE) or match(d.tags_match) against('" . $ukeyword . "'  IN BOOLEAN MODE)  or d.name like '%" . $kw . "%') ";
         $GLOBALS['tmpl']->assign("page_title", $kw);
     }
     $result = get_deal_list($limit, $condition);
     foreach ($result['list'] as $k => $v) {
     }
     $GLOBALS['tmpl']->assign("deal_list", $result['list']);
     $GLOBALS['tmpl']->assign("deal_count", intval($result['rs_count']));
     $page = new Page($result['rs_count'], $page_size);
     //初始化分页对象
     $p = $page->show();
     $GLOBALS['tmpl']->assign('pages', $p);
     $GLOBALS['tmpl']->assign("usermessage_url", url_wap("ajax#usermessage", array("id" => intval($GLOBALS['user_info']['id']))));
     $GLOBALS['tmpl']->display("deals_index.html");
 }
예제 #21
0
 public function fav()
 {
     $GLOBALS['tmpl']->assign("page_title", "最新动态");
     if (!$GLOBALS['user_info']) {
         app_redirect(url("user#login"));
     }
     $GLOBALS['tmpl']->assign("page_title", "我关注的项目动态");
     $cate_result = load_dynamic_cache("INDEX_CATE_LIST");
     if ($cate_result === false) {
         $cate_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate order by sort asc");
         $cate_result = array();
         foreach ($cate_list as $k => $v) {
             $cate_result[$v['id']] = $v;
         }
         set_dynamic_cache("INDEX_CATE_LIST", $cate_result);
     }
     $GLOBALS['tmpl']->assign("cate_list", $cate_result);
     if (app_conf("INVEST_STATUS") == 0) {
         $condition = " 1=1 ";
     } elseif (app_conf("INVEST_STATUS") == 1) {
         $condition = " type=0 ";
     } elseif (app_conf("INVEST_STATUS") == 2) {
         $condition = " type=1 ";
     }
     $rand_deals = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal where {$condition} and is_delete = 0 and is_effect = 1 and begin_time < " . NOW_TIME . " and (end_time >" . NOW_TIME . " or end_time = 0) order by rand() limit 3");
     $GLOBALS['tmpl']->assign("rand_deals", $rand_deals);
     $page_size = DEALUPDATE_PAGE_SIZE;
     $step_size = DEALUPDATE_STEP_SIZE;
     $step = intval($_REQUEST['step']);
     if ($step == 0) {
         $step = 1;
     }
     $page = intval($_REQUEST['p']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * $page_size + ($step - 1) * $step_size . "," . $step_size;
     $GLOBALS['tmpl']->assign("current_page", $page);
     if (app_conf("INVEST_STATUS") == 0) {
         $condition = " 1=1 ";
     } elseif (app_conf("INVEST_STATUS") == 1) {
         $condition = " de.type=0 ";
     } elseif (app_conf("INVEST_STATUS") == 2) {
         $condition = " de.type=1 ";
     }
     $sql = "select dl.* from " . DB_PREFIX . "deal_log as dl left join " . DB_PREFIX . "deal_focus_log as dfl on dl.deal_id = dfl.deal_id left join " . DB_PREFIX . "deal as de on de.id=dl.deal_id where {$condition} and dfl.user_id = " . intval($GLOBALS['user_info']['id']) . " order by dl.create_time desc limit " . $limit;
     $sql_count = "select count(*) from " . DB_PREFIX . "deal_log as dl left join " . DB_PREFIX . "deal_focus_log as dfl on dl.deal_id = dfl.deal_id left join " . DB_PREFIX . "deal as de on de.id=dl.deal_id where {$condition} and dfl.user_id = " . intval($GLOBALS['user_info']['id']);
     $log_list = $GLOBALS['db']->getAll($sql);
     $log_count = $GLOBALS['db']->getOne($sql_count);
     /*(最新动态)准备虚拟数据 start*/
     if ($log_count > 0) {
         $deal_item_ids = array();
         foreach ($log_list as $k => $v) {
             $log_list[$k]['pass_time'] = pass_date($v['create_time']);
             $log_list[$k] = cache_log_comment($log_list[$k]);
             $log_list[$k] = cache_log_deal($log_list[$k]);
             //$log_list[$k]['deal_info']['lin']=8;放进去
             //得到页面项目的ID
             $deal_item_ids[] = $log_list[$k]['deal_info']['id'];
         }
         //获得每个项目下的所有子项目信息
         $temp_deal_item_List = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_item where deal_id in(" . implode(",", $deal_item_ids) . ") order by deal_id desc");
         $virtual_price_list = array();
         //重新组装一个以项目ID为KEY的虚拟价格
         foreach ($temp_deal_item_List as $k => $v) {
             $virtual_price_list[$v['deal_id']]['total_virtual_price'] += $v['price'] * $v['virtual_person'];
         }
         unset($temp_deal_item_List);
         //放到项目动态表里面进行统计
         foreach ($log_list as $k => $v) {
             $log_list[$k]['deal_info']['percent'] = round(($v['deal_info']['support_amount'] + $virtual_price_list[$v['deal_id']]['total_virtual_price']) / $v['deal_info']['limit_price'] * 100, 2);
             $log_list[$k]['deal_info']['support_amount'] += $virtual_price_list[$v['deal_id']]['total_virtual_price'];
         }
     }
     /*(最新动态)准备虚拟数据 end*/
     $GLOBALS['tmpl']->assign('log_list', $log_list);
     $pager = new Page($log_count, $page_size);
     //初始化分页对象
     $p = $pager->show();
     $GLOBALS['tmpl']->assign('pages', $p);
     $GLOBALS['tmpl']->assign("ajaxurl", url("ajax#newsfav", array("p" => $page)));
     $GLOBALS['tmpl']->display("news.html");
 }
예제 #22
0
 public function deals()
 {
     $filter_parms = array();
     $filter_parms['type'] = $type = isset($_REQUEST['type']) ? intval($_REQUEST['type']) : 0;
     //起购金额
     $filter_parms['money'] = $money = isset($_REQUEST['money']) ? intval($_REQUEST['money']) : 0;
     //年化收益
     $filter_parms['rate'] = $rate = isset($_REQUEST['rate']) ? intval($_REQUEST['rate']) : 0;
     $filter_parms['sortby'] = $sortby = isset($_REQUEST['sortby']) ? strim($_REQUEST['sortby']) : "";
     $filter_parms['descby'] = $descby = isset($_REQUEST['descby']) ? strtoupper(strim($_REQUEST['descby'])) : "DESC";
     $page_size = 7;
     $page = intval($_REQUEST['p']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * $page_size . "," . $page_size;
     $condition = " status = 1 ";
     if ($type != "") {
         $condition .= " AND `type` = {$type}  ";
     }
     if ($money != 0) {
         switch ($money) {
             case 1:
                 $condition .= " AND min_money <= 1000 ";
                 break;
             case 2:
                 $condition .= " AND min_money >= 1000 AND min_money <=10000  ";
                 break;
             case 3:
                 $condition .= " AND min_money >= 10000 AND min_money <=30000  ";
                 break;
             case 4:
                 $condition .= " AND min_money >= 30000 AND min_money <=50000  ";
                 break;
             case 5:
                 $condition .= " AND min_money >= 50000 AND min_money <=100000  ";
                 break;
             case 6:
                 $condition .= " AND min_money >= 100000 AND min_money <=150000  ";
                 break;
             case 7:
                 $condition .= " AND min_money >= 150000 AND min_money <=200000  ";
                 break;
             case 8:
                 $condition .= " AND min_money >= 200000 ";
                 break;
         }
     }
     if ($rate != 0) {
         switch ($rate) {
             case 1:
                 $condition .= " AND average_income_rate <= 4.5 ";
                 break;
             case 2:
                 $condition .= " AND average_income_rate between 4.5 AND  5.6  ";
                 break;
             case 3:
                 $condition .= " AND average_income_rate between 5.6 AND 6  ";
                 break;
             case 4:
                 $condition .= " AND average_income_rate between 6 AND  7  ";
                 break;
             case 5:
                 $condition .= " AND average_income_rate between 7 AND  8  ";
                 break;
             case 6:
                 $condition .= " AND average_income_rate between 8 AND 9  ";
                 break;
             case 7:
                 $condition .= " AND average_income_rate >= 9  ";
                 break;
         }
     }
     $orderBy = "`sort` DESC,id DESC";
     if ($sortby != "") {
         $orderBy = $sortby . " " . $descby . ", `sort` DESC,id DESC ";
     }
     $result = get_licai_list($condition, $orderBy, $limit);
     $GLOBALS['tmpl']->assign("list", $result['list']);
     $page = new Page($result['rs_count'], $page_size);
     //初始化分页对象
     $p = $page->para_show("licai#deals", $filter_parms);
     $GLOBALS['tmpl']->assign('pages', $p);
     $money_arr = array("0" => "全部", "1" => "1000≤", "2" => "1000-1万元", "3" => "1-3万元", "4" => "3-5万元", "5" => "5-10万元", "6" => "10-15万元", "7" => "15-20万元", "8" => "≥20万元");
     $money_url = array();
     foreach ($money_arr as $k => $v) {
         $tmp_filter = $filter_parms;
         $tmp_filter['money'] = $k;
         $money_url[$k]['name'] = $v;
         $money_url[$k]['selected'] = $k == $money ? 1 : 0;
         $money_url[$k]['url'] = url("licai#deals", $tmp_filter);
     }
     $GLOBALS['tmpl']->assign('money_url', $money_url);
     $rate_arr = array("0" => "全部", "1" => "4.50%以下", "2" => "4.50%-5.60%", "3" => "5.60%-6.00%", "4" => "6.00%-7.00%", "5" => "7.00%-8.00%", "6" => "8.00%-9.00%", "7" => "9.00%以上");
     $rate_url = array();
     foreach ($rate_arr as $k => $v) {
         $tmp_filter = $filter_parms;
         $tmp_filter['rate'] = $k;
         $rate_url[$k]['name'] = $v;
         $rate_url[$k]['selected'] = $k == $rate ? 1 : 0;
         $rate_url[$k]['url'] = url("licai#deals", $tmp_filter);
     }
     $GLOBALS['tmpl']->assign('rate_url', $rate_url);
     $orderby_arr = array("0" => array("name" => "全部产品", "key" => ""), "1" => array("name" => "起购金额", "key" => "min_money"), "2" => array("name" => "年化利率", "key" => "average_income_rate"), "3" => array("name" => "成交总额", "key" => "subscribing_amount"));
     $orderby_url = array();
     foreach ($orderby_arr as $k => $v) {
         $tmp_filter = $filter_parms;
         $tmp_filter['sortby'] = $v['key'];
         $orderby_url[$k]['key'] = $v['key'];
         $orderby_url[$k]['name'] = $v['name'];
         $orderby_url[$k]['selected'] = $v['key'] == $sortby ? 1 : 0;
         if ($orderby_url[$k]['selected'] == 1) {
             $tmp_filter['descby'] = $descby == "DESC" ? "ASC" : "DESC";
             $orderby_url[$k]['descby'] = $descby;
         } else {
             $tmp_filter['descby'] = "DESC";
             $orderby_url[$k]['descby'] = "DESC";
         }
         $orderby_url[$k]['url'] = url("licai#deals", $tmp_filter);
     }
     $GLOBALS['tmpl']->assign('orderby_url', $orderby_url);
     $GLOBALS['tmpl']->assign('descby', $descby);
     $image_list = load_dynamic_cache("INDEX_IMAGE_LIST");
     if ($image_list === false) {
         $image_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "index_image order by sort asc");
         set_dynamic_cache("INDEX_IMAGE_LIST", $image_list);
     }
     $GLOBALS['tmpl']->assign("image_list", $image_list);
     // 猜你喜欢
     $hot_list = get_licai_list($condition, "sort DESC,subscribing_amount DESC", $limit);
     $GLOBALS['tmpl']->assign("hot_list", $hot_list['list']);
     $rectype_list = get_licai_list("re_type > 0 and status=1 and is_recommend = 1", "sort DESC,id DESC", 3);
     $GLOBALS['tmpl']->assign("rectype_list", $rectype_list['list']);
     //为客户创造收益
     //$user_income = floatval($GLOBALS['db']->getOneCached("select sum(earn_money) from ".DB_PREFIX."user_log WHERE `type`=9 "));
     $user_income = floatval($GLOBALS['db']->getOneCached("select sum(earn_money) from " . DB_PREFIX . "licai_redempte"));
     $GLOBALS['tmpl']->assign("user_income", $user_income);
     $GLOBALS['tmpl']->display("licai/licai_deals.html");
 }