Ejemplo n.º 1
0
 /**
  * 名称: act_getOrderTracknumberBydate
  * 功能: 获取订单的跟踪号信息
  * @para $startTime int
  * @para $endTime int
  * return Array
  */
 public function act_getOrderTracknumberBydate()
 {
     $startTime = $_REQUEST['startTime'];
     $endTime = $_REQUEST['endTime'];
     $truckNumberData = OrderTracknumberModel::getTracknumberInfoByDate($startTime, $endTime);
     if (!$truckNumberData) {
         self::$errCode = OrderTracknumberModel::$errCode;
         self::$errMsg = OrderTracknumberModel::$errMsg;
         return false;
     }
     return $truckNumberData;
 }
Ejemplo n.º 2
0
<?php

error_reporting(-1);
header("Content-type: text/html; charset=utf-8");
date_default_timezone_set('Asia/Shanghai');
require "/data/web/order.valsun.cn/framework.php";
Core::getInstance();
/*
require_once WEB_PATH . 'lib/rabbitmq/vendor/autoload.php';
use PhpAmqpLib\Connection\AMQPConnection;
use PhpAmqpLib\Message\AMQPMessage;

$connection = new AMQPConnection('112.124.41.121', 5672, 'valsun_warehouse','warehouse%123','valsun_warehouse');*/
$startTime = strtotime("-3 days", time());
$endTime = time();
$url = 'http://api.wh.valsun.cn/json.php?mod=orderTracknumber&act=getOrderTracknumber&jsonp=1&startTime=' . $startTime . '&endTime=' . $endTime;
$data = file_get_contents($url);
$data = json_decode($data, true);
$ret = OrderTracknumberModel::updateOrderTracknumber($data['data']);
if (!$ret) {
    echo '更新失败!, 原因: errCode' . OrderTracknumberModel::$errCode . ', errMsg: ' . OrderTracknumberModel::$errMsg;
    exit;
}
echo '更新成功!';
exit;
Ejemplo n.º 3
0
    /**
     * 名称: getTracknumberInfoByDate
     * 功能: 根据开始时间与结束时间获取跟踪号信息
     * @para $startTime int
     * @para $endTime int
     * return Array
     */
    public function getTracknumberInfoByDate($startTime, $endTime)
    {
        self::initDB();
        if (preg_match('/^\\d+$/', $startTime) < 1 || preg_match('/^\\d+$/', $endTime) < 1) {
            self::$errCode = '3302';
            self::$errMsg = '开始时间或结束时间输入不正确, 请重试! ';
            return false;
        }
        $sql = 'SELECT os.`id`,os.`originOrderId`,os.`recordNumber`,os.`shipOrderId`,os.`storeId`,ot.`tracknumber` 
				FROM wh_shipping_order_relation AS os
				LEFT JOIN wh_order_tracknumber AS ot ON os.`shipOrderId` = ot.`shipOrderId`
				WHERE ot.createdTime >= ' . $startTime . ' AND ot.createdTime <= ' . $endTime;
        $query = self::$dbConn->query($sql);
        if ($query) {
            $ret = self::$dbConn->fetch_array_all($query);
        } else {
            self::$errCode = "003";
            self::$errMsg = "error";
            return false;
        }
        $data = array();
        if (!empty($ret)) {
            $tempData = array();
            foreach ($ret as $k => $v) {
                $tempData[] = $v['originOrderId'];
            }
            $tempData = array_flip(array_flip($tempData));
            //清除多余的订单号
            foreach ($ret as $k => $v) {
                if (in_array($v['originOrderId'], $tempData)) {
                    $data[] = array('orderId' => $v['originOrderId'], 'tracknumber' => $v['tracknumber']);
                }
            }
        }
        return $data;
        //成功, 返回列表数据
    }