<?php
/**
 * Created by PhpStorm.
 * User: stanley-king
 * Date: 16/2/22
 * Time: 上午11:47
 */


class deliveryControl extends mobileHomeControl
{
    public function __construct()
    {
        parent::__construct();
    }


    /**
     * @desc：物流信息查询
     * @author：jiafang.wang
     * @since: 2016.2.22
     */
    public function queryOp()
    {
        //获取物流单号
        //$order_sn = $_GET['order_sn'];
        //$condition = ['order_sn' => $order_sn];
        //$postid = Model()->table('goods')->where($condition)->field('shipping_code')->find();
        $postid = '227270508536';


        //查询本地是否有
            //取参数
            //请求快递100
            //取得json
            //存数据库
        //获取物流公司

        $com = 'shentong';
        //key
        $key = '5b634ac27f4c1a82';
        //组装URL查询
        $url = "http://api.kuaidi100.com/api";//?id={$key}&com={$com}&nu={$postid}&show=0&muti=1&order=desc";
        $params = array();
        {
            $params['id'] = $key;
            $params['com'] = $com;
            $params['nu'] = $postid;
            $params['show'] = 0;
            $params['muti'] = 1;
            $params['order'] = 'desc';
        }

        $response = http_request($url, $params, 'GET');
        $data = json_decode($response);

        Tpl::output('info', $data);
        Tpl::showpage('express_info');
    }
}
