예제 #1
0
$res = "";
$carrierId = 0;
$data = array();
$type = isset($argv[1]) ? $argv[1] : 0;
//运输方式名,不填暂不通过
$days = isset($argv[2]) ? $argv[2] : 1;
//几天内跟踪号,不填默认1天内
$cat = isset($argv[3]) ? $argv[3] : 'day';
//日期类型默认几天,可以选date日期
if (empty($type)) {
    exit("运输方式名填写有误");
}
if (!in_array($cat, array('day', 'date'))) {
    exit("日期类型有误!");
}
$res = TransOpenApiModel::getErpTrackNumList($type, $days, $cat);
echo $res, "\n\n";
$res = json_decode($res, true);
if (!is_array($res) || !count($res)) {
    print_r($argv);
    exit("没有数据被获取,请确认条件!");
}
switch ($type) {
    case "中国邮政挂号":
        $carrierId = 2;
        break;
    case "ems":
        $carrierId = 5;
        break;
    case "eub":
        $carrierId = 6;