mirror of
https://gitee.com/ShopeX/OMS
synced 2026-04-28 03:35:32 +08:00
【新增】天猫超市商品下载同步
【修复】天猫超市发货问题 【修复】采购单单号因含特殊字符导致入库或取消失败 【修复】售后批量操作设置显示不正确
This commit is contained in:
@@ -313,6 +313,8 @@ define("SHOP_GET_ITEMS_ALL_RPC", 'store.items.all.get');
|
||||
define("SHOP_GET_ITEMS_LIST_RPC", 'store.items.list.get'); // 通过IID获取多个前端商品
|
||||
define("SHOP_GET_FENXIAO_PRODUCTS", 'store.fenxiao.products.get'); // 淘分销商品下载
|
||||
define("SHOP_GET_SUPPLIER_PRODUCTS", 'store.supplier.item.list.info.query'); // 供应商商品下载
|
||||
define("SHOP_SUPPLIER_PRODUCTS_FIND",'store.supplier.products.find'); // 供应商商品查询
|
||||
|
||||
define("SHOP_ITEM_GET",'store.item.get'); // 通过IID获取单个商品
|
||||
define("SHOP_ITEM_SKU_GET",'store.item.sku.get'); // 单拉商品SKU
|
||||
define("SHOP_ORDER_SETTLE_GET",'store.trade.settle.get'); //获取抖音订单明细
|
||||
|
||||
@@ -172,7 +172,7 @@ class erpapi_shop_matrix_tmall_request_maochao_delivery extends erpapi_shop_requ
|
||||
// 喵速达:取平台推送的store_code
|
||||
$store_code = $storeCodes[0];
|
||||
}else{
|
||||
$store_code = $sdf['branch']['branch_bn'];
|
||||
$store_code = $sdf['store_code'] ?: $sdf['branch']['branch_bn'];
|
||||
}
|
||||
|
||||
// params
|
||||
@@ -189,4 +189,4 @@ class erpapi_shop_matrix_tmall_request_maochao_delivery extends erpapi_shop_requ
|
||||
];
|
||||
return $params;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* @author ykm 2022/6/27 18:09:55
|
||||
* @describe 处理店铺商品相关类
|
||||
*/
|
||||
|
||||
class erpapi_shop_matrix_tmall_request_maochao_product extends erpapi_shop_request_product {
|
||||
|
||||
protected function getUpdateStockApi() {
|
||||
@@ -25,21 +26,40 @@ class erpapi_shop_matrix_tmall_request_maochao_product extends erpapi_shop_reque
|
||||
return $api_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* format_stocks
|
||||
* @param mixed $stockList stockList
|
||||
* @return mixed 返回值
|
||||
*/
|
||||
private function getStoreCode($branch_bn) {
|
||||
|
||||
public function format_stocks($stockList) {
|
||||
static $storeCode = [];
|
||||
if(isset($storeCode[$branch_bn])) {
|
||||
return $storeCode[$branch_bn];
|
||||
}
|
||||
|
||||
$branch = app::get('ome')->model('branch')->dump(array ('branch_bn'=>$branch_bn,'check_permission'=>'false'));
|
||||
if(empty($branch)) {
|
||||
return $branch_bn;
|
||||
}
|
||||
|
||||
$relation = app::get('ome')->model('branch_relation')->dump(array ('branch_id'=>$branch['branch_id'],'type' => '3pl'));
|
||||
if(empty($relation)) {
|
||||
return $branch_bn;
|
||||
}
|
||||
|
||||
$storeCode[$branch_bn] = $relation['relation_branch_bn'];
|
||||
|
||||
return $storeCode[$branch_bn];
|
||||
}
|
||||
|
||||
|
||||
public function _getUpdateStockParams($stockList) {
|
||||
$firstStock = current($stockList);
|
||||
$shop_id = $this->__channelObj->channel['shop_id'];
|
||||
|
||||
if(empty($firstStock['branch_bn'])) {
|
||||
$memo = '未使用分仓独立回写,不能回写';
|
||||
$optLogModel = app::get('inventorydepth')->model('operation_log');
|
||||
$optLogModel->write_log('shop', $shop_id, 'stockup',$memo);
|
||||
return false;
|
||||
// $memo = '未使用分仓独立回写,不能回写';
|
||||
// $optLogModel = app::get('inventorydepth')->model('operation_log');
|
||||
// $optLogModel->write_log('shop', $shop_id, 'stockup',$memo);
|
||||
return [];
|
||||
}
|
||||
|
||||
$bns = array();
|
||||
foreach ($stockList as $key => $val)
|
||||
{
|
||||
@@ -51,7 +71,7 @@ class erpapi_shop_matrix_tmall_request_maochao_product extends erpapi_shop_reque
|
||||
$skuObj = app::get('inventorydepth')->model('shop_skus');
|
||||
$tempList = $skuObj->getList('shop_sku_id,shop_product_bn,shop_iid', array('shop_id'=>$shop_id, 'shop_product_bn'=>$bns));
|
||||
if(empty($tempList)){
|
||||
return false;
|
||||
return [];
|
||||
}
|
||||
$shopBnList = [];
|
||||
foreach ($tempList as $key => $value) {
|
||||
@@ -79,21 +99,21 @@ class erpapi_shop_matrix_tmall_request_maochao_product extends erpapi_shop_reque
|
||||
"additional_info" => [
|
||||
"attribute" => [
|
||||
"inv_operate_mode" => "FULLAMOUNT",
|
||||
"supplier_id" => $val['shop_sku_id']
|
||||
"supplier_id" => $this->__channelObj->channel['config']['supplier_id'],
|
||||
]
|
||||
],
|
||||
"location"=> [
|
||||
"store_code"=> $value['branch_bn']
|
||||
"store_code"=> $this->getStoreCode($value['branch_bn'])
|
||||
],
|
||||
"detail_order"=> [
|
||||
"operation_detail_order_id"=> count($detail_operation_list)
|
||||
"operation_detail_order_id"=> time().rand(1000, 9999),
|
||||
]
|
||||
];
|
||||
$detail_operation_list[] = $tmp;
|
||||
}
|
||||
}
|
||||
if(empty($list_quantity)) {
|
||||
return false;
|
||||
return [];
|
||||
}
|
||||
$inventory_main_operation = [[
|
||||
'main_order'=>[
|
||||
@@ -110,16 +130,7 @@ class erpapi_shop_matrix_tmall_request_maochao_product extends erpapi_shop_reque
|
||||
return $return;
|
||||
}
|
||||
|
||||
protected function _getUpdateStockParams($stocks) {
|
||||
return $stocks;
|
||||
}
|
||||
|
||||
#实时下载店铺商品
|
||||
/**
|
||||
* skuAllGet
|
||||
* @param mixed $sdf sdf
|
||||
* @return mixed 返回值
|
||||
*/
|
||||
public function skuAllGet($sdf)
|
||||
{
|
||||
$timeout = 20;
|
||||
@@ -130,36 +141,86 @@ class erpapi_shop_matrix_tmall_request_maochao_product extends erpapi_shop_reque
|
||||
'end_time' => $sdf['end_time'],
|
||||
'supplier_id' => $sdf['supplier_id'],
|
||||
);
|
||||
|
||||
if ($sdf['scroll_id']) {
|
||||
$param['scroll_id'] = $sdf['scroll_id'];
|
||||
}
|
||||
|
||||
$title = "获取店铺(" . $this->__channelObj->channel['name'] .')商品';
|
||||
$result = $this->__caller->call(SHOP_GET_SUPPLIER_PRODUCTS,$param,array(),$title,$timeout, $param['supplier_id']);
|
||||
|
||||
$api_name = SHOP_GET_SUPPLIER_PRODUCTS;
|
||||
if (is_array($this->__channelObj->channel['config']) && in_array('MCZZ',(array) $this->__channelObj->channel['config']['sub_business_type'])) {
|
||||
$api_name = SHOP_SUPPLIER_PRODUCTS_FIND;
|
||||
}
|
||||
|
||||
$result = $this->__caller->call($api_name,$param,array(),$title,$timeout, $param['supplier_id']);
|
||||
if ($result['res_ltype'] > 0) {
|
||||
for ($i=0;$i<3;$i++) {
|
||||
$result = $this->__caller->call(SHOP_GET_SUPPLIER_PRODUCTS,$param,array(),$title,$timeout, $param['supplier_id']);
|
||||
$result = $this->__caller->call($api_name,$param,array(),$title,$timeout, $param['supplier_id']);
|
||||
if ($result['res_ltype'] == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if($result['data']) {
|
||||
$data = json_decode($result['data'], true);
|
||||
$result['data'] = [];
|
||||
if(empty($data['data']['data']['page_data']['page_data'])) {
|
||||
return $result;
|
||||
}
|
||||
foreach ($data['data']['data']['page_data']['page_data'] as $value) {
|
||||
$result['data'][] = [
|
||||
'iid' => $value['sc_item_id'],
|
||||
'title' => $value['sc_item_name'],
|
||||
'outer_id' => $value['outer_id'],
|
||||
'sku' => [
|
||||
'outer_id' => $value['outer_id'],
|
||||
'sku_id' => $value['supplier_id'],
|
||||
'barcode' => $value['barcode'],
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
$data = $result['data'] ? json_decode($result['data'], true) : [];
|
||||
|
||||
if ($api_name == SHOP_GET_SUPPLIER_PRODUCTS) {
|
||||
$result['data'] = $this->supplierProductsGetResponse($data);
|
||||
}
|
||||
|
||||
if ($api_name == SHOP_SUPPLIER_PRODUCTS_FIND) {
|
||||
$result['scroll_id'] = $data['data']['scroll_id'];
|
||||
$result['total_count'] = $data['data']['total_count'];
|
||||
|
||||
$result['data'] = $this->supplierProductsFindResponse($data);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
private function supplierProductsGetResponse($data) {
|
||||
|
||||
$formatData = [];
|
||||
if(!$data || empty($data['data']['data']['page_data']['page_data'])) {
|
||||
return $formatData;
|
||||
}
|
||||
foreach ($data['data']['data']['page_data']['page_data'] as $value) {
|
||||
$formatData[] = [
|
||||
'iid' => $value['sc_item_id'],
|
||||
'title' => $value['sc_item_name'],
|
||||
'outer_id' => $value['outer_id'],
|
||||
'sku' => [
|
||||
'outer_id' => $value['outer_id'],
|
||||
'sku_id' => $value['supplier_id'],
|
||||
'barcode' => $value['barcode'],
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
return $formatData;
|
||||
}
|
||||
|
||||
private function supplierProductsFindResponse($data) {
|
||||
$formatData = [];
|
||||
|
||||
if(!$data || empty($data['data']['data'])) {
|
||||
return $formatData;
|
||||
}
|
||||
|
||||
foreach ($data['data']['data']['supply_product_info_response'] as $value) {
|
||||
$formatData[] = [
|
||||
'iid' => $value['supplier_product_id'],
|
||||
'title' => $value['supplier_product_name'],
|
||||
'outer_id' => $value['outer_id'],
|
||||
'sku' => [
|
||||
'outer_id' => $value['outer_id'],
|
||||
'sku_id' => $value['supplier_product_id'],
|
||||
'barcode' => $value['barcode'],
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
return $formatData;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,39 @@ class erpapi_shop_response_bookingrefund extends erpapi_shop_response_abstract {
|
||||
'oid_list' => $params['oid_list'],
|
||||
'refundStatus' => $params['refundStatus'] ? : 1,
|
||||
'shop_id' => $this->__channelObj->channel['shop_id'],
|
||||
'sub_business_type' => [],
|
||||
];
|
||||
|
||||
if ( is_array($this->__channelObj->channel['config']) && $this->__channelObj->channel['config']['sub_business_type'] ) {
|
||||
$sdf['sub_business_type'] = (array) $this->__channelObj->channel['config']['sub_business_type'];
|
||||
}
|
||||
|
||||
return $sdf;
|
||||
}
|
||||
|
||||
public function fxordermsg($params){
|
||||
// shopbee供销供应商订单信息同步
|
||||
$this->__apilog['title'] = '供销供应商订单信息同步';
|
||||
$this->__apilog['original_bn'] = $params['bizOrderCode'];
|
||||
if (empty($params['bizOrderCode'])) {
|
||||
return array('rsp' => 'fail', 'msg' => '业务单号不能为空');
|
||||
}
|
||||
$sdf = [
|
||||
'order_bn' => $params['bizOrderCode'],
|
||||
'shop_id' => $this->__channelObj->channel['shop_id'],
|
||||
'supplierName' => $params['supplierName'],
|
||||
'buyerComments' => $params['buyerComments'],
|
||||
'supplierId' => $params['supplierId'],
|
||||
'sellerId' => $params['sellerId'],
|
||||
'bizType' => $params['bizType'],
|
||||
'outBizCode' => $params['outBizCode'],
|
||||
'extraContent' => $params['extraContent'],
|
||||
'sellerComments' => $params['sellerComments'],
|
||||
'sellerName' => $params['sellerName'],
|
||||
'bizOrderCode' => $params['bizOrderCode'],
|
||||
'deliverRequirement' => $params['deliverRequirement'],
|
||||
'appointArrivedTime' => $params['appointArrivedTime'],
|
||||
'appointDeliveryTime' => $params['appointDeliveryTime'],
|
||||
];
|
||||
return $sdf;
|
||||
}
|
||||
|
||||
@@ -79,6 +79,12 @@ class erpapi_shop_response_process_bookingrefund{
|
||||
}else{ //异步asynchronous
|
||||
$orderInfo['pause_status'] = $pause_status;
|
||||
$ret = $this->ordermsg_back($orderInfo, $params);
|
||||
|
||||
// 如果是猫超主站退款回告成功,直接退款
|
||||
if ($ret['rsp'] == 'succ' && in_array('MCZZ', (array) $params['sub_business_type'])) {
|
||||
$this->_dealRefund($orderInfo);
|
||||
}
|
||||
|
||||
return array('rsp'=>'succ', 'msg' => $ret);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -393,6 +393,7 @@ class erpapi_shop_whitelist {
|
||||
SHOP_RESHIPPING_CONSIGNGOODS, //补寄发货
|
||||
SHOP_RESHIPPING_REFUSEREASON_GET, //查询拒绝原因列表
|
||||
STORE_VIRTUAL_NUMBER_GROUP_UPDATE,
|
||||
SHOP_SUPPLIER_PRODUCTS_FIND, //供应商商品查询
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user