同步基础shuju

es
lqmac 8 months ago
parent cfd24f9988
commit 0688df2ff7
  1. 61
      app/command/SyncStoreBasicData.php

@ -20,6 +20,7 @@ use app\store\model\server\RecoveryCategory;
use app\store\model\server\ServerRecovery;
use app\store\model\server\Server;
use app\store\model\ServerCategory;
use app\store\model\Setting;
// /www/server/php/74/bin/php /server/wwwroot/yanzong/think test
class SyncStoreBasicData extends Command
@ -37,6 +38,7 @@ class SyncStoreBasicData extends Command
$this->addArgument("isSyncRecoveryData");
$this->addArgument("isSyncServerData");
$this->addArgument("isSyncBannerData");
$this->addArgument("isSyncStoreSettingData");
}
protected function execute(Input $input, Output $output)
@ -48,6 +50,7 @@ class SyncStoreBasicData extends Command
$isSyncRecoveryData = $input->getArgument("isSyncRecoveryData");
$isSyncServerData = $input->getArgument("isSyncServerData");
$isSyncBannerData = $input->getArgument("isSyncBannerData");
$isSyncStoreSettingData = $input->getArgument("isSyncStoreSettingData");
$where[] = ['is_sync','=', 0];
$where[] = ['is_delete','=', 0];
@ -86,10 +89,68 @@ class SyncStoreBasicData extends Command
if ($isSyncBannerData) {
$this->syncBannerData($store);
}
if ($isSyncStoreSettingData) {
$this->syncStoreSettingData($store);
}
Store::where('store_id', $store['store_id'])->update(['is_sync' => 1]);
}
}
/**
* 同步基本信息,七牛云、快递100、99api的配置
* [syncSettingData description]
* @param [type] $store [description]
* @return [type] [description]
*/
private function syncStoreSettingData($store){
//99api配置
$collector = Setting::where('key','collector')->where('store_id', $store['store_id'])->find();
if (!$collector) {
$collectorData = [
"key" => "collector",
"describe" => "商品采集设置",
"values" => json_decode('{"config":{"99api":{"apiKey":"9271DA7BF37C6F50BED49B7F0ADD49A2"}}}', true),
"store_id" => $store['store_id'],
"create_time" => time(),
"update_time" => time(),
];
$ret = Setting::create($collectorData);
echo "99api配置新增成功";
var_dump($ret->key);
}
//配送设置
$delivery = Setting::where('key','delivery')->where('store_id', $store['store_id'])->find();
if (!$delivery) {
$deliveryData = [
"key" => "delivery",
"describe" => "配送设置",
"values" => json_decode('{"traces":{"enable":1,"default":"kd100","providerConfig":{"kd100":{"customer":"F6CAEF5CEA6B5BF219149B9B42BECAA1","key":"pjVBLUai1633"},"aliyun":{"appCode":""}}},"delivery_type":[10,20,30]}', true),
"store_id" => $store['store_id'],
"create_time" => time(),
"update_time" => time(),
];
$ret = Setting::create($deliveryData);
echo "配送设置新增成功";
var_dump($ret->key);
}
//上传设置
$storage = Setting::where('key','storage')->where('store_id', $store['store_id'])->find();
if (!$storage) {
$storageData = [
"key" => "storage",
"describe" => "上传设置",
"values" => json_decode('{"default":"qiniu","engine":{"qiniu":{"bucket":"saasyovo","access_key":"ehSHgkSkS9lGex8n0-vMf1-wkbgi56yv6fhEwsYS","secret_key":"jNXsuPmTnmfiRlNs-JoAmT833o0qusgXrXqeR3VK","domain":"https:\/\/qiniu.shop.royaum.com.cn"},"aliyun":{"bucket":"","access_key_id":"","access_key_secret":"","domain":"http:\/\/"},"qcloud":{"bucket":"","region":"","secret_id":"","secret_key":"","domain":"http:\/\/"}}}', true),
"store_id" => $store['store_id'],
"create_time" => time(),
"update_time" => time(),
];
$ret = Setting::create($storageData);
echo "上传设置新增成功";
var_dump($ret->key);
}
}
/**
* 同步富文本数据

Loading…
Cancel
Save