mirror of
https://gitee.com/ShopeX/OMS
synced 2026-03-30 13:05:34 +08:00
134 lines
3.7 KiB
PHP
134 lines
3.7 KiB
PHP
<?php
|
|
/**
|
|
* Copyright 2026 ShopeX (https://www.shopex.cn)
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
/**
|
|
* 订单催发货(店小蜜)
|
|
*
|
|
* @author wangbiao<wangbiao@shopex.cn>
|
|
* @version 0.1
|
|
*/
|
|
class erpapi_shop_response_delivergoods extends erpapi_shop_response_abstract
|
|
{
|
|
/**
|
|
* 接收参数
|
|
*/
|
|
|
|
public $_sdf = array();
|
|
|
|
/**
|
|
* 催发货
|
|
*
|
|
* @param array $params
|
|
* @return array
|
|
*/
|
|
public function urgent($params){
|
|
$tid = $params['tid'];
|
|
|
|
$this->__apilog['title'] = sprintf('催发货[%s]', $tid);
|
|
$this->__apilog['original_bn'] = $tid;
|
|
$this->__apilog['result']['data'] = array('tid' => $tid);
|
|
|
|
if (!$tid) {
|
|
$this->__apilog['result']['msg'] = '缺少订单号';
|
|
return false;
|
|
}
|
|
|
|
$shop_id = $this->__channelObj->channel['shop_id'];
|
|
|
|
//检查订单
|
|
$orderMdl = app::get('ome')->model('orders');
|
|
$order = $this->getOrder('order_id, order_bn, process_status, status, ship_status, order_bool_type, shop_id', $shop_id, $tid);
|
|
|
|
if (!$order) {
|
|
$this->__apilog['result']['msg'] = 'ERP不存在此单';
|
|
return false;
|
|
}
|
|
|
|
if($order['status'] == 'dead'){
|
|
$this->__apilog['result']['msg'] = '订单已作废';
|
|
return false;
|
|
}
|
|
|
|
if ($order['ship_status'] == '1') {
|
|
$this->__apilog['result']['msg'] = '订单已经发货';
|
|
return false;
|
|
}
|
|
|
|
$order['seller_name'] = $params['seller_name'];
|
|
$order['logistics_time'] = $params['logistics_time'];
|
|
return $order;
|
|
}
|
|
|
|
/**
|
|
* 获取数据
|
|
*
|
|
* @param array $params
|
|
* @return array:
|
|
*/
|
|
protected function _returnParams($params) {
|
|
return array();
|
|
}
|
|
|
|
/**
|
|
* 格式化参数
|
|
*
|
|
* @param array $params
|
|
* @return array:
|
|
*/
|
|
protected function _formatParams($params) {
|
|
$sdf = array('order_bn'=>$params['tid']);
|
|
|
|
return $sdf;
|
|
}
|
|
|
|
public function promise($params)
|
|
{
|
|
$tid = $params['orderId'];
|
|
|
|
$this->__apilog['title'] = sprintf('时效订单[%s]', $tid);
|
|
$this->__apilog['original_bn'] = $tid;
|
|
$this->__apilog['result']['data'] = array('tid' => $tid);
|
|
|
|
if (!$tid) {
|
|
$this->__apilog['result']['msg'] = '缺少订单号';
|
|
return false;
|
|
}
|
|
|
|
$shop_id = $this->__channelObj->channel['shop_id'];
|
|
|
|
//检查订单
|
|
$order = $this->getOrder('order_id, order_bn, process_status, status, ship_status, order_bool_type, shop_id', $shop_id, $tid);
|
|
|
|
if (!$order) {
|
|
$this->__apilog['result']['msg'] = 'ERP不存在此单';
|
|
return false;
|
|
}
|
|
$sdf = $this->_formatPromiseParams($params, $order);
|
|
return $sdf;
|
|
}
|
|
|
|
protected function _formatPromiseParams($params, $order)
|
|
{
|
|
$sdf = [
|
|
'pick_date' => $params['pickDate'],
|
|
'delivered_time' => $params['deliveredTime'],
|
|
'event_type' => $params['event_type'],
|
|
'order' => $order
|
|
];
|
|
return $sdf;
|
|
}
|
|
}
|