public function check_delivery()
 {
     $express_id = intval($_REQUEST['express_id']);
     $typeNu = addslashes(trim($_REQUEST["express_sn"]));
     $express_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "express where is_effect = 1 and id = " . $express_id);
     $express_info['config'] = unserialize($express_info['config']);
     $typeCom = trim($express_info['config']["app_code"]);
     if (isset($typeCom) && isset($typeNu)) {
         $AppKey = app_conf("KUAIDI_APP_KEY");
         //请将XXXXXX替换成您在http://kuaidi100.com/app/reg.html申请到的KEY
         $url = 'http://api.kuaidi100.com/api?id=' . $AppKey . '&com=' . $typeCom . '&nu=' . $typeNu . '&show=0&muti=1&order=asc';
         //优先使用curl模式发送数据
         //KUAIDI_TYPE : 1. API查询 2.页面查询
         if (app_conf("KUAIDI_TYPE") == 1) {
             $api_result = get_delivery_api_content($url);
             $api_result_status = $api_result['status'];
             $get_content = $api_result['html'];
             //请勿删除变量$powered 的信息,否者本站将不再为你提供快递接口服务。
             $powered = '查询数据由:<a href="http://kuaidi100.com" target="_blank">KuaiDi100.Com (快递100)</a> 网站提供 ';
             $data['msg'] = $get_content . '<br/>' . $powered;
             $data['status'] = 1;
             //API查询
             ajax_return($data);
         } else {
             $data['msg'] = "http://www.kuaidi100.com/chaxun?com=" . $typeCom . "&nu=" . $typeNu;
             $data['status'] = 2;
             //页面查询
             ajax_return($data);
         }
     } else {
         $data['msg'] = '查询失败,请重试';
         $data['status'] = 0;
         //查询失败
         ajax_return($data);
     }
     exit;
 }
Exemple #2
0
 /**
  * 快递查询
  */
 public function check_delivery()
 {
     $id = intval($_REQUEST['id']);
     $s_account_info = $GLOBALS["account_info"];
     $supplier_id = intval($s_account_info['supplier_id']);
     $delivery_notice = $GLOBALS['db']->getRow("select n.* from " . DB_PREFIX . "delivery_notice as n left join " . DB_PREFIX . "deal_location_link as l on l.deal_id = n.deal_id where n.order_item_id = " . $id . " and  l.location_id in (" . implode(",", $s_account_info['location_ids']) . ")  order by n.delivery_time desc");
     if ($delivery_notice) {
         $data['status'] = true;
         $express_id = intval($delivery_notice['express_id']);
         $typeNu = strim($delivery_notice["notice_sn"]);
         $express_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "express where is_effect = 1 and id = " . $express_id);
         $express_info['config'] = unserialize($express_info['config']);
         $typeCom = strim($express_info['config']["app_code"]);
         if (isset($typeCom) && isset($typeNu)) {
             $AppKey = app_conf("KUAIDI_APP_KEY");
             //请将XXXXXX替换成您在http://kuaidi100.com/app/reg.html申请到的KEY
             $url = 'http://api.kuaidi100.com/api?id=' . $AppKey . '&com=' . $typeCom . '&nu=' . $typeNu . '&show=0&muti=1&order=asc';
             //优先使用curl模式发送数据
             //KUAIDI_TYPE : 1. API查询 2.页面查询
             if (app_conf("KUAIDI_TYPE") == 1) {
                 $data = es_session::get(md5($url));
                 if (empty($data) || NOW_TIME - $data['time'] > 600) {
                     $api_result = get_delivery_api_content($url);
                     $api_result_status = $api_result['status'];
                     $get_content = $api_result['html'];
                     //请勿删除变量$powered 的信息,否者本站将不再为你提供快递接口服务。
                     $powered = '查询数据由:<a href="http://kuaidi100.com" target="_blank">KuaiDi100.Com (快递100)</a> 网站提供 ';
                     $data['html'] = $get_content . '<br/>' . $powered;
                     $data['status'] = true;
                     //API查询
                     $data['time'] = NOW_TIME;
                     if ($api_result_status) {
                         es_session::set(md5($url), $data);
                     }
                 }
                 ajax_return($data);
             } else {
                 $url = "http://www.kuaidi100.com/chaxun?com=" . $typeCom . "&nu=" . $typeNu;
                 app_redirect($url);
             }
         } else {
             if (app_conf("KUAIDI_TYPE") == 1) {
                 $data['status'] = false;
                 $data['status'] = "非法的快递查询";
                 ajax_return($data);
             } else {
                 init_app_page();
                 showErr("非法的快递查询");
             }
         }
     } else {
         if (app_conf("KUAIDI_TYPE") == 1) {
             $data['status'] = false;
             ajax_return($data);
         } else {
             init_app_page();
             showErr("非法的快递查询");
         }
     }
 }