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