mirror of
https://gitee.com/ShopeX/OMS
synced 2026-03-23 02:45:33 +08:00
77 lines
2.6 KiB
PHP
77 lines
2.6 KiB
PHP
<?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.
|
|
*/
|
|
/**
|
|
* 门店接口通道类
|
|
*
|
|
* @author xiayuanjun@shopex.cn
|
|
* @version 0.1
|
|
*
|
|
*/
|
|
class erpapi_channel_store extends erpapi_channel_abstract
|
|
{
|
|
public $store;
|
|
|
|
/**
|
|
* 初始化
|
|
* @param mixed $node_id ID
|
|
* @param mixed $channel_id ID
|
|
* @return mixed 返回值
|
|
*/
|
|
|
|
public function init($node_id,$channel_id)
|
|
{
|
|
//获取server_id
|
|
$mdlO2oStore = app::get('o2o')->model('store');
|
|
$rs_store_info = $mdlO2oStore->dump(array("store_id"=>$channel_id),"server_id,store_bn,store_id");
|
|
//获取门店服务端配置信息
|
|
//
|
|
$filter = $rs_store_info['server_id'] ? array('server_id' => $rs_store_info['server_id']) : array('node_id' => $node_id);
|
|
$serverObj = app::get('o2o')->model('server');
|
|
$store = $serverObj->dump($filter);
|
|
|
|
if (!$store) {
|
|
return false;
|
|
}
|
|
$store['config'] = @unserialize($store['config']);
|
|
$store['store_bn'] = $rs_store_info['store_bn'];
|
|
$store['store_id'] = $rs_store_info['store_id'];
|
|
if($store['type'] == 'wap'){
|
|
$this->__adapter = '';
|
|
$this->__platform = 'wap';
|
|
}elseif($store['type'] == 'taobao'){
|
|
//根据线下服务端配置识别当前的路径
|
|
$this->__adapter = 'matrix';
|
|
$this->__platform = 'taobao';
|
|
|
|
//目前一套OMS只管控一家淘宝或天猫店铺 有且只有一条配置记录 获取node_id主店铺
|
|
$tbo2o_shop = kernel::single('tbo2o_common')->getTbo2oShopInfo();
|
|
$mdlOmeShop = app::get('ome')->model('shop');
|
|
$rs_ome_shop = $mdlOmeShop->dump(array("shop_id"=>$tbo2o_shop["shop_id"]),"node_id");
|
|
$store["node_id"] = $rs_ome_shop["node_id"];
|
|
}elseif ($store['type'] == 'openapi') {
|
|
|
|
|
|
$this->__adapter = 'openapi';
|
|
$this->__platform = $store['node_type'];
|
|
|
|
}
|
|
|
|
$this->store = $store;
|
|
|
|
return true;
|
|
}
|
|
} |