Exemplo n.º 1
0
 public function respond()
 {
     if ($this->message['event'] == 'scancode_waitmsg') {
         $qrtype = $this->message['scancodeinfo']['scantype'];
         if ($qrtype == 'barcode') {
             $CodeInfo = $this->message['scancodeinfo']['scanresult'];
             $Codearr = explode(",", $CodeInfo);
             $Code = $Codearr['1'];
         } else {
             $Code = $this->message['scancodeinfo']['scanresult'];
         }
     } else {
         $rid = $this->rule;
         $sql = "SELECT * FROM " . tablename('rule_keyword') . " WHERE `rid`=:rid LIMIT 1";
         $row = pdo_fetch($sql, array(':rid' => $rid));
         $keywords = $row['content'];
         // 取得正则表达式
         //查询防伪码
         preg_match('/' . $keywords . '(.*)/', $this->message['content'], $match);
         $Code = $match[1];
     }
     //return $this->respText($Code);
     $express = new Express();
     $result = $express->getorder($Code);
     if ($result['status'] == '200') {
         $time = $result['updatetime'];
         foreach ($result['data'] as $trace) {
             $reply .= "{$trace['time']}\n{$trace['context']}\n-------\n";
         }
         $msg = "快递单号:\n" . $Code . "\n最后更新:\n" . $time . "\n流转情况:\n" . $reply;
     } else {
         $msg = '查询失败 ' . $result['message'];
     }
     return $this->respText($msg);
 }
Exemplo n.º 2
0
 public function chaxunKuaiDiNo()
 {
     $db = new DB_test();
     $arr_header = $this->arr_header;
     $arr_body = $this->arr_body;
     $arr_channelinfo = $this->arr_channelinfo;
     $com = $arr_body['com'];
     $nu = $arr_body['nu'];
     $query = "select fd_kdcompany_id as comid,fd_kdcompany_no as com,\n\t\t         fd_kdcompany_api as api,fd_kdcompany_name as comname from \n\t       tb_kdcompany where fd_kdcompany_no = '{$com}'";
     //只显示激活的列表
     $db->query($query);
     $arr_v = auto_charset($db->getFiledData(''), 'gbk', 'utf-8');
     $a = new Express();
     switch ($arr_v['api']) {
         case 'gethtmlorder':
             //echo $arr_v ['api'];
             $result = $a->gethtmlorder($com, $nu);
             $arr_msg['msgbody']['apiurl'] = $result;
             $arr_msg['msgbody']['apitype'] = $arr_v['api'];
             break;
         default:
             $result = $a->getorder($com, $nu);
             $arr_msg['msgbody'] = $result;
             $arr_msg['msgbody']['apitype'] = $arr_v['api'];
             break;
     }
     $arr_message = array("result" => "success", "message" => "读取成功!");
     $retcode = "0";
     //反馈状态 0 成功 200 自定义错误
     $returnvalue = array("msgbody" => $arr_msg['msgbody']);
     $returnval = TfbxmlResponse::ResponsetoApp($retcode, $returnvalue);
     return $returnval;
 }
Exemplo n.º 3
0
<?php

/**
 * 查询物流信息
 */
define('IN_ECS', true);
require dirname(__FILE__) . '/includes/init.php';
include_once ROOT_PATH . 'kuaidi/kuaidi.php';
if ($_SESSION['user_id'] == 0) {
    show_message('您还没有登录!', '去登录', 'user.php');
} else {
    $user_id = $_SESSION['user_id'];
}
$order_id = intval($_REQUEST['order_id']);
if ($order_id > 0) {
    $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('order_info') . " WHERE order_id = '{$order_id}' AND user_id = '{$user_id}'";
    $count = $GLOBALS['db']->getOne($sql);
    if ($count > 0) {
        $sql = "SELECT shipping_name,invoice_no FROM " . $GLOBALS['ecs']->table('order_info') . " WHERE order_id = '{$order_id}'";
        $order = $GLOBALS['db']->getRow($sql);
        $kuaidi = new Express();
        $result = $kuaidi->getorder($order['shipping_name'], $order['invoice_no']);
        $smarty->assign('order', $order);
        $smarty->assign('kuaidi_list', $result['data']);
    } else {
        show_message('您没有权限查看此物流信息!');
    }
} else {
    Header("Location: index.php\n");
}
$smarty->display('kuaidi_list.dwt');
Exemplo n.º 4
0
                $data[$k] = !is_string($v) ? $this->json_array($v) : $v;
            }
            return $data;
        }
    }
    /*
     * 返回$data array      快递数组
     * @param $name         快递名称
     * 支持输入的快递名称如下
     * (申通-EMS-顺丰-圆通-中通-如风达-韵达-天天-汇通-全峰-德邦-宅急送-安信达-包裹平邮-邦送物流
     * DHL快递-大田物流-德邦物流-EMS国内-EMS国际-E邮宝-凡客配送-国通快递-挂号信-共速达-国际小包
     * 汇通快递-华宇物流-汇强快递-佳吉快运-佳怡物流-加拿大邮政-快捷速递-龙邦速递-联邦快递-联昊通
     * 能达速递-如风达-瑞典邮政-全一快递-全峰快递-全日通-申通快递-顺丰快递-速尔快递-TNT快递-天天快递
     * 天地华宇-UPS快递-新邦物流-新蛋物流-香港邮政-圆通快递-韵达快递-邮政包裹-优速快递-中通快递)
     * 中铁快运-宅急送-中邮物流
     * @param $order        快递的单号
     * $data['ischeck'] ==1   已经签收
     * $data['data']        快递实时查询的状态 array
     */
    public function getorder($name, $order)
    {
        $keywords = $this->expressname[$name];
        $result = $this->getcontent("http://www.kuaidi100.com/query?type={$keywords}&postid={$order}");
        $result = json_decode($result);
        $data = $this->json_array($result);
        return $data;
    }
}
$a = new Express();
$result = $a->getorder("全一快递", 111309582915);
var_dump($result);
Exemplo n.º 5
0
function action_order_detail()
{
    $user = $GLOBALS['user'];
    $_CFG = $GLOBALS['_CFG'];
    $_LANG = $GLOBALS['_LANG'];
    $smarty = $GLOBALS['smarty'];
    $db = $GLOBALS['db'];
    $ecs = $GLOBALS['ecs'];
    $user_id = $GLOBALS['user_id'];
    include_once ROOT_PATH . 'includes/lib_transaction.php';
    include_once ROOT_PATH . 'includes/lib_payment.php';
    include_once ROOT_PATH . 'includes/lib_order.php';
    include_once ROOT_PATH . 'includes/lib_clips.php';
    include_once ROOT_PATH . 'kuaidi/kuaidi.php';
    $order_id = isset($_GET['order_id']) ? intval($_GET['order_id']) : 0;
    /* 订单详情 */
    $order = get_order_detail($order_id, $user_id);
    if ($order === false) {
        $GLOBALS['err']->show($_LANG['back_home_lnk'], './');
        exit;
    }
    /* 是否显示添加到购物车 */
    if ($order['extension_code'] != 'group_buy' && $order['extension_code'] != 'exchange_goods') {
        $smarty->assign('allow_to_cart', 1);
    }
    /* 订单商品 */
    $goods_list = order_goods($order_id);
    foreach ($goods_list as $key => $value) {
        $goods_list[$key]['market_price'] = price_format($value['market_price'], false);
        $goods_list[$key]['goods_price'] = price_format($value['goods_price'], false);
        $goods_list[$key]['subtotal'] = price_format($value['subtotal'], false);
    }
    /* 设置能否修改使用余额数 */
    if ($order['order_amount'] > 0) {
        if ($order['order_status'] == OS_UNCONFIRMED || $order['order_status'] == OS_CONFIRMED) {
            $user = user_info($order['user_id']);
            if ($user['user_money'] + $user['credit_line'] > 0) {
                $smarty->assign('allow_edit_surplus', 1);
                $smarty->assign('max_surplus', sprintf($_LANG['max_surplus'], $user['user_money']));
            }
        }
    }
    /* 未发货,未付款时允许更换支付方式 */
    if ($order['order_amount'] > 0 && $order['pay_status'] == PS_UNPAYED && $order['shipping_status'] == SS_UNSHIPPED) {
        $payment_list = available_payment_list(false, 0, true);
        /* 过滤掉当前支付方式和余额支付方式 */
        if (is_array($payment_list)) {
            foreach ($payment_list as $key => $payment) {
                if ($payment['pay_id'] == $order['pay_id'] || $payment['pay_code'] == 'balance') {
                    unset($payment_list[$key]);
                }
            }
        }
        $smarty->assign('payment_list', $payment_list);
    }
    /* 订单 支付 配送 状态语言项 */
    $order['order_status'] = $_LANG['os'][$order['order_status']];
    $order['pay_status'] = $_LANG['ps'][$order['pay_status']];
    $order['shipping_status'] = $_LANG['ss'][$order['shipping_status']];
    //快递跟踪
    $kuaidi = new Express();
    $result = $kuaidi->getorder($order['shipping_name'], $order['invoice']);
    $smarty->assign('kuaidi', $result['data'][0]);
    $smarty->assign('order', $order);
    $smarty->assign('goods_list', $goods_list);
    $smarty->display('user_transaction.dwt');
}
Exemplo n.º 6
0
<?php

require './Class/Express.class.php';
header('Content-Type:text/html; charset=utf-8');
$express = new Express();
$result = $express->getorder('111309582915');
var_dump($result);