Example #1
0
 public function index()
 {
     $email = addslashes(trim($GLOBALS['request']['email']));
     //用户名或邮箱
     $pwd = trim($GLOBALS['request']['pwd']);
     //密码
     $id = intval($GLOBALS['request']['id']);
     //商品ID
     $city_name = strim($GLOBALS['request']['city_name']);
     //城市名称
     $user = user_check($email, $pwd, false);
     $user_id = intval($user['id']);
     if ($user_id > 0) {
         app_redirect(wap_url("index#index"));
     }
     $root['city_name'] = $city_name;
     $root['page_title'] = "绑定帐户";
     output($root);
 }
Example #2
0
     $page = new Page($data['page']['page_total'], $data['page']['page_size']);
     //初始化分页对象
     //$page->parameter
     $p = $page->show();
     //print_r($p);exit;
     $GLOBALS['tmpl']->assign('pages', $p);
 }
 if ($class == 'done_cart' && $data['return'] == 1) {
     if ($data['status'] == 1) {
         app_redirect(wap_url('index', 'pay_order&order_id=' . $data['order_id']));
     } else {
         showSuccess($data['info'], 0, wap_url('index', 'calc_cart#index'));
     }
 }
 if ($class == 'done_order' && $data['status'] == 1) {
     app_redirect(wap_url('index', 'pay_order&order_id=' . $data['order_id']));
 }
 if ($class == 'calc_cart' && isset($data['mobile_user_id']) && intval($data['mobile_user_id']) > 0) {
     //将会员信息存在session中
     /*
     es_session::set('uid',intval($data['mobile_user_id']));
     es_session::set('user_email',$data['mobile_user_name']);
     es_session::set('user_pwd',$data['mobile_user_pwd']);
     //cookie
     es_cookie::set('uid',intval($data['mobile_user_id']),3600*24*365);
     es_cookie::set('user_email',$data['mobile_user_name'],3600*24*365);
     es_cookie::set('user_pwd',$data['mobile_user_pwd'],3600*24*365);
     */
     es_cookie::set("user_name", $data['mobile_user_name'], 3600 * 24 * 30);
     es_cookie::set("user_pwd", md5($data['mobile_user_pwd'] . "_EASE_COOKIE"), 3600 * 24 * 30);
     //用户登陆处理;
Example #3
0
 public function index()
 {
     require_once APP_ROOT_PATH . 'system/model/deal.php';
     $root = array();
     $root['return'] = 1;
     $catalog_id = intval($GLOBALS['request']['catalog_id']);
     //商品分类ID
     $cata_type_id = intval($GLOBALS['request']['cata_type_id']);
     //商品二级分类
     $city_id = intval($GLOBALS['request']['city_id']);
     //城市分类ID
     $page = intval($GLOBALS['request']['page']);
     //分页
     $keyword = strim($GLOBALS['request']['keyword']);
     $city_name = strim($GLOBALS['request']['city_name']);
     //城市名称
     //print_r($GLOBALS['request']);
     $order_type = strim($GLOBALS['request']['order_type']);
     $quan_id = intval($GLOBALS['request']['quan_id']);
     //商圈id
     if ($cata_type_id > 0) {
         $catalog_id = $cata_type_id;
     }
     if ($order_type == 'buy_count') {
         $marked_tag = 1;
     } elseif ($order_type == 'price_desc') {
         $marked_tag = 2;
     } elseif ($order_type == 'newest') {
         $marked_tag = 3;
     } else {
         $marked_tag = 1;
     }
     $root['marked_tag'] = $marked_tag;
     /*输出分类*/
     $bcate_list = getShopcateList();
     $url_param['quan_id'] = $quan_id;
     $url_param['catalog_id'] = $catalog_id;
     foreach ($bcate_list as $k => $v) {
         if ($catalog_id == $v['id']) {
             $bcate_list[$k]['marked_tag'] = 1;
         }
         /*
         if($catalog_id==$v['id'])
         {
         	$bcate_list['bcate_type'][$k]['act'] = 1;
         }
         */
         $tmp_url_param = $url_param;
         unset($tmp_url_param['catalog_id']);
         $tmp_url_param['catalog_id'] = $v['id'];
         $tmp_url_param['catename'] = $v['name'];
         if ($quan_id > 0) {
             $quanname = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "area  where id=" . $quan_id);
             $tmp_url_param['quanname'] = $quanname;
         } else {
             $tmp_url_param['quanname'] = "全城";
         }
         $turl = wap_url("index", "goodslist", $tmp_url_param);
         $url = str_replace('sjmapi', 'wap', $turl);
         $bcate_list[$k]["url"] = $url;
         foreach ($v['bcate_type'] as $kk => $vv) {
             /*
             if($catalog_id==$vv['id'])
             {
             	$bcate_list['bcate_type'][$kk]['act'] = 1;
             }
             */
             $tmp_url_param = $url_param;
             unset($tmp_url_param['catalog_id']);
             $tmp_url_param['catalog_id'] = $vv['id'];
             if ($bcate_list['bcate_type'][$kk]['id'] == $vv['id']) {
                 $tmp_url_param['catename'] = $v['name'];
             } else {
                 $tmp_url_param['catename'] = $vv['name'];
             }
             if ($quan_id > 0) {
                 $quanname = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "area a where id=" . $quan_id);
                 $tmp_url_param['quanname'] = $quanname;
             } else {
                 $tmp_url_param['quanname'] = "全城";
             }
             $turl = wap_url("index", "goodslist", $tmp_url_param);
             $url = str_replace('sjmapi', 'wap', $turl);
             $bcate_list[$k]["bcate_type"][$kk]["url"] = $url;
         }
     }
     //品牌列表
     if ($catalog_id > 0) {
         $cate_key = load_auto_cache("shop_cate_key", array("cid" => $catalog_id));
         $brand_list = $GLOBALS['db']->getAll("select id,name,sort,0 as city_id, from " . DB_PREFIX . "brand where match(tag_match) against('" . $cate_key . "' IN BOOLEAN MODE)  order by sort limit 100");
     } else {
         $brand_list = $GLOBALS['db']->getAll("select id,name,sort,0 as city_id from " . DB_PREFIX . "brand  order by sort limit 100");
     }
     $quan_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 ($brand_list as $k => $v) {
         $quan_list[] = $v;
     }
     foreach ($quan_list as $k => $v) {
         $tmp_url_param = $url_param;
         unset($tmp_url_param['quan_id']);
         $tmp_url_param['quan_id'] = $v['id'];
         $tmp_url_param['quanname'] = $v['name'];
         if ($catalog_id > 0) {
             $catename = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "shop_cate  where id=" . $catalog_id);
             $tmp_url_param['catename'] = $catename;
         } else {
             $tmp_url_param['catename'] = "全部分类";
         }
         $turl = wap_url("index", "goodslist", $tmp_url_param);
         $url = str_replace('sjmapi', 'wap', $turl);
         $quan_list[$k]["url"] = $url;
         $quan_list[$k]['quan_sub'][] = array('id' => $v['id'], 'pid' => $v['id'], 'name' => '全部');
     }
     $ordertype[] = array("name" => "默认排序", "sc" => "avg_point");
     $ordertype[] = array("name" => "最新发布", "sc" => "newest");
     $ordertype[] = array("name" => "销量最高", "sc" => "buy_count");
     $ordertype[] = array("name" => "价格最高", "sc" => "price_desc");
     $ordertype[] = array("name" => "价格最低", "sc" => "price_asc");
     foreach ($ordertype as $k => $v) {
         $tmp_url_param = $url_param;
         if ($quanname) {
             $tmp_url_param['quanname'] = $quanname;
         }
         if ($catename) {
             $tmp_url_param['catename'] = $catename;
         }
         if ($keyword) {
             $tmp_url_param['keyword'] = $keyword;
         }
         $tmp_url_param['order_type'] = $v['sc'];
         $turl = wap_url("index", "goodslist", $tmp_url_param);
         $url = str_replace('sjmapi', 'wap', $turl);
         $ordertype[$k]["url"] = $url;
     }
     $root['ordertype'] = $ordertype;
     /*排序*/
     if ($order_type == 'avg_point') {
         $order = " avg_point desc,id desc ";
     } elseif ($order_type == 'newest') {
         $order = " create_time desc,id desc ";
     } elseif ($order_type == 'buy_count') {
         $order = " buy_count desc,id desc ";
     } elseif ($order_type == 'price_asc') {
         $order = " current_price asc,id desc ";
     } elseif ($order_type == 'price_desc') {
         $order = " current_price desc,id desc ";
     } else {
         $order = "sort desc,id desc ";
     }
     $page = $page == 0 ? 1 : $page;
     $page_size = PAGE_SIZE;
     $limit = ($page - 1) * $page_size . "," . $page_size;
     //buy_type = 0 普通商品;1积分商品
     $condition = " buy_type = 0  and is_shop=1";
     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 . ") ";
         } else {
             $condition .= " and id ='' ";
         }
     }
     //根据传入的商圈ID来搜索该商圈下的商品
     if ($quan_id > 0) {
         $condition .= " and brand_id = " . $quan_id;
     }
     //get_goods_list($limit,$type=array(DEAL_ONLINE,DEAL_HISTORY,DEAL_NOTICE),$param=array("cid"=>0,"city_id"=>0), $join='', $where='',$orderby = '')
     $deals = get_goods_list($limit, array(DEAL_ONLINE, DEAL_HISTORY), array("cid" => $catalog_id, "city_id" => $city_id), '', $condition, $order);
     $condition = $deals['condition'];
     $sql = "select count(*) from " . DB_PREFIX . "deal as d where  " . $condition;
     $count = $GLOBALS['db']->getOne($sql);
     $list = $deals['list'];
     $page_total = ceil($count / $page_size);
     $goodses = array();
     foreach ($list as $item) {
         //$goods = array();
         $goods = getGoodsArray($item);
         $goods['image'] = get_abs_img_root(get_spec_image($item['img'], 140, 85, 0));
         $goodses[] = $goods;
     }
     $root['item'] = $goodses;
     $root['page'] = array("page" => $page, "page_total" => $page_total, "page_size" => $page_size);
     //$root['quan_list'] = getCityList();
     /*
     //输出城市
     $root['city_list']=getCityList();
     //输出商圈
     $quan_list=getQuanList($city_id);
     $root['quan_list2'] = $quan_list;
     */
     //$root['bcate_list'] = $bcate_list;
     //$root['quan_list'] = $quan_list;
     if ($bcate_list === false) {
         $root['bcate_list'] = array();
     } else {
         $root['bcate_list'] = $bcate_list;
     }
     if ($quan_list === false) {
         $root['quan_list'] = array();
     } else {
         $root['quan_list'] = $quan_list;
     }
     $root['page_title'] = "商品列表";
     $root['city_name'] = $city_name;
     output($root);
 }
Example #4
0
function parse_wap_url_tag($str)
{
    $key = md5("WAP_URL_TAG_" . $str);
    if (isset($GLOBALS[$key])) {
        return $GLOBALS[$key];
    }
    $url = load_dynamic_cache($key);
    $url = false;
    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] = wap_url($app_index, $route, $param);
    set_dynamic_cache($key, $GLOBALS[$key]);
    return $GLOBALS[$key];
}
Example #5
0
 public function index()
 {
     $root = array();
     $root['return'] = 1;
     $catalog_id = intval($GLOBALS['request']['catalog_id']);
     //商品分类ID
     $cata_type_id = intval($GLOBALS['request']['cata_type_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
     $order_type = strim($GLOBALS['request']['order_type']);
     //if(!$city_id)
     //{
     //	$city = get_current_deal_city();
     //	$city_id = $city['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
     /*输出分类*/
     $bcate_list = getCateList();
     $url_param['quan_id'] = $quan_id;
     $url_param['catalog_id'] = $catalog_id;
     $url_param['cata_type_id'] = $cata_type_id;
     foreach ($bcate_list as $k => $v) {
         $tmp_url_param = $url_param;
         unset($tmp_url_param['catalog_id']);
         $tmp_url_param['catalog_id'] = $v['id'];
         $tmp_url_param['catename'] = $v['name'];
         if ($quan_id > 0) {
             $quanname = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "area where id=" . $quan_id);
             $tmp_url_param['quanname'] = $quanname;
         } else {
             $tmp_url_param['quanname'] = "全城";
         }
         $turl = wap_url("index", "tuanlist", $tmp_url_param);
         $url = str_replace('sjmapi', 'wap', $turl);
         $bcate_list[$k]["url"] = $url;
         foreach ($v['bcate_type'] as $kk => $vv) {
             $tmp_url_param = $url_param;
             unset($tmp_url_param['cata_type_id']);
             $tmp_url_param['cata_type_id'] = $vv["id"];
             $tmp_url_param['catename'] = $vv['name'];
             $tmp_url_param['catalog_id'] = $vv['cate_id'];
             if ($quan_id > 0) {
                 $quanname = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "area  where id=" . $quan_id);
                 $tmp_url_param['quanname'] = $quanname;
             } else {
                 $tmp_url_param['quanname'] = "全城";
             }
             $turl = wap_url("index", "tuanlist", $tmp_url_param);
             $url = str_replace('sjmapi', 'wap', $turl);
             $bcate_list[$k]["bcate_type"][$kk]["url"] = $url;
         }
     }
     /*输出商圈*/
     $quan_list = getQuanList($city_id);
     foreach ($quan_list as $k => $v) {
         $tmp_url_param = $url_param;
         unset($tmp_url_param['quan_id']);
         $tmp_url_param['quan_id'] = $v['id'];
         $tmp_url_param['quanname'] = $v['name'];
         if ($catalog_id > 0) {
             $catename = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "deal_cate  where id=" . $catalog_id);
             $tmp_url_param['catename'] = $catename;
         } else {
             $tmp_url_param['catename'] = "全部分类";
         }
         $turl = wap_url("index", "tuanlist", $tmp_url_param);
         $url = str_replace('sjmapi', 'wap', $turl);
         $quan_list[$k]["url"] = $url;
         foreach ($v['quan_sub'] as $kk => $vv) {
             $tmp_url_param = $url_param;
             unset($tmp_url_param['quan_id']);
             $tmp_url_param['quan_id'] = $vv['id'];
             $tmp_url_param['quanname'] = $vv['name'];
             if ($catalog_id > 0) {
                 $catename = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "deal_cate  where id=" . $catalog_id);
                 $tmp_url_param['catename'] = $catename;
             } else {
                 $tmp_url_param['catename'] = "全部分类";
             }
             $turl = wap_url("index", "tuanlist", $tmp_url_param);
             $url = str_replace('sjmapi', 'wap', $turl);
             $quan_list[$k]["quan_sub"][$kk]["url"] = $url;
         }
     }
     $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 ";
     }
     //buy_type 0普通团购;2在线订购;3秒杀抢团
     //is_shop 0团购;1:商品;
     $condition .= " buy_type = 0 and is_shop = 0 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 {
         $order = "sort desc,id desc ";
     }
     /*排序  
     		 智能排序和 离我最的 是一样的 都以距离来升序来排序,只有这两种情况有传经纬度过来,就没有把 这两种情况写在 下面的判断里,写在上面了。
     		default 智能(默认),nearby  离我,avg_point 评价,newest 最新,buy_count 人气,price_asc 价低,price_desc 价高 */
     $ordertype[] = array("name" => "默认排序", "sc" => "avg_point");
     $ordertype[] = array("name" => "最新发布", "sc" => "newest");
     $ordertype[] = array("name" => "销量最高", "sc" => "buy_count");
     $ordertype[] = array("name" => "价格最高", "sc" => "price_desc");
     $ordertype[] = array("name" => "价格最低", "sc" => "price_asc");
     foreach ($ordertype as $k => $v) {
         $tmp_url_param = $url_param;
         if ($quanname) {
             $tmp_url_param['quanname'] = $quanname;
         }
         if ($catename) {
             $tmp_url_param['catename'] = $catename;
         }
         if ($keyword) {
             $tmp_url_param['keyword'] = $keyword;
         }
         $tmp_url_param['order_type'] = $v['sc'];
         $turl = wap_url("index", "goodslist", $tmp_url_param);
         $url = str_replace('sjmapi', 'wap', $turl);
         $ordertype[$k]["url"] = $url;
     }
     $root['ordertype'] = $ordertype;
     if ($order_type == 'avg_point') {
         /*评价*/
         $order = " avg_point desc,id desc ";
     } elseif ($order_type == 'newest') {
         /*最新*/
         $order = " create_time desc,id desc ";
     } elseif ($order_type == 'buy_count') {
         /*销量*/
         $order = " buy_count desc,id desc ";
     } elseif ($order_type == 'price_asc') {
         /*价格升*/
         $order = " current_price asc,id desc ";
     } elseif ($order_type == 'price_desc') {
         /*价格降*/
         $order = " current_price 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, $cata_type_id);
     $list = $deals['list'];
     $count = $deals['count'];
     $page_total = ceil($count / $page_size);
     //$root['sql'] = $deals['sql'];
     $taday_begin = to_timespan(to_date(get_gmtime(), 'Y-m-d'));
     $taday_end = $taday_begin * 24 * 60 * 60;
     $goodses = array();
     foreach ($list as $k => $v) {
         $goodses[$k]['id'] = $v['id'];
         $goodses[$k]['distance'] = $v['distance'];
         $goodses[$k]['ypoint'] = $v['ypoint'];
         $goodses[$k]['xpoint'] = $v['xpoint'];
         $goodses[$k]['name'] = $v['name'];
         $goodses[$k]['sub_name'] = $v['sub_name'];
         $goodses[$k]['goods_brief'] = $v['brief'];
         $goodses[$k]['buy_count'] = $v['buy_count'];
         $goodses[$k]['auto_order'] = $v['auto_order'];
         $goodses[$k]['current_price'] = round($v['current_price'], 2);
         $goodses[$k]['origin_price'] = round($v['origin_price'], 2);
         $goodses[$k]['icon'] = get_abs_img_root(get_spec_image($v['icon'], 140, 85, 0));
         if ($v['begin_time'] > 0 && ($taday_begin < $v['begin_time'] && $v['begin_time'] < $taday_end)) {
             $goodses[$k]['is_taday'] = 1;
         } else {
             if ($v['begin_time'] == 0 && ($taday_begin < $v['create_time'] && $v['create_time'] < $taday_end)) {
                 $goodses[$k]['is_taday'] = 1;
             } else {
                 $goodses[$k]['is_taday'] = 0;
             }
         }
     }
     $root['city_id'] = $city_id;
     $root['quan_id'] = $quan_id;
     $root['catalog_id'] = $catalog_id;
     $root['page_title'] = "团购列表";
     $root['page'] = array("page" => $page, "page_total" => $page_total, "page_size" => $page_size);
     if ($goodses === false) {
         $root['item'] = array();
     } else {
         $root['item'] = $goodses;
     }
     if ($bcate_list === false) {
         $root[''] = array();
     } else {
         $root['bcate_list'] = $bcate_list;
     }
     if ($quan_list === false) {
         $root['quan_list'] = array();
     } else {
         $root['quan_list'] = $quan_list;
     }
     output($root);
 }