cps 成果广告联盟 查询接口

2016-07-07 15:02 来源:www.chinab4c.com 作者:ecshop专家



<?php
header('Content-Type: text/html; charset=utf-8');
define('IN_ECS', true);
require($_SERVER['DOCUMENT_ROOT']. '/includes/init.php');
require( './excel.php');
$xls = new Excel_XML('UTF-8', false, 'My Test Sheet');
$data[] = array ('订单号', '下单时间', '商品名称', '商品数量', '商品价格');
//根据日期筛选订单
$order_info = $GLOBALS['db']->getAll('SELECT order_id,order_sn,add_time FROM '.$GLOBALS['ecs']->table('order_info')." WHERE from_ad=46 and pay_status=1 and order_status=5 and shipping_status=1 and order_sn like '%".$_GET['d']."%'");
if($order_info){
foreach($order_info as $key=>$val){
$data[] = array ('', '', '', '', '');
//获得订单中商品的信息
$goods_info_all = $GLOBALS['db']->getAll('SELECT * FROM '.$GLOBALS['ecs']->table('order_goods')." WHERE order_id=$val[order_id]");
foreach($goods_info_all as $key=>$vals){
$data[] = array ($val['order_sn'], date('Y-m-d H:i:s',$val['add_time']+28800), $vals['goods_name'], $vals['goods_number'], $vals['goods_price']);
}
}
}
$xls->addArray($data);
$xls->generateXML('VCOTTON'.$_GET['d']);
?>