Commit ddb60cb1 by 杨树贤

备份数据

parent c82a7549
......@@ -3,6 +3,7 @@
namespace App\Console\Commands;
use App\Http\Services\DataService;
use App\Http\Services\DealImageService;
use App\Http\Services\StatisticsSkuUploadService;
use Illuminate\Console\Command;
use Illuminate\Foundation\Inspiring;
......@@ -31,9 +32,8 @@ class SetSupplierFollowUp extends Command
*/
public function handle()
{
$service = new DataService();
$service->exportSupplierDataForLevel();
//$uploadService = new StatisticsSkuUploadService();
//$uploadService->statisticBrandSkuNum();
//DealImageService::dealNewsImage();
DealImageService::dealCmsImage();
//DealImageService::dealSkuDetailAndImage();
}
}
......@@ -43,6 +43,7 @@ class DealImageService
public static function dealNewsImage()
{
$newsList = DB::connection('liexin')->table('article')->where('deal_status', '!=', 1)->orderBy('art_id', 'desc')->limit(100)->get();
$redis = new RedisModel();
foreach ($newsList as $news) {
$addon = DB::connection('liexin')->table('article_addon')->where('art_id', $news['art_id'])->first();
if (empty($addon)) {
......@@ -58,6 +59,9 @@ class DealImageService
if (empty($imageUrls)) {
continue;
}
if (!$redis->hget('image_news_backup_xian', $news['art_id'])) {
$redis->hset('image_news_backup_xian', $news['art_id'], $news['body']);
}
//dump($imageUrls); // 输出所有提取出的 'img.ichunt.com' 图片链接
$imageMap = self::downloadAndUploadToPicServer($imageUrls);
......@@ -75,7 +79,7 @@ class DealImageService
]);
dump($news['art_id']);
dump('处理文章id : ' . $news['art_id']);
}
}
......@@ -83,6 +87,7 @@ class DealImageService
//处理cms的图片链接
public static function dealCmsImage()
{
$redis = new RedisModel();
//先去找出所有带有图片的cms数据
$bcatIdList = DB::connection('mysql')->table('lie_base_cat')->where('bcat_name', 'like', "%爱智%")->pluck('bcat_id');
$baseList = DB::connection('mysql')->table('lie_base')->whereIn('bcat_id', $bcatIdList)->where('images', '!=', '')->limit(1000)->get();
......@@ -91,6 +96,9 @@ class DealImageService
if (empty($imageUrl)) {
continue;
}
if (!$redis->hget('image_cms_backup_xian', $base['base_id'])) {
$redis->hset('image_cms_backup_xian', $base['base_id'], $base['images']);
}
$imageMap = self::downloadAndUploadToPicServer([$imageUrl]);
//进行全局替换
foreach ($imageMap as $originImage => $newImage) {
......@@ -137,6 +145,9 @@ class DealImageService
if (empty($imageUrls)) {
continue;
}
if (!$redis->hget('image_sku_detail_backup_xian', $skuId)) {
$redis->hset('image_sku_detail_backup_xian', $skuId, $detail);
}
//dump($imageUrls); // 输出所有提取出的 'img.ichunt.com' 图片链接
$imageMap = self::downloadAndUploadToPicServer($imageUrls);
//进行全局替换
......@@ -162,6 +173,11 @@ class DealImageService
if (empty($imageUrl)) {
continue;
}
if (!$redis->hget('image_sku_detail_backup_xian', $skuId)) {
$redis->hset('image_goods_backup_xian', $skuId, $skuDBData['goods_images']);
}
$imageMap = self::downloadAndUploadToPicServer([$imageUrl]);
//进行全局替换
foreach ($imageMap as $originImage => $newImage) {
......@@ -187,13 +203,13 @@ class DealImageService
{
$host = request()->getHost();
if (strpos($host, 'ichunt.com') !== false) {
return 'https://icso.ichunt.com/search/es/searchSku';
return 'https://icso.ichunt.com';
} else {
return 'http://search.liexindev.net';
}
}
private static function searchIedgeSku($page = 1)
public static function searchIedgeSku($page = 1)
{
$url = self::getSearchDomain() . '/search/es/searchSku';
$map['p'] = $page;
......
......@@ -84,7 +84,7 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
});
Route::match(['get', 'post'], '/test', function () {
\App\Http\Services\DealImageService::dealSkuDetailAndImage();
\App\Http\Services\DealImageService::dealCmsImage();
//\App\Http\Services\SupplierAddressService::initUnitedAddress();
//\App\Http\Services\DataService::checkSupplierBandAccount();
//(new CompanyService())->checkSupplierCompanyAndAddress(11042);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment