本文整理汇总了PHP中str_to_unicode_string函数的典型用法代码示例。如果您正苦于以下问题:PHP str_to_unicode_string函数的具体用法?PHP str_to_unicode_string怎么用?PHP str_to_unicode_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了str_to_unicode_string函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
//require APP_ROOT_PATH.'app/Lib/page.php';
$page = intval($GLOBALS['request']['page']);
if ($page == 0) {
$page = 1;
}
$keywords = trim(htmlspecialchars($GLOBALS['request']['keywords']));
$level = intval($GLOBALS['request']['level']);
$interest = intval($GLOBALS['request']['interest']);
$months = intval($GLOBALS['request']['months']);
$lefttime = intval($GLOBALS['request']['lefttime']);
$deal_status = intval($GLOBALS['request']['deal_status']);
$limit = ($page - 1) * app_conf("DEAL_PAGE_SIZE") . "," . app_conf("DEAL_PAGE_SIZE");
$level_list = load_auto_cache("level");
$cate_id = intval($GLOBALS['request']['cid']);
$n_cate_id = 0;
$condition = " publish_wait = 0 ";
$orderby = "";
if ($cate_id > 0) {
$n_cate_id = $cate_id;
//$condition .= "AND deal_status in(0,1)";
$orderby = "update_time DESC ,sort DESC,id DESC";
} else {
$n_cate_id = 0;
$orderby = "update_time DESC , sort DESC , id DESC";
}
if ($keywords) {
$kw_unicode = str_to_unicode_string($keywords);
$condition .= " and (match(name_match,deal_cate_match,tag_match,type_match) against('" . $kw_unicode . "' IN BOOLEAN MODE))";
}
if ($level > 0) {
$point = $level_list['point'][$level];
$condition .= " AND user_id in(SELECT u.id FROM " . DB_PREFIX . "user u LEFT JOIN " . DB_PREFIX . "user_level ul ON ul.id=u.level_id WHERE ul.point >= {$point})";
}
if ($interest > 0) {
$condition .= " AND rate >= " . $interest;
}
if ($months > 0) {
if ($months == 12) {
$condition .= " AND repay_time <= " . $months;
} elseif ($months == 18) {
$condition .= " AND repay_time >= " . $months;
}
}
if ($lefttime > 0) {
$condition .= " AND (start_time + enddate*24*3600 - " . TIME_UTC . ") <= " . $lefttime * 24 * 3600;
}
if ($deal_status > 0) {
$condition .= " AND deal_status = " . $deal_status;
}
$result = get_deal_list($limit, $n_cate_id, $condition, $orderby);
$root = array();
$root['response_code'] = 1;
$root['item'] = $result['list'];
//$root['DEAL_PAGE_SIZE'] = app_conf("DEAL_PAGE_SIZE");
//$root['count'] = $result['count'];
$root['page'] = array("page" => $page, "page_total" => ceil($result['count'] / app_conf("DEAL_PAGE_SIZE")));
output($root);
}
示例2: load
public function load($param)
{
$param = array("cid" => $param['cid']);
$key = $this->build_key(__CLASS__, $param);
$GLOBALS['cache']->set_dir(APP_ROOT_PATH . "public/runtime/data/" . __CLASS__ . "/");
$key_result = $GLOBALS['cache']->get($key);
if ($key_result === false) {
$param['cid'] = intval($GLOBALS['db']->getOne("select id from " . DB_PREFIX . "shop_cate where id = " . intval($param['cid'])));
$key = $this->build_key(__CLASS__, $param);
$GLOBALS['cache']->set_dir(APP_ROOT_PATH . "public/runtime/data/" . __CLASS__ . "/");
$key_result = $GLOBALS['cache']->get($key);
if ($key_result !== false) {
return $key_result;
}
$cate_id = $param['cid'];
require_once APP_ROOT_PATH . "system/utils/child.php";
$ids_util = new child("shop_cate");
$ids = $ids_util->getChildIds($cate_id);
$ids[] = $cate_id;
$deal_cate = $GLOBALS['db']->getAll("select name from " . DB_PREFIX . "shop_cate where id in (" . implode(",", $ids) . ") and is_effect = 1 and is_delete = 0");
foreach ($deal_cate as $k => $item) {
$name_words = div_str($item['name']);
foreach ($name_words as $kk => $vv) {
$kw[] = str_to_unicode_string($vv);
}
}
$key_result = implode(" ", $kw);
$GLOBALS['cache']->set_dir(APP_ROOT_PATH . "public/runtime/data/" . __CLASS__ . "/");
$GLOBALS['cache']->set($key, $key_result);
}
return $key_result;
}
示例3: index
public function index()
{
//输出团购城市
$city_list = M("DealCity")->where('is_delete = 0')->findAll();
$city_list = D("DealCity")->toFormatTree($city_list, 'name');
$this->assign("city_list", $city_list);
//分类
$cate_tree = M("DealCate")->where('is_delete = 0')->findAll();
$cate_tree = D("DealCate")->toFormatTree($cate_tree, 'name');
$this->assign("cate_tree", $cate_tree);
//开始加载搜索条件
if (intval($_REQUEST['id']) > 0) {
$map['id'] = intval($_REQUEST['id']);
}
$map['is_delete'] = 0;
if (strim($_REQUEST['name']) != '') {
$map['name'] = array('like', '%' . strim($_REQUEST['name']) . '%');
}
if (intval($_REQUEST['city_id']) > 0) {
require_once APP_ROOT_PATH . "system/utils/child.php";
$child = new Child("deal_city");
$city_ids = $child->getChildIds(intval($_REQUEST['city_id']));
$city_ids[] = intval($_REQUEST['city_id']);
$map['city_id'] = array("in", $city_ids);
}
if (intval($_REQUEST['cate_id']) > 0) {
require_once APP_ROOT_PATH . "system/utils/child.php";
$child = new Child("deal_cate");
$cate_ids = $child->getChildIds(intval($_REQUEST['cate_id']));
$cate_ids[] = intval($_REQUEST['cate_id']);
$map['cate_id'] = array("in", $cate_ids);
}
if (strim($_REQUEST['supplier_name']) != '') {
if (intval($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "supplier")) < 50000) {
$sql = "select group_concat(id) from " . DB_PREFIX . "supplier where name like '%" . strim($_REQUEST['supplier_name']) . "%'";
} else {
$kws_div = div_str(trim($_REQUEST['supplier_name']));
foreach ($kws_div as $k => $item) {
$kw[$k] = str_to_unicode_string($item);
}
$kw_unicode = implode(" ", $kw);
$sql = "select group_concat(id) from " . DB_PREFIX . "supplier where (match(name_match) against('" . $kw_unicode . "' IN BOOLEAN MODE))";
}
$ids = $GLOBALS['db']->getOne($sql);
$map['supplier_id'] = array("in", $ids);
}
$map['publish_wait'] = 0;
$map['is_shop'] = 0;
if (method_exists($this, '_filter')) {
$this->_filter($map);
}
$name = $this->getActionName();
$model = D($name);
if (!empty($model)) {
$this->_list($model, $map);
}
$this->display();
return;
}
示例4: index
public function index()
{
$page_idx = intval($_REQUEST['p']) == 0 ? 1 : intval($_REQUEST['p']);
$page_size = C('PAGE_LISTROWS');
$limit = ($page_idx - 1) * $page_size . "," . $page_size;
if (isset($_REQUEST['_order'])) {
$order = $_REQUEST['_order'];
}
//排序方式默认按照倒序排列
//接受 sost参数 0 表示倒序 非0都 表示正序
if (isset($_REQUEST['_sort'])) {
$sort = $_REQUEST['_sort'] ? 'asc' : 'desc';
} else {
$sort = 'desc';
}
if (isset($order)) {
$orderby = "order by " . $order . " " . $sort;
} else {
$orderby = "";
}
if (trim($_REQUEST['name']) != '') {
$total = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "supplier");
if ($total < 50000) {
$list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "supplier where name like '%" . trim($_REQUEST['name']) . "%' {$orderby} limit " . $limit);
$total = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "supplier where name like '%" . trim($_REQUEST['name']) . "%'");
} else {
$kws_div = div_str(trim($_REQUEST['name']));
foreach ($kws_div as $k => $item) {
$kw[$k] = str_to_unicode_string($item);
}
$kw_unicode = implode(" ", $kw);
$list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "supplier where match(`name_match`) against('" . $kw_unicode . "' IN BOOLEAN MODE) {$orderby} limit " . $limit);
$total = $GLOBALS['db']->getOne("select * from " . DB_PREFIX . "supplier where match(`name_match`) against('" . $kw_unicode . "' IN BOOLEAN MODE)");
}
} else {
$list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "supplier {$orderby} limit " . $limit);
$total = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "supplier");
}
$p = new Page($total, '');
$page = $p->show();
$sortImg = $sort;
//排序图标
$sortAlt = $sort == 'desc' ? l("ASC_SORT") : l("DESC_SORT");
//排序提示
$sort = $sort == 'desc' ? 1 : 0;
//排序方式
//模板赋值显示
$this->assign('sort', $sort);
$this->assign('order', $order);
$this->assign('sortImg', $sortImg);
$this->assign('sortType', $sortAlt);
$this->assign('list', $list);
$this->assign("page", $page);
$this->assign("nowPage", $p->nowPage);
$this->display();
return;
}
示例5: index
public function index()
{
$root = array();
$page = intval($GLOBALS['request']['page']);
if ($page == 0) {
$page = 1;
}
$keywords = trim(htmlspecialchars($GLOBALS['request']['keywords']));
$level = intval($GLOBALS['request']['level']);
$interest = intval($GLOBALS['request']['interest']);
$months = intval($GLOBALS['request']['months']);
$lefttime = intval($GLOBALS['request']['lefttime']);
$cate_id = intval($GLOBALS['request']['cid']);
$limit = ($page - 1) * app_conf("DEAL_PAGE_SIZE") . "," . app_conf("DEAL_PAGE_SIZE");
$level_list = load_auto_cache("level");
$page_args = array();
$condition = "";
if ($cate_id > 0) {
$condition .= "AND d.deal_status >=4 and cate_id=" . $cate_id;
$orderby = "d.update_time DESC ,d.sort DESC,d.id DESC";
} elseif ($cate_id == 0) {
$orderby = " d.create_time DESC , dlt.id DESC";
}
if ($keywords) {
$kw_unicode = str_to_unicode_string($keywords);
$condition .= " and (match(d.name_match,d.deal_cate_match,d.tag_match,d.type_match) against('" . $kw_unicode . "' IN BOOLEAN MODE))";
}
if ($level > 0) {
$point = $level_list['point'][$level];
$condition .= " AND d.user_id in(SELECT u.id FROM " . DB_PREFIX . "user u LEFT JOIN " . DB_PREFIX . "user_level ul ON ul.id=u.level_id WHERE ul.point >= {$point})";
}
if ($interest > 0) {
$condition .= " AND d.rate >= " . $interest;
}
if ($months > 0) {
if ($months == 12) {
$condition .= " AND d.repay_time <= " . $months;
} elseif ($months == 18) {
$condition .= " AND d.repay_time >= " . $months;
}
}
if ($lefttime > 0) {
$condition .= " AND (d.next_repay_time + 24*3600 - 1 - " . TIME_UTC . ") <= " . $lefttime * 24 * 3600;
}
$extfield = "";
$union_sql = "";
$result = get_transfer_list($limit, $condition, $extfield, $union_sql, $orderby);
$root = array();
$root['response_code'] = 1;
$root['item'] = $result['list'];
//$root['DEAL_PAGE_SIZE'] = app_conf("DEAL_PAGE_SIZE");
//$root['count'] = $result['count'];
$root['page'] = array("page" => $page, "page_total" => ceil($result['rs_count'] / app_conf("DEAL_PAGE_SIZE")), "page_size" => app_conf("DEAL_PAGE_SIZE"));
$root['program_title'] = "债权转让";
output($root);
}
示例6: index
public function index()
{
require_once APP_ROOT_PATH . 'app/Lib/shop_lib.php';
$catalog_id = intval($GLOBALS['request']['catalog_id']);
//商品分类ID
$city_id = intval($GLOBALS['request']['city_id']);
//城市分类ID
$page = intval($GLOBALS['request']['page']);
//分页
$keyword = strim($GLOBALS['request']['keyword']);
$page = $page == 0 ? 1 : $page;
$page_size = PAGE_SIZE;
$limit = ($page - 1) * $page_size . "," . $page_size;
$condition = " deal_type = 0 ";
if ($keyword) {
$kws_div = div_str($keyword);
foreach ($kws_div as $k => $item) {
$kws[$k] = str_to_unicode_string($item);
}
$ukeyword = implode(" ", $kws);
$condition .= " and (match(tag_match,name_match,locate_match,shop_cate_match) against('" . $ukeyword . "' IN BOOLEAN MODE) or name like '%" . $keyword . "%')";
}
$merchant_id = intval($GLOBALS['request']['merchant_id']);
if ($merchant_id > 0) {
$deal_ids = $GLOBALS['db']->getOne("select group_concat(deal_id) from " . DB_PREFIX . "deal_location_link where location_id = " . $merchant_id);
if ($deal_ids) {
$condition .= " and id in (" . $deal_ids . ") ";
}
}
$deals = get_goods_list($limit, $catalog_id, $condition, "sort desc,id desc", false, $city_id);
$list = $deals['list'];
$count = $deals['count'];
$page_total = ceil($count / $page_size);
$root = array();
$root['return'] = 1;
$goodses = array();
foreach ($list as $item) {
//$goods = array();
$goods = getGoodsArray($item);
$goodses[] = $goods;
}
$root['item'] = $goodses;
$root['page'] = array("page" => $page, "page_total" => $page_total);
output($root);
}
示例7: index
public function index()
{
require_once APP_ROOT_PATH . "system/libs/user.php";
$email = strim($GLOBALS['request']['email']);
$pwd = strim($GLOBALS['request']['pwd']);
$result = do_login_user($email, $pwd);
$user_data = es_session::get('user_info');
$uid = intval($user_data['id']);
if ($uid == 0) {
$root['info'] = "请先登陆";
output($root);
}
$page = intval($GLOBALS['request']['page']);
if ($page == 0) {
$page = 1;
}
$user_info['uid'] = $user_data['id'];
$user_info['email'] = $user_data['email'];
$user_info['user_name'] = $user_data['user_name'];
$user_info['user_avatar'] = get_abs_img_root(get_muser_avatar($user_data['id'], "big"));
$root['home_user'] = $root['user'] = $user_info;
$limit = ($page - 1) * PAGE_SIZE . "," . PAGE_SIZE;
$user_name = $user_data['user_name'];
$user_name_unicode = str_to_unicode_string($user_name);
$condition = " match(user_name_match) against('" . $user_name_unicode . "' IN BOOLEAN MODE) ";
$topic_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "topic where is_effect = 1 and is_delete = 0 and " . $condition . " order by create_time desc limit " . $limit);
$total = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "topic where is_effect = 1 and is_delete = 0 and " . $condition);
foreach ($topic_list as $k => $v) {
$topic_list[$k] = m_get_topic_item($v);
if ($v['fav_id'] > 0 || $v['relay_id'] > 0) {
$relay_share = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "topic where is_effect = 1 and is_delete = 0 and id = " . $v['origin_id']);
}
if ($relay_share) {
$topic_list[$k]['relay_share'] = m_get_topic_item($relay_share);
}
}
$root = array();
$root['return'] = 1;
$root['item'] = $topic_list;
$root['page'] = array("page" => $page, "page_total" => ceil($total / PAGE_SIZE));
output($root);
}
示例8: index
public function index()
{
$catalog_id = intval($GLOBALS['request']['catalog_id']);
//商品分类ID
$city_id = intval($GLOBALS['request']['city_id']);
//城市分类ID
$page = intval($GLOBALS['request']['page']);
//分页
$keyword = strim($GLOBALS['request']['keyword']);
$page = $page == 0 ? 1 : $page;
$quan_id = intval($GLOBALS['request']['quan_id']);
//商圈id
$ytop = $latitude_top = floatval($GLOBALS['request']['latitude_top']);
//最上边纬线值 ypoint
$ybottom = $latitude_bottom = floatval($GLOBALS['request']['latitude_bottom']);
//最下边纬线值 ypoint
$xleft = $longitude_left = floatval($GLOBALS['request']['longitude_left']);
//最左边经度值 xpoint
$xright = $longitude_right = floatval($GLOBALS['request']['longitude_right']);
//最右边经度值 xpoint
$ypoint = $m_latitude = doubleval($GLOBALS['request']['m_latitude']);
//ypoint
$xpoint = $m_longitude = doubleval($GLOBALS['request']['m_longitude']);
//xpoint
$page_size = PAGE_SIZE;
$limit = ($page - 1) * $page_size . "," . $page_size;
if ($keyword) {
$kws_div = div_str($keyword);
foreach ($kws_div as $k => $item) {
$kws[$k] = str_to_unicode_string($item);
}
$ukeyword = implode(" ", $kws);
$condition = " (match(tag_match,name_match,locate_match,deal_cate_match) against('" . $ukeyword . "' IN BOOLEAN MODE) or name like '%" . $keyword . "%') and ";
}
$condition .= " buy_type<>1 and is_lottery = 0 ";
if ($xpoint > 0) {
$pi = 3.14159265;
//圆周率
$r = 6378137;
//地球平均半径(米)
$field_append = ", (ACOS(SIN(({$ypoint} * {$pi}) / 180 ) *SIN((ypoint * {$pi}) / 180 ) +COS(({$ypoint} * {$pi}) / 180 ) * COS((ypoint * {$pi}) / 180 ) *COS(({$xpoint} * {$pi}) / 180 - (xpoint * {$pi}) / 180 ) ) * {$r}) as distance ";
if ($ybottom != 0 && $ytop != 0 && $xleft != 0 && $xright != 0) {
if ($condition != "") {
$condition .= " and ";
}
$condition .= " ypoint > {$ybottom} and ypoint < {$ytop} and xpoint > {$xleft} and xpoint < {$xright} ";
}
$order = " distance asc,id desc ";
} else {
$field_append = "";
$order = "sort desc,id desc ";
}
//根据传入的商圈ID来搜索该商圈下的商品
if ($quan_id > 0) {
$sql_q = "select name from " . DB_PREFIX . "area where id = " . intval($quan_id);
$q_name = $GLOBALS['db']->getOne($sql_q);
$q_name_unicode = str_to_unicode_string($q_name);
$condition .= " and (match(locate_match) against('" . $q_name_unicode . "' IN BOOLEAN MODE))";
}
$deals = m_get_deal_list($limit, $catalog_id, $city_id, array(DEAL_ONLINE), $condition, $order, 0, $field_append);
$list = $deals['list'];
$count = $deals['count'];
$page_total = ceil($count / $page_size);
$root = array();
$root['return'] = 1;
$goodses = array();
foreach ($list as $item) {
//$goods = array();
$goods = getGoodsArray($item);
$goods['distance'] = round($goods['distance']);
$goodses[] = $goods;
}
$root['item'] = $goodses;
$root['page'] = array("page" => $page, "page_total" => $page_total, "page_size" => $page_size);
output($root);
}
示例9: search_supplier
public function search_supplier()
{
if (intval($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "supplier")) < 50000) {
$sql = "select * from " . DB_PREFIX . "supplier where name like '%" . trim($_REQUEST['key']) . "%' limit 30";
} else {
$kws_div = div_str(trim($_REQUEST['key']));
foreach ($kws_div as $k => $item) {
$kw[$k] = str_to_unicode_string($item);
}
$kw_unicode = implode(" ", $kw);
$sql = "select * from " . DB_PREFIX . "supplier where (match(name_match) against('" . $kw_unicode . "' IN BOOLEAN MODE)) limit 30";
}
$supplier_list = $GLOBALS['db']->getAll($sql);
$this->assign("supplier_list", $supplier_list);
$this->display();
}
示例10: insert_load_filter_goods_list
function insert_load_filter_goods_list()
{
convert_req($_REQUEST);
//获取当前页的团购商品列表
//分页
$page = intval($_REQUEST['p']);
if ($page == 0) {
$page = 1;
}
$limit = ($page - 1) * app_conf("DEAL_PAGE_SIZE") . "," . app_conf("DEAL_PAGE_SIZE");
$id = intval($_REQUEST['id']);
if ($id == 0) {
$uname = addslashes(trim($_REQUEST['id']));
}
$cate_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "shop_cate where id = " . $id . " or (uname = '" . $uname . "' and uname <> '')");
$condition = " d.buy_type<>1 ";
//条件
$url_param = array("id" => addslashes(trim($_REQUEST['id'])), "b" => intval($_REQUEST['b']), "min_price" => doubleval($_REQUEST['min_price']), "max_price" => doubleval($_REQUEST['max_price']));
$filter_req = $_REQUEST['f'];
//筛选数组
if (count($filter_req) > 0) {
foreach ($filter_req as $k => $v) {
$url_param['f[' . $k . ']'] = $v;
}
}
if (intval($_REQUEST['is_redirect']) == 1) {
app_redirect(url("shop", "cate", $url_param));
}
$GLOBALS['tmpl']->assign("url_param", $url_param);
//将变量输出到模板
$ids = load_auto_cache("shop_sub_parent_cate_ids", array("cate_id" => intval($cate_item['id'])));
$add_title = "";
//输出品牌
$brand_id = intval($_REQUEST['b']);
if ($brand_id > 0) {
$condition .= " and d.brand_id = " . $brand_id;
$add_title .= $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "brand where id = " . $brand_id);
}
$brand_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "brand where shop_cate_id in (" . implode(",", $ids) . ")");
$brand_list[] = array("name" => $GLOBALS['lang']['ALL'], "id" => 0);
foreach ($brand_list as $k => $v) {
if ($brand_id == $v['id']) {
$brand_list[$k]['act'] = 1;
}
$tmp_url_param = $url_param;
$tmp_url_param['b'] = $v['id'];
$brand_list[$k]['url'] = url("shop", "cate#index", $tmp_url_param);
}
$GLOBALS['tmpl']->assign("brand_list", $brand_list);
//输出属性筛选
$join_str = "";
$unicode_tags = array();
if ($filter_req) {
foreach ($filter_req as $k => $v) {
$k = intval($k);
$filter_req[$k] = trim(addslashes(urldecode($v)));
if ($filter_req[$k] != '' && $filter_req[$k] != 'all') {
if ($add_title != '') {
$add_title .= " - ";
}
$add_title .= $filter_req[$k];
$unicode_tags[] = "+" . str_to_unicode_string($filter_req[$k]);
}
}
}
if (count($unicode_tags) > 0) {
$kw_unicode = implode(" ", $unicode_tags);
//有筛选
$condition .= " and (match(d.tag_match) against('" . $kw_unicode . "' IN BOOLEAN MODE))";
}
$filter_group = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "filter_group where is_effect = 1 and cate_id in (" . implode(",", $ids) . ") order by sort desc");
foreach ($filter_group as $k => $v) {
$filter_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "filter where filter_group_id = " . $v['id'] . " limit 20");
$filter_list[] = array("name" => $GLOBALS['lang']['ALL'], "id" => 0);
foreach ($filter_list as $kk => $vv) {
if ($filter_req[$v['id']] == $vv['name']) {
$filter_list[$kk]['act'] = 1;
}
if ($vv['id'] == 0) {
$url_name = 'all';
} else {
$url_name = $vv['name'];
}
if (($filter_req[$v['id']] == 'all' || $filter_req[$v['id']] == '') && $url_name == 'all') {
$filter_list[$kk]['act'] = 1;
}
$tmp_url_param = $url_param;
$tmp_url_param["f[" . $v['id'] . "]"] = $url_name;
$filter_list[$kk]['url'] = url("shop", "cate#index", $tmp_url_param);
}
$filter_group[$k]['filter_list'] = $filter_list;
}
$GLOBALS['tmpl']->assign("filter_group", $filter_group);
//输出价格区间
$min_price = doubleval($_REQUEST['min_price']);
$max_price = doubleval($_REQUEST['max_price']);
$GLOBALS['tmpl']->assign("min_price", $min_price);
$GLOBALS['tmpl']->assign("max_price", $max_price);
if ($min_price > 0) {
$condition .= " and d.current_price >= " . $min_price;
//.........这里部分代码省略.........
示例11: index
public function index()
{
$root = array();
$root['return'] = 1;
$email = addslashes($GLOBALS['request']['email']);
//用户名或邮箱
$pwd = addslashes($GLOBALS['request']['pwd']);
//密码
//检查用户,用户密码
$user = user_check($email, $pwd);
$user_id = intval($user['id']);
$city_id = intval($GLOBALS['request']['city_id']);
$quan_id = intval($GLOBALS['request']['quan_id']);
$cate_id = intval($GLOBALS['request']['cate_id']);
$brand_id = intval($GLOBALS['request']['brand_id']);
$keyword = strim($GLOBALS['request']['keyword']);
$page = intval($GLOBALS['request']['page']);
//分页
$ytop = $latitude_top = floatval($GLOBALS['request']['latitude_top']);
//最上边纬线值 ypoint
$ybottom = $latitude_bottom = floatval($GLOBALS['request']['latitude_bottom']);
//最下边纬线值 ypoint
$xleft = $longitude_left = floatval($GLOBALS['request']['longitude_left']);
//最左边经度值 xpoint
$xright = $longitude_right = floatval($GLOBALS['request']['longitude_right']);
//最右边经度值 xpoint
$ypoint = $m_latitude = doubleval($GLOBALS['request']['m_latitude']);
//ypoint
$xpoint = $m_longitude = doubleval($GLOBALS['request']['m_longitude']);
//xpoint
$page = $page == 0 ? 1 : $page;
$page_size = PAGE_SIZE;
$limit = ($page - 1) * $page_size . "," . $page_size;
if ($xpoint > 0) {
$pi = 3.14159265;
//圆周率
$r = 6378137;
//地球平均半径(米)
$field_append = ", (ACOS(SIN(({$ypoint} * {$pi}) / 180 ) *SIN((ypoint * {$pi}) / 180 ) +COS(({$ypoint} * {$pi}) / 180 ) * COS((ypoint * {$pi}) / 180 ) *COS(({$xpoint} * {$pi}) / 180 - (xpoint * {$pi}) / 180 ) ) * {$r}) as distance ";
if ($ybottom != 0 && $ytop != 0 && $xleft != 0 && $xright != 0) {
$condition = " and ypoint > {$ybottom} and ypoint < {$ytop} and xpoint > {$xleft} and xpoint < {$xright} ";
}
$orderby = " order by distance asc ";
} else {
$field_append = "";
$orderby = " ";
}
$sql_count = "select count(*) from " . DB_PREFIX . "supplier_location" . " as a";
$sql = "select a.supplier_id as id,a.name,a.mobile_brief as brief,a.tel,a.preview as logo,a.dp_count as comment_count,a.xpoint,a.ypoint,a.address as api_address, 0 as is_dy {$field_append} from " . DB_PREFIX . "supplier_location as a ";
$where = "1 = 1 ";
if ($city_id > 0) {
$ids = load_auto_cache("deal_city_belone_ids", array("city_id" => $city_id));
if ($ids) {
$where .= " and city_id in (" . implode(",", $ids) . ")";
}
}
if ($quan_id > 0) {
$sql_q = "select name from " . DB_PREFIX . "area where id = " . intval($quan_id);
$q_name = $GLOBALS['db']->getOne($sql_q);
$q_name_unicode = str_to_unicode_string($q_name);
$where .= " and (match(a.locate_match) against('" . $q_name_unicode . "' IN BOOLEAN MODE))";
//$where .= " and a.locate_match = $quan_id";
}
if ($cate_id > 0) {
$where .= " and a.deal_cate_id = {$cate_id}";
}
if ($brand_id > 0) {
$where .= " and a.supplier_id = {$brand_id}";
}
if ($keyword) {
$GLOBALS['tmpl']->assign("keyword", $keyword);
$kws_div = div_str($keyword);
foreach ($kws_div as $k => $item) {
$kw[$k] = str_to_unicode_string($item);
}
$kw_unicode = implode(" ", $kw);
//有筛选
$where .= " and (match(a.name_match,a.locate_match,a.deal_cate_match,a.tags_match) against('" . $kw_unicode . "' IN BOOLEAN MODE) or name like '%" . $keyword . "%')";
}
$where .= $condition;
$sql_count .= " where " . $where;
$sql .= " where " . $where;
$sql .= $orderby;
$sql .= " limit " . $limit;
$total = $GLOBALS['db']->getOne($sql_count);
$page_total = ceil($total / $page_size);
$list = $GLOBALS['db']->getAll($sql);
$merchant_list = array();
foreach ($list as $item) {
$item = m_merchantItem($item);
$merchant_list[] = $item;
}
$root['item'] = $merchant_list;
$root['page'] = array("page" => $page, "page_total" => $page_total);
output($root);
}
示例12: index
public function index()
{
$GLOBALS['tmpl']->caching = true;
$GLOBALS['tmpl']->cache_lifetime = 60;
//首页缓存10分钟
$field = es_cookie::get("shop_sort_field");
$field_sort = es_cookie::get("shop_sort_type");
$cache_id = md5(MODULE_NAME . ACTION_NAME . implode(",", $_REQUEST) . $field . $field_sort);
if (!$GLOBALS['tmpl']->is_cached("page/deals.html", $cache_id)) {
require APP_ROOT_PATH . 'app/Lib/page.php';
$level_list = load_auto_cache("level");
$GLOBALS['tmpl']->assign("level_list", $level_list['list']);
if (trim($_REQUEST['cid']) == "last") {
$cate_id = "-1";
$page_title = $GLOBALS['lang']['LAST_SUCCESS_DEALS'] . " - ";
} else {
$cate_id = intval($_REQUEST['cid']);
}
if ($cate_id == 0) {
$page_title = $GLOBALS['lang']['ALL_DEALS'] . " - ";
}
$keywords = trim(htmlspecialchars($_REQUEST['keywords']));
$GLOBALS['tmpl']->assign("keywords", $keywords);
$level = intval($_REQUEST['level']);
$GLOBALS['tmpl']->assign("level", $level);
$interest = intval($_REQUEST['interest']);
$GLOBALS['tmpl']->assign("interest", $interest);
$months = intval($_REQUEST['months']);
$GLOBALS['tmpl']->assign("months", $months);
$lefttime = intval($_REQUEST['lefttime']);
$GLOBALS['tmpl']->assign("lefttime", $lefttime);
$months_type = intval($_REQUEST['months_type']);
$GLOBALS['tmpl']->assign("months_type", $months_type);
$deal_status = intval($_REQUEST['deal_status']);
$GLOBALS['tmpl']->assign("deal_status", $deal_status);
$cates = intval($_REQUEST['cates']);
$GLOBALS['tmpl']->assign("cates", $cates);
$city = intval($_REQUEST['city']);
$GLOBALS['tmpl']->assign("city_id", $city);
$scity = intval($_REQUEST['scity']);
$GLOBALS['tmpl']->assign("scity_id", $scity);
//输出分类
$deal_cates_db = load_auto_cache("cache_deal_cate");
$deal_cates = array();
foreach ($deal_cates_db as $k => $v) {
if ($cate_id == $v['id']) {
$v['current'] = 1;
$page_title = $v['name'] . " - ";
}
$v['url'] = url("index", "deals", array("cid" => $v['id']));
$deal_cates[] = $v;
}
unset($deal_cates_db);
//输出投标列表
$page = intval($_REQUEST['p']);
if ($page == 0) {
$page = 1;
}
$limit = ($page - 1) * app_conf("DEAL_PAGE_SIZE") . "," . app_conf("DEAL_PAGE_SIZE");
$n_cate_id = 0;
$condition = " publish_wait = 0 and is_hidden = 0 ";
$orderby = "";
if ($cate_id > 0) {
$n_cate_id = $cate_id;
if ($field && $field_sort) {
$orderby = "{$field} {$field_sort} ,deal_status desc , sort DESC,id DESC";
} else {
$orderby = "sort DESC,id DESC";
}
$total_money = $GLOBALS['db']->getOne("SELECT sum(borrow_amount) FROM " . DB_PREFIX . "deal WHERE cate_id={$cate_id} AND deal_status in(4,5) AND is_effect = 1 and is_delete = 0 ");
} elseif ($cate_id == 0) {
$n_cate_id = 0;
if ($field && $field_sort) {
$orderby = "{$field} {$field_sort} ,sort DESC,id DESC";
} else {
$orderby = "sort DESC , id DESC";
}
$total_money = $GLOBALS['db']->getOne("SELECT sum(borrow_amount) FROM " . DB_PREFIX . "deal WHERE deal_status in(4,5) AND is_effect = 1 and is_delete = 0");
} elseif ($cate_id == "-1") {
$n_cate_id = 0;
$condition .= "AND deal_status in(2,4,5) ";
$orderby = "deal_status ASC,success_time DESC,sort DESC,id DESC";
}
if ($keywords) {
$kw_unicode = str_to_unicode_string($keywords);
$condition .= " and (match(name_match,deal_cate_match,tag_match,type_match) against('" . $kw_unicode . "' IN BOOLEAN MODE))";
}
if ($level > 0) {
$point = $level_list['point'][$level];
$condition .= " AND user_id in(SELECT u.id FROM " . DB_PREFIX . "user u LEFT JOIN " . DB_PREFIX . "user_level ul ON ul.id=u.level_id WHERE ul.point >= {$point})";
}
if ($interest > 0) {
$condition .= " AND rate >= " . $interest;
}
if ($months > 0) {
if ($months == 12) {
$condition .= " AND repay_time <= " . $months;
} elseif ($months == 18) {
$condition .= " AND repay_time >= " . $months;
}
//.........这里部分代码省略.........
示例13: deals
//.........这里部分代码省略.........
$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 d.cate_id in (" . implode(",", $cate_ids) . ")";
}
if ($loc != "") {
$condition .= " and (d.province = '" . $loc . "' or d.city = '" . $loc . "') ";
}
if ($tag != "") {
$unicode_tag = str_to_unicode_string($tag);
$condition .= " and match(d.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(d.name_match) against('" . $ukeyword . "' IN BOOLEAN MODE) or match(d.tags_match) against('" . $ukeyword . "' IN BOOLEAN MODE) or name like '%" . $kw . "%') ";
}
$condition .= " and d.type={$type} ";
// if($r=="new")
// {
// $orderby =" d.begin_time desc ";
// }
// elseif($r=="rec")
// {
// $orderby.=" d.begin_time desc ";
// }
// else
// {
// $orderby =" sort asc ";
// }
//========
if ($price > 0) {
if ($price == 1) {
if ($type == 1) {
$orderby .= " d.invote_money desc";
} else {
$orderby .= " (d.support_amount+d.virtual_price) desc";
}
$param_new['price'] = 2;
示例14: index
public function index()
{
$page = intval($GLOBALS['request']['page']);
if ($page == 0) {
$page = 1;
}
$cate_id = intval($GLOBALS['request']['cate_id']);
$city_id = intval($GLOBALS['request']['city_id']);
$city_name = strim($GLOBALS['request']['city_name']);
//城市名称
$ytop = $latitude_top = floatval($GLOBALS['request']['latitude_top']);
//最上边纬线值 ypoint
$ybottom = $latitude_bottom = floatval($GLOBALS['request']['latitude_bottom']);
//最下边纬线值 ypoint
$xleft = $longitude_left = floatval($GLOBALS['request']['longitude_left']);
//最左边经度值 xpoint
$xright = $longitude_right = floatval($GLOBALS['request']['longitude_right']);
//最右边经度值 xpoint
$ypoint = $m_latitude = doubleval($GLOBALS['request']['m_latitude']);
//ypoint
$xpoint = $m_longitude = doubleval($GLOBALS['request']['m_longitude']);
//xpoint
if ($GLOBALS['request']['from'] == "wap") {
/*输出分类*/
$bigcate_list = $GLOBALS['db']->getAll("select id,name from " . DB_PREFIX . "event_cate where is_effect=1 order by sort");
/*输出商圈*/
$all_quan_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "area where city_id=" . $city_id . "");
$quan_list = array();
$quan_sub_list = array();
$quan_list[0]['id'] = 0;
$quan_list[0]['name'] = '全城';
$quan_list[0]['quan_sub'][0]['id'] = 0;
$quan_list[0]['quan_sub'][0]['pid'] = 0;
$quan_list[0]['quan_sub'][0]['name'] = '全城';
foreach ($all_quan_list as $k => $v) {
if ($v['pid'] == 0) {
$quan_list[] = $v;
}
if ($v['pid'] > 0) {
$quan_sub_list[$v['pid']][] = $v;
}
}
foreach ($quan_list as $k => $v) {
if ($v['name'] != "全城") {
if ($quan_sub_list[$v['id']] == null || $quan_sub_list[$v['id']] == '') {
$quan_list[$k]['quan_sub'] = array();
} else {
$quan_list[$k]['quan_sub'] = $quan_sub_list[$v['id']];
}
}
}
$root[quan_list] = $quan_list;
}
$keyword = strim($GLOBALS['request']['keyword']);
if ($xpoint > 0) {
$pi = 3.14159265;
//圆周率
$r = 6378137;
//地球平均半径(米)
$field_append = ", (ACOS(SIN(({$ypoint} * {$pi}) / 180 ) *SIN((ypoint * {$pi}) / 180 ) +COS(({$ypoint} * {$pi}) / 180 ) * COS((ypoint * {$pi}) / 180 ) *COS(({$xpoint} * {$pi}) / 180 - (xpoint * {$pi}) / 180 ) ) * {$r}) as distance ";
if ($ybottom != 0 && $ytop != 0 && $xleft != 0 && $xright != 0) {
$where = " ypoint > {$ybottom} and ypoint < {$ytop} and xpoint > {$xleft} and xpoint < {$xright} ";
}
$order = " distance asc,is_recommend desc,sort desc,id desc";
} else {
$field_append = $where = $order = "";
}
$limit = ($page - 1) * PAGE_SIZE . "," . PAGE_SIZE;
if ($keyword) {
$kws_div = div_str($keyword);
foreach ($kws_div as $k => $item) {
$kw[$k] = str_to_unicode_string($item);
}
$ukeyword = implode(" ", $kw);
$where .= " (match(name_match) against('" . $ukeyword . "' IN BOOLEAN MODE) or name like '%" . $keyword . "%') ";
}
$res = m_search_event_list($limit, $cate_id, $city_id, $where, $order, $field_append);
$pattern = "/<img([^>]*)\\/>/i";
$replacement = "<img width=300 \$1 />";
foreach ($res['list'] as $k => $v) {
if ($v['ypoint'] == '') {
$res['list'][$k]['ypoint'] = 0;
}
if ($v['xpoint'] == '') {
$res['list'][$k]['xpoint'] = 0;
}
$res['list'][$k]['icon'] = get_abs_img_root(get_spec_image($v['icon'], 140, 85, 0));
$res['list'][$k]['distance'] = round($v['distance']);
$res['list'][$k]['date_time'] = pass_date($v['submit_begin_time']);
$res['list'][$k]['event_begin_time'] = to_date($v['event_begin_time'], 'Y-m-d');
$res['list'][$k]['event_end_time'] = to_date($v['event_end_time'], 'Y-m-d');
$res['list'][$k]['submit_end_time'] = to_date($v['submit_end_time'], 'Y-m-d');
$res['list'][$k]['submit_begin_time'] = to_date($v['submit_begin_time'], 'Y-m-d');
$res['list'][$k]['content'] = preg_replace($pattern, $replacement, get_abs_img_root($v['content']));
}
$root = array();
$root['bigcate_list'] = $bigcate_list;
$root['return'] = 1;
$root['item'] = $res['list'];
$root['page'] = array("page" => $page, "page_total" => ceil($res['count'] / PAGE_SIZE), "page_size" => PAGE_SIZE);
//.........这里部分代码省略.........
示例15: index
public function index()
{
convert_req($_REQUEST);
$_REQUEST['cid'] = intval($_REQUEST['cid']);
$keyword = addslashes(htmlspecialchars(trim($_REQUEST['keyword'])));
$GLOBALS['tmpl']->assign("keyword", $keyword);
$url_param = array("cid" => $_REQUEST['cid'], "aid" => intval($_REQUEST['aid']), "tid" => intval($_REQUEST['tid']), "qid" => intval($_REQUEST['qid']), "keyword" => $keyword);
if (intval($_REQUEST['is_redirect']) == 1) {
app_redirect(url("youhui", "fcate", $url_param));
}
$quan_id = intval($_REQUEST['qid']);
//
$city_id = intval($GLOBALS['deal_city']['id']);
//分页
$page = intval($_REQUEST['p']);
if ($page == 0) {
$page = 1;
}
$limit = ($page - 1) * app_conf("DEAL_PAGE_SIZE") . "," . app_conf("DEAL_PAGE_SIZE");
$cid = intval($_REQUEST['cid']);
if ($cid == 0) {
$uname = addslashes(trim($_REQUEST['cid']));
}
$cate_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_cate where id = " . $cid . " or (uname = '" . $uname . "' and uname <> '')");
$free_youhui_list = get_free_youhui_list(5, intval($cate_item['id']), " is_recommend = 1 ", "");
$GLOBALS['tmpl']->assign("free_youhui_list", $free_youhui_list['list']);
$condition = " 1=1 ";
//条件
unset($url_param['keyword']);
$sub_nav[] = array("name" => $GLOBALS['lang']['FREE_YOUHUI'], "url" => url("youhui", "fcate", $url_param), "current" => 1);
$sub_nav[] = array("name" => $GLOBALS['lang']['NEED_BUY_YOUHUI'], "url" => url("youhui", "ycate", $url_param), "current" => 0);
$sub_nav[] = array("name" => $GLOBALS['lang']['TUAN'], "url" => url("youhui", "tuan", $url_param), "current" => 0);
$GLOBALS['tmpl']->assign("sub_nav", $sub_nav);
$GLOBALS['tmpl']->assign("url_param", $url_param);
//将变量输出到模板
$seo_title = $GLOBALS['lang']['FREE_YOUHUI'];
$seo_keyword = $GLOBALS['lang']['FREE_YOUHUI'];
$seo_description = $GLOBALS['lang']['FREE_YOUHUI'];
$cache_param = array("city_id" => $city_id, "cid" => $cate_item['id'], "tid" => $url_param['tid'], "aid" => $url_param['aid'], "qid" => $url_param['qid']);
$result = load_auto_cache("fyouhui_filter_nav_cache", $cache_param);
//输出行政区
$append_seo = "";
$area_id = intval($_REQUEST['aid']);
if ($area_id > 0) {
$area_name = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "area where id = " . $area_id);
$append_seo = $area_name;
if ($quan_id > 0) {
$kw_unicode = str_to_unicode_string($area_name);
//有筛选
$condition .= " and (match(locate_match) against('" . $kw_unicode . "' IN BOOLEAN MODE)) ";
} else {
$ids = load_auto_cache("deal_quan_ids", array("quan_id" => $area_id));
$quan_list = $GLOBALS['db']->getAll("select `name` from " . DB_PREFIX . "area where id in (" . implode(",", $ids) . ")");
$unicode_quans = array();
foreach ($quan_list as $k => $v) {
$unicode_quans[] = str_to_unicode_string($v['name']);
}
$kw_unicode = implode(" ", $unicode_quans);
$condition .= " and (match(locate_match) against('" . $kw_unicode . "' IN BOOLEAN MODE))";
}
}
$GLOBALS['tmpl']->assign("area_list", $result['area_list']);
if ($area_id > 0) {
//输出商圈
if ($quan_id > 0) {
$area_name = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "area where id = " . $quan_id);
$kw_unicode = str_to_unicode_string($area_name);
//有筛选
$condition .= " and (match(locate_match) against('" . $kw_unicode . "' IN BOOLEAN MODE)) ";
$append_seo = $append_seo . $area_name;
}
$GLOBALS['tmpl']->assign("quan_list", $result['quan_list']);
}
//输出分类
$cate_id = $cate_item['id'];
$GLOBALS['tmpl']->assign("cate_list", $result['cate_list']);
//输出小分类
$deal_type_id = intval($_REQUEST['tid']);
$deal_cate_id = $cate_id;
if ($deal_cate_id > 0) {
$GLOBALS['tmpl']->assign("scate_list", $result['scate_list']);
if ($append_seo != "") {
$append_seo .= " - ";
}
$append_seo .= $cate_item['name'];
}
if ($deal_type_id > 0) {
$deal_type_name = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "deal_cate_type where id = " . $deal_type_id);
$deal_type_name_unicode = str_to_unicode_string($deal_type_name);
$condition .= " and (match(deal_cate_match) against('" . $deal_type_name_unicode . "' IN BOOLEAN MODE)) ";
$append_seo .= $deal_type_name;
}
$seo_title = $append_seo . $seo_title;
$seo_keyword = $append_seo . $seo_keyword;
$seo_description = $append_seo . $seo_keyword;
if ($keyword) {
$kws_div = div_str($keyword);
foreach ($kws_div as $k => $item) {
$kw[$k] = str_to_unicode_string($item);
}
//.........这里部分代码省略.........