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; }
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); }
public function kuaiState() { $db = new DB_test(); $arr_header = $this->arr_header; $arr_body = $this->arr_body; $arr_channelinfo = $this->arr_channelinfo; $authorid = trim($arr_header['authorid']); $kdtype = trim($arr_body['kdtype']); $kdcode = trim($arr_body['kdcode']); $a = new Express(); $arr_msg = $a->gethtmlorder($kdtype, $kdcode); //print_r($arr_msg);exit; $returnvalue = array($arr_msg); $retcode = "0"; //反馈状态 0 成功 200 自定义错误 $returnval = TfbxmlResponse::ResponsetoApp($retcode, $returnvalue); return $returnval; }
public function testOrder() { $this->_nvp->expects($this->any())->method('setProcessableErrors')->will($this->returnSelf()); $this->_nvp->expects($this->any())->method('setAmount')->will($this->returnSelf()); $this->_nvp->expects($this->any())->method('setCurrencyCode')->will($this->returnSelf()); $this->_nvp->expects($this->any())->method('setTransactionId')->will($this->returnSelf()); $this->_nvp->expects($this->any())->method('callDoAuthorization')->will($this->returnSelf()); $this->_pro->expects($this->any())->method('getApi')->will($this->returnValue($this->_nvp)); $this->_checkoutSession->expects($this->once())->method('getPaypalTransactionData')->will($this->returnValue([])); $this->_checkoutSession->expects($this->once())->method('setPaypalTransactionData')->with([]); $currency = $this->getMock('Magento\\Directory\\Model\\Currency', ['__wakeup', 'formatTxt'], [], '', false); $paymentModel = $this->getMock('Magento\\Sales\\Model\\Order\\Payment', ['__wakeup', 'getBaseCurrency', 'getOrder', 'getIsTransactionPending', 'addStatusHistoryComment'], [], '', false); $paymentModel->expects($this->any())->method('getOrder')->will($this->returnSelf()); $paymentModel->expects($this->any())->method('getBaseCurrency')->will($this->returnValue($currency)); $paymentModel->expects($this->any())->method('getIsTransactionPending')->will($this->returnSelf()); $this->_model = $this->_helper->getObject('Magento\\Paypal\\Model\\Express', ['proFactory' => $this->_pro, 'checkoutSession' => $this->_checkoutSession]); $this->_model->order($paymentModel, 12.3); $this->assertEquals('payment_review', $paymentModel->getState()); }
<?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');
$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);
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'); }
<?php header("Content-type: text/html; charset=utf-8"); include 'Express.php'; echo '<pre>'; var_dump(json_decode(Express::getExpressInfo('7571742361111'), true));
<?php require './Class/Express.class.php'; header('Content-Type:text/html; charset=utf-8'); $express = new Express(); $result = $express->getorder('111309582915'); var_dump($result);
* * @return array */ public static function getAll() { return self::$data; } /** * curl请求 * * @param string $url 请求连接 * @return bool|mixed */ private static function httpGet($url) { $oCurl = curl_init(); curl_setopt($oCurl, CURLOPT_URL, $url); curl_setopt($oCurl, CURLOPT_TIMEOUT, 10); curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1); $sContent = curl_exec($oCurl); $aStatus = curl_getinfo($oCurl); curl_close($oCurl); if (intval($aStatus["http_code"]) == 200) { return $sContent; } else { return false; } } } echo Express::search('807209844896');
/** * 获取物流信息 */ public function express() { $type = $_GET['type']; $order_no = $_GET['order_no']; $express_no = $_GET['express_no']; if (empty($type) || empty($express_no) || empty($order_no)) { echo json_encode(array('status' => false)); exit; } $express = D('Express')->where(array('code' => $type))->find(); if (empty($express)) { echo json_encode(array('status' => false)); exit; } $url = 'http://www.kuaidi100.com/query?type=' . $type . '&postid=' . $express_no . '&id=1&valicode=&temp=' . time() . rand(100000, 999999); import('class.Express'); //$content = Http::curlGet($url); $content = Express::kuadi100($url); $content_arr = json_decode($content, true); if (empty($content_arr)) { echo json_encode(array('status' => false)); exit; } else { echo json_encode(array('status' => true, 'data' => $content_arr)); exit; } }
$meta_description = _("Here you can quickly insert new symptoms and symptom-remedy-relations into the database."); include "skins/{$skin}/header.php"; ?> <h1> <?php echo _("Express-Tool"); ?> </h1> <p><?php echo _("Here you can quickly insert <strong>new symptoms</strong> and <strong>symptom-remedy-relations</strong> into the database."); ?> </p> <?php if (!empty($_POST['sym_rem'])) { include "include/classes/express_class.php"; $express = new Express($_POST['sym_rem']); $query = "SELECT COUNT(*) FROM express_symptoms"; $db->send_query($query); list($count_symptoms) = $db->db_fetch_row(); $db->free_result(); if ($count_symptoms != 0) { $query = "SELECT sympt_id, symptom, rubric_id, page, extra, kuenzli, backup FROM express_symptoms"; $result_symptoms = $db->send_query($query); while (list($sympt_id, $symptom, $rubric_id, $page, $extra, $sym_kuenzli, $backup) = $db->db_fetch_row($result_symptoms)) { $express->count_ar['rec']['all']++; $is_duplicated_symptom = 0; $query = "SELECT sym_id FROM symptoms WHERE rubric_id = '{$rubric_id}' AND lang_id = '" . $express->src_lang . "' AND symptom = '{$symptom}'"; $db->send_query($query); list($sym_id) = $db->db_fetch_row(); $db->free_result(); if (!empty($sym_id)) {