|
|
@ -23,7 +23,7 @@ use app\store\model\ServerCategory; |
|
|
|
// /www/server/php/74/bin/php /server/wwwroot/yanzong/think test |
|
|
|
// /www/server/php/74/bin/php /server/wwwroot/yanzong/think test |
|
|
|
class SyncStoreBasicData extends Command |
|
|
|
class SyncStoreBasicData extends Command |
|
|
|
{ |
|
|
|
{ |
|
|
|
const DEFAULT_STORE_ID = 10048; |
|
|
|
const DEFAULT_STORE_ID = 10037; |
|
|
|
|
|
|
|
|
|
|
|
protected function configure() |
|
|
|
protected function configure() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -43,6 +43,8 @@ class SyncStoreBasicData extends Command |
|
|
|
$isSyncMaintenanceData = $input->getArgument("isSyncMaintenanceData"); |
|
|
|
$isSyncMaintenanceData = $input->getArgument("isSyncMaintenanceData"); |
|
|
|
$isSyncHelpData = $input->getArgument("isSyncHelpData"); |
|
|
|
$isSyncHelpData = $input->getArgument("isSyncHelpData"); |
|
|
|
$isSyncRichTextData = $input->getArgument("isSyncRichTextData"); |
|
|
|
$isSyncRichTextData = $input->getArgument("isSyncRichTextData"); |
|
|
|
|
|
|
|
$isSyncRecoveryData = $input->getArgument("isSyncRecoveryData"); |
|
|
|
|
|
|
|
$isSyncServerData = $input->getArgument("isSyncServerData"); |
|
|
|
|
|
|
|
|
|
|
|
$where[] = ['is_sync','=', 0]; |
|
|
|
$where[] = ['is_sync','=', 0]; |
|
|
|
$where[] = ['is_delete','=', 0]; |
|
|
|
$where[] = ['is_delete','=', 0]; |
|
|
@ -72,7 +74,13 @@ class SyncStoreBasicData extends Command |
|
|
|
if ($isSyncRichTextData) { |
|
|
|
if ($isSyncRichTextData) { |
|
|
|
$this->syncRichTextData($store); |
|
|
|
$this->syncRichTextData($store); |
|
|
|
} |
|
|
|
} |
|
|
|
Store::where('store_id', $store['store_id'])->update(['is_sync' => 1]); |
|
|
|
if ($isSyncRecoveryData) { |
|
|
|
|
|
|
|
$this->syncRecoveryData($store); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if ($isSyncServerData) { |
|
|
|
|
|
|
|
$this->syncServerData($store); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//Store::where('store_id', $store['store_id'])->update(['is_sync' => 1]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -289,13 +297,13 @@ class SyncStoreBasicData extends Command |
|
|
|
//写入维修数据 |
|
|
|
//写入维修数据 |
|
|
|
$articleCategory['image_id'] = $image_id ?? 0; |
|
|
|
$articleCategory['image_id'] = $image_id ?? 0; |
|
|
|
$ret = RecoveryCategory::create($articleCategory); |
|
|
|
$ret = RecoveryCategory::create($articleCategory); |
|
|
|
var_dump($ret->id); |
|
|
|
var_dump($ret->category_id); |
|
|
|
} |
|
|
|
} |
|
|
|
unset($articleCategory); |
|
|
|
unset($articleCategory); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//维修数据同步 |
|
|
|
//维修数据同步 |
|
|
|
$articleList = ServerRecovery::where('store_id',self::DEFAULT_STORE_ID)->where('is_delete', 0)->where('status', 1)->select()->toArray(); |
|
|
|
$articleList = ServerRecovery::where('store_id',self::DEFAULT_STORE_ID)->where('status', 1)->select()->toArray(); |
|
|
|
if ($articleList) { |
|
|
|
if ($articleList) { |
|
|
|
foreach ($articleList as &$article) { |
|
|
|
foreach ($articleList as &$article) { |
|
|
|
$info = ServerRecovery::where('store_id', $store['store_id'])->where('original_id', $article['recovery_id'])->find(); |
|
|
|
$info = ServerRecovery::where('store_id', $store['store_id'])->where('original_id', $article['recovery_id'])->find(); |
|
|
@ -326,7 +334,7 @@ class SyncStoreBasicData extends Command |
|
|
|
$article['image_id'] = $image_id; |
|
|
|
$article['image_id'] = $image_id; |
|
|
|
$ret = ServerRecovery::create($article); |
|
|
|
$ret = ServerRecovery::create($article); |
|
|
|
//写入图片id |
|
|
|
//写入图片id |
|
|
|
var_dump($ret->id); |
|
|
|
var_dump($ret->recovery_id); |
|
|
|
} |
|
|
|
} |
|
|
|
unset($article); |
|
|
|
unset($article); |
|
|
|
} |
|
|
|
} |
|
|
@ -339,7 +347,7 @@ class SyncStoreBasicData extends Command |
|
|
|
* @return [type] [description] |
|
|
|
* @return [type] [description] |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private function syncServerData($store){ |
|
|
|
private function syncServerData($store){ |
|
|
|
//维修分类数据同步 |
|
|
|
//服务分类数据同步 |
|
|
|
$articleCategoryList = ServerCategory::where('store_id',self::DEFAULT_STORE_ID)->where('status', 1)->select()->toArray(); |
|
|
|
$articleCategoryList = ServerCategory::where('store_id',self::DEFAULT_STORE_ID)->where('status', 1)->select()->toArray(); |
|
|
|
if ($articleCategoryList) { |
|
|
|
if ($articleCategoryList) { |
|
|
|
foreach ($articleCategoryList as &$articleCategory) { |
|
|
|
foreach ($articleCategoryList as &$articleCategory) { |
|
|
@ -365,13 +373,13 @@ class SyncStoreBasicData extends Command |
|
|
|
//写入维修数据 |
|
|
|
//写入维修数据 |
|
|
|
$articleCategory['image_id'] = $image_id ?? 0; |
|
|
|
$articleCategory['image_id'] = $image_id ?? 0; |
|
|
|
$ret = ServerCategory::create($articleCategory); |
|
|
|
$ret = ServerCategory::create($articleCategory); |
|
|
|
var_dump($ret->id); |
|
|
|
var_dump($ret->category_id); |
|
|
|
} |
|
|
|
} |
|
|
|
unset($articleCategory); |
|
|
|
unset($articleCategory); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//维修数据同步 |
|
|
|
//服务数据同步 |
|
|
|
$articleList = Server::where('store_id',self::DEFAULT_STORE_ID)->where('is_delete', 0)->where('status', 1)->select()->toArray(); |
|
|
|
$articleList = Server::where('store_id',self::DEFAULT_STORE_ID)->where('status', 1)->select()->toArray(); |
|
|
|
if ($articleList) { |
|
|
|
if ($articleList) { |
|
|
|
foreach ($articleList as &$article) { |
|
|
|
foreach ($articleList as &$article) { |
|
|
|
$info = Server::where('store_id', $store['store_id'])->where('original_id', $article['server_id'])->find(); |
|
|
|
$info = Server::where('store_id', $store['store_id'])->where('original_id', $article['server_id'])->find(); |
|
|
@ -402,7 +410,7 @@ class SyncStoreBasicData extends Command |
|
|
|
$article['image_id'] = $image_id; |
|
|
|
$article['image_id'] = $image_id; |
|
|
|
$ret = Server::create($article); |
|
|
|
$ret = Server::create($article); |
|
|
|
//写入图片id |
|
|
|
//写入图片id |
|
|
|
var_dump($ret->id); |
|
|
|
var_dump($ret->server_id); |
|
|
|
} |
|
|
|
} |
|
|
|
unset($article); |
|
|
|
unset($article); |
|
|
|
} |
|
|
|
} |
|
|
|