12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- /**
- * Created by PhpStorm.
- * User: stanley-king
- * Date: 16/1/22
- * Time: 上午10:22
- */
- echo("Content-Type: text/plain; charset=UTF-8\r\n\r\n");
- try
- {
- //tid-订单号,status-1,consign_time-发货时间,logistics_no-快递流水,logistics_company-快递公司
- $order_sn = trim($_POST['tid']);
- $status = intval($_POST['status']);
- //$consign_time = $_POST['consign_time'];
- $logistics_no = trim($_POST['logistics_no']);
- $logistics_company = $_POST['logistics_company'];
- $express = Model('express')->field('id')->where(array('e_code' => $logistics_company))->select();
- if(empty($express) || count($express) == 0) {
- echo 'FAIL';
- return;
- }
- $shipping_express_id = $express[0]['id'];
- 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);
- $remote_addr = $_SERVER['REMOTE_ADDR'];
- if(!empty($order_sn) && !empty($logistics_no))
- {
- if($status == 1)
- {
- //,'shipping_time' => )
- Model()->table('order_common')->where(array('order_sn' => $order_sn))->update(array('shipping_express_id' => $shipping_express_id));
- $ret = Model()->table('order')->where(array('order_sn' => $order_sn))->update(array('order_state' => ORDER_STATE_SEND,'shipping_code' => $logistics_no));
- if($ret) {
- echo 'SUCCESS';
- } else {
- echo 'AGAIN';
- }
- }
- else{
- echo 'SUCCESS';
- }
- }
- else
- {
- echo 'FAIL';
- }
- } catch (WxPayException $e){
- Log::record($e->errorMessage(),Log::ERR);
- echo 'AGAIN';
- }
|