|
|
|
@ -16,6 +16,7 @@ use app\common\model\Store; |
|
|
|
|
use app\common\model\Agreement; |
|
|
|
|
use app\common\model\UploadFile; |
|
|
|
|
use app\common\model\Banner; |
|
|
|
|
use app\common\model\Express; |
|
|
|
|
use app\store\model\server\RecoveryCategory; |
|
|
|
|
use app\store\model\server\ServerRecovery; |
|
|
|
|
use app\store\model\server\Server; |
|
|
|
@ -25,7 +26,7 @@ use app\store\model\Setting; |
|
|
|
|
// /www/server/php/74/bin/php /server/wwwroot/yanzong/think test |
|
|
|
|
class SyncStoreBasicData extends Command |
|
|
|
|
{ |
|
|
|
|
const DEFAULT_STORE_ID = 10048; |
|
|
|
|
const DEFAULT_STORE_ID = 10045; |
|
|
|
|
|
|
|
|
|
protected function configure() |
|
|
|
|
{ |
|
|
|
@ -39,10 +40,12 @@ class SyncStoreBasicData extends Command |
|
|
|
|
$this->addArgument("isSyncServerData"); |
|
|
|
|
$this->addArgument("isSyncBannerData"); |
|
|
|
|
$this->addArgument("isSyncStoreSettingData"); |
|
|
|
|
$this->addArgument("isSyncStoreExpressData"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected function execute(Input $input, Output $output) |
|
|
|
|
{ |
|
|
|
|
exit(); |
|
|
|
|
$store_id = $input->getArgument("store_id"); |
|
|
|
|
$isSyncMaintenanceData = $input->getArgument("isSyncMaintenanceData"); |
|
|
|
|
$isSyncHelpData = $input->getArgument("isSyncHelpData"); |
|
|
|
@ -51,6 +54,7 @@ class SyncStoreBasicData extends Command |
|
|
|
|
$isSyncServerData = $input->getArgument("isSyncServerData"); |
|
|
|
|
$isSyncBannerData = $input->getArgument("isSyncBannerData"); |
|
|
|
|
$isSyncStoreSettingData = $input->getArgument("isSyncStoreSettingData"); |
|
|
|
|
$isSyncStoreExpressData = $input->getArgument("isSyncStoreExpressData"); |
|
|
|
|
|
|
|
|
|
$where[] = ['is_sync','=', 0]; |
|
|
|
|
$where[] = ['is_delete','=', 0]; |
|
|
|
@ -92,10 +96,46 @@ class SyncStoreBasicData extends Command |
|
|
|
|
if ($isSyncStoreSettingData) { |
|
|
|
|
$this->syncStoreSettingData($store); |
|
|
|
|
} |
|
|
|
|
if ($isSyncStoreExpressData) { |
|
|
|
|
$this->syncStoreExpressData($store); |
|
|
|
|
} |
|
|
|
|
Store::where('store_id', $store['store_id'])->update(['is_sync' => 1]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 同步物流公司 |
|
|
|
|
* [syncStoreExpressData description] |
|
|
|
|
* @param [type] $store [description] |
|
|
|
|
* @return [type] [description] |
|
|
|
|
*/ |
|
|
|
|
private function syncStoreExpressData($store){ |
|
|
|
|
//维修分类数据同步 |
|
|
|
|
$expressList = Express::where('store_id',self::DEFAULT_STORE_ID)->select()->toArray(); |
|
|
|
|
if ($expressList) { |
|
|
|
|
foreach ($expressList as &$express) { |
|
|
|
|
$info = Express::where('store_id', $store['store_id'])->where('original_id', $express['express_id'])->find(); |
|
|
|
|
if ($info) { |
|
|
|
|
echo $express['express_id']."物流公司已存在".PHP_EOL; |
|
|
|
|
$ret = Express::where('store_id', $store['store_id'])->where('original_id', $express['express_id'])->update([ |
|
|
|
|
'express_name' => $express['express_name'], |
|
|
|
|
'kuaidi100_code' => $express['kuaidi100_code'], |
|
|
|
|
'kdniao_code' => $express['kdniao_code'], |
|
|
|
|
]); |
|
|
|
|
var_dump($ret); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
$express['create_time'] = time(); |
|
|
|
|
$express['update_time'] = time(); |
|
|
|
|
$express['original_id'] = $express['express_id']; |
|
|
|
|
$express['store_id'] = $store['store_id']; |
|
|
|
|
unset($express['express_id']); |
|
|
|
|
$ret = Express::create($express); |
|
|
|
|
var_dump($ret->express_id); |
|
|
|
|
} |
|
|
|
|
unset($express); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 同步基本信息,七牛云、快递100、99api的配置 |
|
|
|
|