12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- /**
- * Created by PhpStorm.
- * User: stanley-king
- * Date: 16/1/22
- * Time: 上午10:22
- */
- //tid-订单号,status-1,consign_time-发货时间,logistics_no-快递流水,logistics_company-快递公司
- fcgi_header("Content-Type: text/plain; charset=UTF-8");
- try
- {
- $order_sn = trim($_POST['tid']);
- $status = intval($_POST['status']);
- $consign_time = urldecode(trim($_POST['consign_time']));
- $ship_time = strtotime($consign_time);
- $logistics_no = trim($_POST['logistics_no']);
- $logistics_company = $_POST['logistics_company'];
- Log::record("dispatch notify value: order_sn = {$order_sn},status={$status},consign_time = {$consign_time} logistics_no = {$logistics_no} logistics_company = {$logistics_company}.",Log::DEBUG);
- $express = Model('express')->field('id')->where(array('e_oms_code' => $logistics_company))->select();
- if(empty($express) || count($express) == 0) {
- echo 'FAIL';
- return;
- }
- $shipping_express_id = $express[0]['id'];
- $remote_addr = $_SERVER['REMOTE_ADDR'];
- if(!empty($order_sn) && !empty($logistics_no))
- {
- if($status == 1)
- {
- $order = Model('order');
- $ret = $order->setOrderDelivery($order_sn,$shipping_express_id,$logistics_no,$ship_time);
- if($ret) {
- echo 'SUCCESS';
- } else {
- echo 'AGAIN';
- }
- }
- else{
- echo 'SUCCESS';
- }
- }
- else
- {
- echo 'FAIL';
- }
- }
- catch (WxPayException $e)
- {
- Log::record($e->errorMessage(),Log::ERR);
- echo 'AGAIN';
- }
|