cps 领克特广告联盟 查询接口

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



<?php
header('Content-Type: text/html; charset=utf-8');
define('IN_ECS', true);
require($_SERVER['DOCUMENT_ROOT']. '/includes/init.php');

//获得日期进行处理
$d = $_GET['yyymmdd'];
if(strpos($d,'-')){
$d_arr = explode('-',$d);
if(strlen($d_arr['0'])==4&&strlen($d_arr['1'])==2&&strlen($d_arr['2'])==2){
$min = mktime('0','0','0',$d_arr['1'],$d_arr['2'],$d_arr['0'])-28800;
$max = mktime('0','0','0',$d_arr['1'],$d_arr['2']+1,$d_arr['0'])-28800;
}else{exit('日期格式错误');}
}else{
$d = intval($d); $Y = substr($d,0,4); $M = substr($d,4,2); $D = substr($d,6,2);
if(strlen($Y)==4&&strlen($M)==2&&strlen($D)==2){
$min = mktime('0','0','0',$M,$D,$Y)-28800;
$max = mktime('0','0','0',$M,$D+1,$Y)-28800;
}else{exit('日期格式错误');}
}

//根据日期筛选订单
$sql = 'SELECT order_id,order_sn,add_time,goods_amount,cps_extension,order_status,shipping_status,pay_status FROM '.$GLOBALS['ecs']->table('order_info')." WHERE from_ad=47 and add_time>$min and add_time<$max";
$order_info = $GLOBALS['db']->getAll($sql);
if($order_info){
foreach($order_info as $key=>$val){
if($val['order_status']==0){$o_stat = 100;}else
if($val['order_status']==5&&$val['shipping_status']==1&&$val['pay_status']==1){$o_stat = 200;}else{$o_stat = 300;}

//获得订单中商品的信息
$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){
echo "2\t".date('His',$val['add_time']+28800)."\t".$val['cps_extension']."\t".$val['order_sn']."\t".$vals['goods_sn']."\t1\t".$vals['goods_number']."\t".$vals['goods_price']."\t1"."\t".$o_stat."\n";
}
}
}
?>

回答:
WHERE from_ad=47 and add_time>$min and add_time<$max";

from_ad=47请问这个是怎么来的啊?

不错,对于刚开始写接口的应该有帮助。