mirror of
https://gitee.com/ShopeX/OMS
synced 2026-04-05 22:55:32 +08:00
96 lines
2.9 KiB
PHP
96 lines
2.9 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.
|
|
*/
|
|
/**
|
|
* CONFIG
|
|
*
|
|
* @category
|
|
* @package
|
|
* @author yaokangming<yaokangming@shopex.cn>
|
|
* @version $Id: Z
|
|
*/
|
|
class erpapi_wms_openapi_sku360_config extends erpapi_wms_openapi_config
|
|
{
|
|
public $datetime;
|
|
private $_method_mapping = array(
|
|
WMS_ITEM_ADD => 'pushProduct',
|
|
WMS_ITEM_UPDATE => 'pushProduct',
|
|
WMS_INORDER_CREATE => 'pushPurchase',
|
|
WMS_INORDER_CANCEL => 'cancelPurchase',
|
|
WMS_OUTORDER_CREATE => 'pushB2B',
|
|
WMS_OUTORDER_CANCEL => 'cancelOrder',
|
|
WMS_SALEORDER_CREATE => 'pushOrder',
|
|
WMS_SALEORDER_CANCEL => 'cancelOrder',
|
|
WMS_RETURNORDER_CREATE => 'pushBackOrder',
|
|
WMS_RETURNORDER_CANCEL => 'cancelPurchase',
|
|
WMS_TRANSFERORDER_CREATE => '',
|
|
);
|
|
|
|
/**
|
|
* __construct
|
|
* @return mixed 返回值
|
|
*/
|
|
|
|
public function __construct(){
|
|
$this->datetime = $_POST['timestamp'] ? date('Y-m-d H:i:s', $_POST['timestamp']) : date('Y-m-d H:i:s');
|
|
}
|
|
/**
|
|
* 定义应用参数
|
|
*
|
|
* @return void
|
|
* @author
|
|
* */
|
|
public function define_query_params(){
|
|
$params = array(
|
|
'label'=>'sku360',
|
|
'desc'=>'desc',
|
|
'params' => array(
|
|
'appkey' =>'appkey',
|
|
'owner' => 'owner'
|
|
),
|
|
);
|
|
return $params;
|
|
}
|
|
|
|
public function get_query_params($method, $params){
|
|
$query_params = array(
|
|
'method' => $this->_method_mapping[$method],
|
|
'datetime' => $this->datetime,
|
|
);
|
|
|
|
return $query_params;
|
|
}
|
|
|
|
public function gen_sign($params){
|
|
$owner = $this->__channelObj->wms['adapter']['config']['owner'];
|
|
$appkey = $this->__channelObj->wms['adapter']['config']['appkey'];
|
|
$datetime = $this->datetime;
|
|
return strtoupper(md5($owner . $appkey . $datetime));
|
|
}
|
|
|
|
/**
|
|
* 获取_url
|
|
* @param mixed $method method
|
|
* @param mixed $params 参数
|
|
* @param mixed $realtime realtime
|
|
* @return mixed 返回结果
|
|
*/
|
|
public function get_url($method, $params, $realtime){
|
|
$url = $this->__channelObj->wms['adapter']['config']['api_url'];
|
|
$owner = $this->__channelObj->wms['adapter']['config']['owner'];
|
|
return $url . '?owner=' . $owner;
|
|
}
|
|
} |