Files
OMS/app/logisticsmanager/lib/waybill/yto4gj.php
2026-01-04 19:08:31 +08:00

63 lines
2.4 KiB
PHP
Raw 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 logisticsmanager_waybill_yto4gj {
public function logistics($logistics_code='', $channel=array()) {
if(!$channel) {
return !empty($logistics_code) ? '' : array();
}
$channel_id = $channel['channel_id'];
static $logistics = array();
if(!$logistics[$channel_id]) {
$rs = kernel::single('erpapi_router_request')->set('logistics', $channel_id)->electron_getLogistics(array());
if($rs['rsp'] == 'fail' || empty($rs['data'])) {
} else {
if($rs['data']['productKinds']) {
foreach ($rs['data']['productKinds'] as $key => $value) {
$logistics[$channel_id][$value['productCode']] = array('code'=>$value['productCode'], 'name'=>$value['productCnname']);
}
}
}
}
if (!empty($logistics_code)) {
return $logistics[$channel_id][$logistics_code];
}
return $logistics[$channel_id];
}
/**
* service_code
* @param mixed $param param
* @return mixed 返回值
*/
public function service_code($param) {
return array(); //没有场景不清楚下单时额外服务的value怎么传先不做
$sdf = array('cp_code'=>$param['logistics']);
$rs = kernel::single('erpapi_router_request')->set('logistics', $param['channel_id'])->electron_getServiceCode($sdf);
if($rs['rsp'] == 'fail' || empty($rs['data'])) {
return array();
}
$service = array();
if($rs['data']['extraServices']) {
$service = $this->__getServiceCode($rs['data']['extraServices']);
}
return $service;
}
private function __getServiceCode($data) {}
}