Files
OMS/app/erpapi/lib/unionpay/response/logistics.php
2026-01-04 19:08:31 +08:00

65 lines
2.3 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
/**
* Copyright 2012-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.
*/
class erpapi_unionpay_response_logistics extends erpapi_hqepay_response_abstract {
#华强宝的物流状态和ERP物流状态映射关系
static public $state_status = array(
'15'=>'1',#已揽收
'18'=>'3',#已签收
);
/**
* @param $params array
* @return array (
* 'State' => 1, #物流状态
* 'LogisticCode' => '', #物流单号
* )
*/
protected function _formatParams($params) {
return $params;
}
public function push($params){
$sdf = $this->_formatParams($params);
$this->__apilog['title'] = '接受物流信息(物流单号:' . $sdf['waybillNo']. '';
$this->__apilog['original_bn'] = $sdf['waybillNo'];
$data = array(
'logi_status' => self::$state_status[$sdf['wlStatus']],
'logi_no' => $sdf['waybillNo'],
);
if ($data['logi_status'] == '1'){
$data['sign_time'] = strtotime($sdf['createTime']);
}
if ($data['logi_status'] == '2'){
$data['embrace_time'] = strtotime($sdf['createTime']);
}
$filter = array(
'process' => 'TRUE',
'pause' => 'FALSE',
'logi_no' => $data['logi_no'],
'status' => 'succ',
'logi_status|noequal' => $data['logi_status']
);
$deliveryData = app::get('ome')->model('delivery')->getList('delivery_id,is_cod', $filter, 0, 1);
if($deliveryData) {
$data['delivery_id'] = $deliveryData[0]['delivery_id'];
$data['is_cod'] = $deliveryData[0]['is_cod'];
}
return $data;
}
}