Example #1
0
File: tuanp.php Project: macall/jsd
    $xml .= "<loc>" . convertUrl($url) . "</loc>\r\n";
    $xml .= "<data>\r\n";
    $xml .= "<display>\r\n";
    $xml .= "<website>" . app_conf("SHOP_TITLE") . "</website>\r\n";
    $xml .= "<siteurl>" . SITE_DOMAIN . APP_ROOT . "</siteurl>\r\n";
    $xml .= "<city>" . $item[city_name] . "</city>\r\n";
    $xml .= "<title>" . emptyTag($item['goods_name']) . "</title>\r\n";
    if ($GLOBALS['distribution_cfg']['OSS_TYPE'] && $GLOBALS['distribution_cfg']['OSS_TYPE'] != "NONE") {
        $domain = $GLOBALS['distribution_cfg']['OSS_DOMAIN'];
    } else {
        $domain = SITE_DOMAIN . APP_ROOT;
    }
    $img = str_replace(APP_ROOT . "./public/", $domain . "/public/", $item['img']);
    $img = str_replace("./public/", $domain . "/public/", $item['img']);
    $xml .= "<image>" . $img . "</image>\r\n";
    $xml .= "<startTime>" . $begin_time . "</startTime>\r\n";
    $xml .= "<endTime>" . $end_tiime . "</endTime>\r\n";
    $xml .= "<value>" . round($item['origin_price'], 2) . "</value>\r\n";
    $xml .= "<price>" . round($item['current_price'], 2) . "</price>\r\n";
    $xml .= "<description><![CDATA[" . $item_brief . "]]></description>\r\n";
    $xml .= "<bought>" . $item['buy_count'] . "</bought>\r\n";
    $xml .= "<merchantName>" . emptyTag($item['supplier_name']) . "</merchantName>\r\n";
    $xml .= "<merchantPhone>" . $item['sp_tel'] . "</merchantPhone>\r\n";
    $xml .= "<merchantAddr>" . $item['sp_address'] . "</merchantAddr>\r\n";
    $xml .= "<detail><![CDATA[" . $item['content'] . "]]></detail>\r\n";
    $xml .= "</display>\r\n";
    $xml .= "</data>\r\n";
    $xml .= "</url>\r\n";
}
$xml .= "</urlset>\r\n";
echo $xml;
Example #2
0
    $list = $GLOBALS['db']->getAll($sql);
    $xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n";
    $xml .= "<response date=\"" . to_date($now, "r") . "\">\r\n";
    foreach ($list as $item) {
        $url = get_domain() . url("tuan", "deal", array("id" => $item['id']));
        $xml .= "<goods>\r\n";
        $xml .= "<cityid>" . $item['city_id'] . "</cityid>\r\n";
        $xml .= "<cityname>" . $item['city_name'] . "</cityname>\r\n";
        $xml .= "<id>" . $item['id'] . "</id>\r\n";
        $xml .= "<title>" . emptyTag($item['goods_name']) . "</title>\r\n";
        $xml .= "<brief><![CDATA[" . $item['goodsbrief'] . "]]></brief>\r\n";
        $xml .= "<url>" . convertUrl($url) . "</url>\r\n";
        $xml .= "<groupprice>" . floatval($item['current_price']) . "</groupprice>\r\n";
        $xml .= "<marketprice>" . floatval($item['origin_price']) . "</marketprice>\r\n";
        $xml .= "<begintime>" . to_date($item['begin_time'], "r") . "</begintime>\r\n";
        $xml .= "<endtime>" . to_date($item['end_time'], "r") . "</endtime>\r\n";
        //对图片路径的修复
        $domain = app_conf("PUBLIC_DOMAIN_ROOT") == '' ? get_domain() . APP_ROOT : app_conf("PUBLIC_DOMAIN_ROOT");
        $icon = str_replace(APP_ROOT . "./public/", $domain . "/public/", $item['icon']);
        $icon = str_replace("./public/", $domain . "/public/", $item['icon']);
        $img = str_replace(APP_ROOT . "./public/", $domain . "/public/", $item['img']);
        $img = str_replace("./public/", $domain . "/public/", $item['img']);
        $xml .= "<smallimg>" . $icon . "</smallimg>\r\n";
        $xml .= "<bigimg>" . $img . "</bigimg>\r\n";
        $xml .= "<suppliers>" . emptyTag($item['supplier_name']) . "</suppliers>\r\n";
        $xml .= "<buycount>" . $item['buy_count'] . "</buycount>\r\n";
        $xml .= "</goods>\r\n";
    }
    $xml .= "</response>\r\n";
    echo $xml;
}
Example #3
0
                     }
                 }
             }
         }
     }
 }
 $xml .= "<category>" . $class . "</category>\r\n";
 $xml .= "<subcategory>" . $classl . "</subcategory>\r\n";
 $xml .= "<characteristic></characteristic>\r\n";
 $xml .= "<destination></destination>\r\n";
 $xml .= "<thrcategory ></thrcategory >\r\n";
 $xml .= "<dpshopid>" . $item['xpoint'] . "," . $item['ypoint'] . "</dpshopid>\r\n";
 $xml .= "<range>" . $item['sp_address'] . "</range>\r\n";
 $xml .= "<address>" . $item['sp_address'] . "</address>\r\n";
 $xml .= "<major>1</major>\r\n";
 $xml .= "<title>" . addslashes(emptyTag($item['goods_name'])) . "</title>\r\n";
 if ($GLOBALS['distribution_cfg']['OSS_TYPE'] && $GLOBALS['distribution_cfg']['OSS_TYPE'] != "NONE") {
     $domain = $GLOBALS['distribution_cfg']['OSS_DOMAIN'];
 } else {
     $domain = SITE_DOMAIN . APP_ROOT;
 }
 $img = str_replace(APP_ROOT . "./public/", $domain . "/public/", $item['img']);
 $img = str_replace("./public/", $domain . "/public/", $item['img']);
 $xml .= "<image>" . $img . "</image>\r\n";
 $xml .= "<startTime>" . $begin_time . "</startTime>\r\n";
 $xml .= "<endTime>" . $end_tiime . "</endTime>\r\n";
 $xml .= "<value>" . round($item['origin_price'], 2) . "</value>\r\n";
 $xml .= "<price>" . round($item['current_price'], 2) . "</price>\r\n";
 $xml .= "<rebate>" . $rebate . "</rebate>\r\n";
 $xml .= "<bought>" . $item['buy_count'] . "</bought>\r\n";
 $xml .= "<name>" . $item['goods_name'] . "</name>\r\n";
Example #4
0
    $domain = app_conf("PUBLIC_DOMAIN_ROOT") == '' ? get_domain() . APP_ROOT : app_conf("PUBLIC_DOMAIN_ROOT");
    $xml .= "<keyword><![CDATA[" . emptyTag($item['goods_name']) . "]]></keyword>\r\n";
    $xml .= "<url>" . convertUrl($url) . "</url>\r\n";
    $xml .= "<creator>" . $domain . "</creator>\r\n";
    $xml .= "<title>" . emptyTag($item['goods_name']) . "</title>\r\n";
    $xml .= "<publishdate>" . date('Y-m-d', $begin_time) . "</publishdate>\r\n";
    $img = str_replace(APP_ROOT . "./public/", $domain . "/public/", $item['img']);
    $img = str_replace("./public/", $domain . "/public/", $item['img']);
    $xml .= "<imageaddress1>" . $img . "</imageaddress1>\r\n";
    $xml .= "<imagealt1><![CDATA[" . $item['goods_name'] . "]]></imagealt1>\r\n";
    $xml .= "<imagelink1>" . convertUrl($url) . "</imagelink1>\r\n";
    $xml .= "<content1><![CDATA[" . emptyTag($item['sub_name']) . "]]></content1>\r\n";
    $xml .= "<linktext1><![CDATA[" . emptyTag($item['sub_name']) . "]]></linktext1>\r\n";
    $xml .= "<linktarget1>" . convertUrl($url) . "</linktarget1>\r\n";
    //$xml.="<content2>".emptyTag($item['goods_name'])."</content2>\r\n";
    $xml .= "<content2>" . round($item['origin_price'], 2) . "</content2>\r\n";
    $xml .= "<content3>" . round($item['current_price'], 2) . "</content3>\r\n";
    $xml .= "<content4>" . $rebate . "</content4>\r\n";
    $xml .= "<content5>" . emptyTag($item['cate_name']) . "</content5>\r\n";
    $xml .= "<content6>" . $item['city_name'] . "</content6>\r\n";
    $xml .= "<content7>" . $item['id'] . "</content7>\r\n";
    $xml .= "<linktext2>" . iconv('utf-8', 'gbk', app_conf("SHOP_TITLE")) . "</linktext2>\r\n";
    $xml .= "<linktarget2>" . get_domain() . APP_ROOT . "</linktarget2>\r\n";
    $xml .= "<content8>" . date('Y-m-d H:m:s', $begin_time) . "</content8>\r\n";
    $xml .= "<content9>" . date('Y-m-d H:m:s', $end_tiime) . "</content9>\r\n";
    $xml .= "<valid>1</valid>\r\n";
    $xml .= "</item>\r\n";
}
$xml .= "</datalist>\r\n";
$xml .= "</sdd>\r\n";
echo $xml;
Example #5
0
 } else {
     $rebate = 0;
 }
 $begin_time = intval($item['begin_time']) > 0 ? intval($item['begin_time']) + 8 * 3600 : 0;
 $end_tiime = intval($item['end_time']) > 0 ? intval($item['end_time']) + 8 * 3600 : 0;
 $supplier = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_location where supplier_id = " . $item['supplier_id'] . " and is_main = 1");
 $address = "";
 if ($supplier) {
     $address = emptyTag($supplier['address']);
     $map = convertUrl("http://ditu.google.cn/maps?f=q&source=s_q&hl=zh-CN&geocode=&q=" . $supplier['api_address']);
 }
 $xml .= "<city_name>" . $item['city_name'] . "</city_name>\r\n";
 $xml .= "<site_url>" . get_domain() . APP_ROOT . "</site_url>\r\n";
 $xml .= "<title>" . mb_substr(emptyTag($item['goods_name']), 0, 10, 'utf-8') . "</title>\r\n";
 $xml .= "<goods_url>" . convertUrl($url) . "</goods_url>\r\n";
 $xml .= "<desc>" . emptyTag($item['goods_name']) . "</desc>\r\n";
 if (strstr($item['cate_name'], '餐饮') != false || strstr($item['cate_name'], '美食') != false) {
     $cate_name = '餐饮美食';
 } elseif (strstr($item['cate_name'], '休闲') != false || strstr($item['cate_name'], '娱乐') != false) {
     $cate_name = '休闲娱乐';
 } elseif (strstr($item['cate_name'], '美容') != false || strstr($item['cate_name'], '保健') != false) {
     $cate_name = '美容保健';
 } elseif (strstr($item['cate_name'], '精品') != false || strstr($item['cate_name'], '购物') != false) {
     $cate_name = '精品购物';
 } elseif (strstr($item['cate_name'], '优惠') != false || strstr($item['cate_name'], '券票') != false) {
     $cate_name = '优惠券票';
 } else {
     $cate_name = '其他';
 }
 $xml .= "<class>" . $cate_name . "</class>\r\n";
 $domain = app_conf("PUBLIC_DOMAIN_ROOT") == '' ? get_domain() . APP_ROOT : app_conf("PUBLIC_DOMAIN_ROOT");
Example #6
0
    }
    $xml .= "<class>" . $cate_name . "</class>\r\n";
    if ($GLOBALS['distribution_cfg']['OSS_TYPE'] && $GLOBALS['distribution_cfg']['OSS_TYPE'] != "NONE") {
        $domain = $GLOBALS['distribution_cfg']['OSS_DOMAIN'];
    } else {
        $domain = SITE_DOMAIN . APP_ROOT;
    }
    $img = str_replace(APP_ROOT . "./public/", $domain . "/public/", $item['img']);
    $img = str_replace("./public/", $domain . "/public/", $item['img']);
    $xml .= "<img_url>" . $img . "</img_url>\r\n";
    $xml .= "<pins></pins>\r\n";
    $xml .= "<original_price>" . number_format(round($item['origin_price'], 2), 2, '.', '') . "</original_price>\r\n";
    $xml .= "<sale_price>" . number_format(round($item['current_price'], 2), 2, '.', '') . "</sale_price>\r\n";
    $xml .= "<sale_rate>" . $rebate . "</sale_rate>\r\n";
    $xml .= "<sales_num>" . $item['buy_count'] . "</sales_num>\r\n";
    $xml .= "<start_time>" . to_date($begin_time, "YmdHis") . "</start_time>\r\n";
    $xml .= "<close_time>" . to_date($end_tiime, "YmdHis") . "</close_time>\r\n";
    $xml .= "<merchant_name>" . emptyTag(htmlspecialchars($item['supplier_name'])) . "</merchant_name>\r\n";
    $xml .= "<merchant_tel>" . emptyTag($supplier['tel']) . "</merchant_tel>\r\n";
    $xml .= "<merchant_addr>{$address}</merchant_addr>\r\n";
    $xml .= "<hot_area></hot_area>\r\n";
    $xml .= "<spend_start_time></spend_start_time>\r\n";
    $xml .= "<spend_close_time></spend_close_time>\r\n";
    $xml .= "<longitude></longitude>\r\n";
    $xml .= "<latitude></latitude>\r\n";
    $xml .= "<tip></tip>\r\n";
    $xml .= "</goods>\r\n";
}
$xml .= "</goodsdata>\r\n";
$xml .= "</data>\r\n";
echo $xml;
Example #7
0
    $xml .= "<endTime>" . date("Y-m-d", $end_tiime) . " 00:00:00" . "</endTime>\r\n";
    $xml .= "<value>" . number_format(round($item['origin_price'], 2), 2, '.', '0') . "</value>\r\n";
    $xml .= "<price>" . number_format(round($item['current_price'], 2), 2, '.', '0') . "</price>\r\n";
    $xml .= "<rebate>" . $rebate . "</rebate>\r\n";
    $xml .= "<bought>" . $item['buy_count'] . "</bought>\r\n";
    $xml .= "<maxQuota></maxQuota>\r\n";
    $xml .= "<minQuota></minQuota>\r\n";
    $xml .= "<post></post>\r\n";
    $xml .= "<soldOut></soldOut>\r\n";
    $xml .= "<priority>0</priority>\r\n";
    //			$xml.="<merchantEndTime></merchantEndTime>\r\n";
    $xml .= "<tip><![CDATA[" . $item_brief . "]]></tip>\r\n";
    //			$xml.="<detail><![CDATA[$item_brief]]></detail>\r\n";
    $xml .= "</display>\r\n";
    $xml .= "<shops>\r\n";
    $xml .= "<shop>\r\n";
    $xml .= "<name>" . emptyTag(htmlspecialchars($item['supplier_name'])) . "</name>\r\n";
    $xml .= "<tel>" . emptyTag($item['sp_tel']) . "</tel>\r\n";
    $xml .= "<addr>" . emptyTag($item['sp_address']) . "</addr>\r\n";
    $xml .= "<area></area>\r\n";
    $xml .= "<openTime></openTime>\r\n";
    $xml .= "<longitude></longitude>\r\n";
    $xml .= "<latitude></latitude>\r\n";
    $xml .= "<trafficInfo></trafficInfo>\r\n";
    $xml .= "</shop>\r\n";
    $xml .= "</shops>\r\n";
    $xml .= "</data>\r\n";
    $xml .= "</url>\r\n";
}
$xml .= "</urlset>\r\n";
echo $xml;
Example #8
0
function getGoodsArray($item)
{
    /**
     * has_attr: 0:无属性; 1:有属性
     * 有商品属性在要购买时,要选择属性后,才能购买(用户在列表中点:购买时,要再弹出一个:商品属性选择对话框)
     * change_cart_request_server:
     * 编辑购买车商品时,需要提交到服务器端,让服务器端通过一些判断返回一些信息回来(如:满多少钱,可以免运费等一些提示)
     * 0:提交,1:不提交;
     *
     * num_unit: 单位
     * limit_num: 库存数量
     *
     */
    $goods = array();
    $goods['city_name'] = "";
    $goods['goods_id'] = $item['id'];
    $goods['title'] = emptyTag($item['name']);
    if (empty($item['sub_name'])) {
        $goods['sub_name'] = emptyTag($item['name']);
    } else {
        $goods['sub_name'] = emptyTag($item['sub_name']);
    }
    //$goods['image']=get_abs_img_root(make_img($item['img'],0));
    $goods['image'] = get_abs_img_root(get_spec_image($item['img'], 320, 194, 1));
    //get_abs_img_root( get_spec_image($v['o_path'],160,0,0));
    $goods['buy_count'] = $item['buy_count'];
    $goods['start_date'] = $item['begin_time'];
    $goods['end_date'] = $item['end_time'];
    $goods['ori_price'] = round($item['origin_price'], 2);
    $goods['cur_price'] = round($item['current_price'], 2);
    if (empty($item['brief'])) {
        $goods['goods_brief'] = $item['name'];
    } else {
        $goods['goods_brief'] = $item['brief'];
    }
    $goods['ori_price_format'] = format_price($goods['ori_price']);
    $goods['cur_price_format'] = format_price($goods['cur_price']);
    $goods['discount'] = $item['discount'];
    $sp_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_location where supplier_id = " . $item['supplier_id'] . " order by is_main desc");
    $goods['address'] = $sp_info['address'];
    // 地址未完
    $goods['num_unit'] = "";
    //$item['num_unit'];
    $limit_num = intval($item['max_bought']);
    //如果库存为0时,不设置为:99999,不限制购买数量;
    if ($limit_num == 0) {
        $limit_num = 99999;
    }
    $goods['limit_num'] = $limit_num;
    $goods['goods_desc'] = $item['description'];
    $goods['is_shop'] = $item['is_shop'];
    $goods['is_hot'] = $item['is_hot'];
    $goods['notes'] = $item['notes'];
    $goods['package'] = $item['package'];
    $goods['supplier_location_id'] = $GLOBALS['db']->getOne("select location_id from " . DB_PREFIX . "deal_location_link where deal_id = " . $item['id']);
    $goods['any_refund'] = $item['any_refund'];
    $goods['expire_refund'] = $item['expire_refund'];
    //标签列表
    //支持随时退款
    $ext_label = array();
    if ($goods['any_refund'] == 1) {
        $ext_label[] = array('type' => 0, 'ico' => '', 'name' => '支持随时退款');
    }
    //支持过期退款
    if ($goods['expire_refund'] == 1) {
        $ext_label[] = array('type' => 1, 'ico' => '', 'name' => '支持过期退款');
    }
    $goods['ext_label'] = $ext_label;
    $goods['time_status'] = $item['time_status'];
    $goods['end_time'] = $item['end_time'];
    $goods['begin_time'] = $item['begin_time'];
    $goods['sp_location_id'] = $sp_info['id'];
    //供应商信息
    $goods['sp_detail'] = $sp_info['name'];
    //供应商信息
    $goods['sp_tel'] = $sp_info['tel'];
    /*供应商电话*/
    $pattern = "/<img([^>]*)\\/>/i";
    $replacement = "<img width=300 \$1 />";
    $goods['goods_desc'] = get_abs_img_root(format_html_content_image($goods['goods_desc'], 300));
    $goods['goods_desc'] = preg_replace($pattern, $replacement, $goods['goods_desc']);
    $goods['saving_format'] = $item['save_price_format'];
    if ($goods['end_date'] == 0) {
        $goods['less_time'] = "none";
        //永不过期,无倒计时
        $goods['less_time_format'] = "999天";
        //永不过期,无倒计时
    } else {
        $goods['less_time'] = $goods['end_date'] - get_gmtime();
        if ($goods['less_time'] < 0) {
            $goods['less_time'] = 0;
        }
        $goods['less_time_format'] = getTimeFormat($goods['less_time']);
    }
    $goods['has_attr'] = 0;
    //has_attr: 0:无属性; 1:有属性
    if ($item['is_delivery'] == 1) {
        $goods['has_delivery'] = 1;
        $goods['has_mcod'] = 1;
    } else {
        $goods['has_delivery'] = 0;
        $goods['has_mcod'] = 0;
    }
    if ($goods['cart_type'] == 0) {
        $goods['has_cart'] = 1;
        //1:可以跟其它商品一起放入购物车购买;0:不能放入购物车,只能独立购买
    } else {
        $goods['has_cart'] = 0;
    }
    $goods['change_cart_request_server'] = 1;
    $goods['is_refund'] = $item['is_refund'];
    /*0:不支持退款; 1:支持退款*/
    $goods['avg_point'] = $item['avg_point'];
    /*购买点评平均分*/
    $goods['distance'] = $item['distance'];
    $goods['attr'] = getAttrArray($item['id']);
    if (intval($goods['attr']['has_attr_1']) > 0 || intval($goods['attr']['has_attr_2']) > 0) {
        $goods['has_attr'] = 1;
    }
    //$goods['share_content']=msubstr($topic['content']).get_domain().str_replace("mapi/","",url("shop","topic",array("id"=>$topic['id'])));
    $goods['share_url'] = get_domain() . str_replace("sjmapi/", "", url("index", "deal#" . $item['id']));
    $goods['share_content'] = emptyTag($item['name']) . $goods['share_url'];
    return $goods;
}
Example #9
0
function getGoodsArray($item)
{
    /**
     * has_attr: 0:无属性; 1:有属性
     * 有商品属性在要购买时,要选择属性后,才能购买(用户在列表中点:购买时,要再弹出一个:商品属性选择对话框)
     * change_cart_request_server:
     * 编辑购买车商品时,需要提交到服务器端,让服务器端通过一些判断返回一些信息回来(如:满多少钱,可以免运费等一些提示)
     * 0:提交,1:不提交;
     *
     * num_unit: 单位
     * limit_num: 库存数量
     *
     */
    $goods = array();
    $goods['city_name'] = "";
    $goods['goods_id'] = $item['id'];
    $goods['title'] = emptyTag($item['name']);
    //$goods['image']=get_abs_img_root(make_img($item['img'],0));
    $goods['image'] = get_abs_img_root(get_spec_image($item['img'], 160, 160, 0));
    //get_abs_img_root( get_spec_image($v['o_path'],160,0,0));
    $goods['buy_count'] = $item['buy_count'];
    $goods['start_date'] = $item['begin_time'];
    $goods['end_date'] = $item['end_time'];
    $goods['ori_price'] = round($item['origin_price'], 2);
    $goods['cur_price'] = round($item['current_price'], 2);
    $goods['goods_brief'] = $item['brief'];
    $goods['ori_price_format'] = format_price($goods['ori_price']);
    $goods['cur_price_format'] = format_price($goods['cur_price']);
    $goods['discount'] = $item['discount'];
    $sp_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_location where supplier_id = " . $item['supplier_id'] . " and is_main = 1");
    $goods['address'] = $sp_info['address'];
    // 地址未完
    $goods['num_unit'] = "";
    //$item['num_unit'];
    $goods['limit_num'] = $item['max_bought'];
    $goods['goods_desc'] = $item['description'];
    $goods['sp_detail'] = $sp_info['name'] . "<br />" . $item['address'] . "<br />" . $item['tel'];
    //供应商信息
    $pattern = "/<img([^>]*)\\/>/i";
    $replacement = "<img width=300 \$1 />";
    $goods['goods_desc'] = preg_replace($pattern, $replacement, get_abs_img_root($goods['goods_desc']));
    $goods['saving_format'] = $item['save_price_format'];
    if ($goods['end_date'] == 0) {
        $goods['less_time'] = "none";
    } else {
        $goods['less_time'] = $goods['end_date'] - get_gmtime();
    }
    $goods['has_attr'] = 0;
    //has_attr: 0:无属性; 1:有属性
    if ($item['is_delivery'] == 1) {
        $goods['has_delivery'] = 1;
        $goods['has_mcod'] = 1;
    } else {
        $goods['has_delivery'] = 0;
        $goods['has_mcod'] = 0;
    }
    if ($goods['cart_type'] == 0) {
        $goods['has_cart'] = 1;
        //1:可以跟其它商品一起放入购物车购买;0:不能放入购物车,只能独立购买
    } else {
        $goods['has_cart'] = 0;
    }
    $goods['change_cart_request_server'] = 1;
    $goods['attr'] = getAttrArray($item['id']);
    $goods['distance'] = $item['distance'];
    if (intval($goods['attr']['true_has_attr_1']) > 0 || intval($goods['attr']['true_has_attr_2']) > 0) {
        $goods['has_attr'] = 1;
    }
    return $goods;
}