将仓库id写入配置文件
This commit is contained in:
parent
4feb989020
commit
6bb3acd2bd
|
@ -11,6 +11,7 @@ return [
|
|||
'sign_method' => 'md5',
|
||||
'warehouse_code' => env('WMS_WAREHOUSE_CODE','test0912'),
|
||||
'shipper_code' => env('WMS_SHIPPER_CODE','BJPD'),
|
||||
'warehouse_id' => env('WMS_WAREHOUSE_ID', 1),
|
||||
],
|
||||
'gwall' => [
|
||||
'base_uri' => env('GWALL_HOST', 'http://s.gwall.cn:8092/GwallServices3.0/WMSService?'),
|
||||
|
@ -21,5 +22,6 @@ return [
|
|||
'encrypt' => 1,
|
||||
'warehouse_code' => env('GWALL_WAREHOUSE_CODE', 'test2306'),
|
||||
'shipper_code' => env('GWALL_SHIPPER_CODE', 'BJPD'),
|
||||
'warehouse_id' => env('GWALL_WAREHOUSE_ID', 2),
|
||||
],
|
||||
];
|
||||
|
|
|
@ -8,7 +8,7 @@ class GwallWms extends BaseWms implements WmsInterface
|
|||
{
|
||||
protected $config = [];
|
||||
|
||||
public function __construct()
|
||||
public function __construct($config = null)
|
||||
{
|
||||
$wmsConf = $config ?? (require(dirname(dirname(__FILE__)) . '/config/wms.php'))['gwall'];
|
||||
$this->config = $wmsConf;
|
||||
|
|
|
@ -8,13 +8,14 @@ class WmsStrategy
|
|||
|
||||
public function __construct($warehouseId)
|
||||
{
|
||||
$config = require(dirname(dirname(__FILE__)) . '/config/wms.php');
|
||||
switch ($warehouseId)
|
||||
{
|
||||
case 1:
|
||||
$this->wmsClient = new XinyiWms();
|
||||
case $config['xinyi']['warehouse_id']:
|
||||
$this->wmsClient = new XinyiWms($config['xinyi']);
|
||||
break;
|
||||
case 2:
|
||||
$this->wmsClient = new GwallWms();
|
||||
case $config['gwall']['warehouse_id']:
|
||||
$this->wmsClient = new GwallWms($config['gwall']);
|
||||
break;
|
||||
default:
|
||||
throw new \Exception('仓库不存在');
|
||||
|
|
Loading…
Reference in New Issue
Block a user