Commit 29992d45 by 杨树贤

添加任务

parent 43ac922f
......@@ -33,7 +33,7 @@ class SetSupplierFollowUp extends Command
public function handle()
{
//DealImageService::dealNewsImage();
DealImageService::dealCmsImage();
DealImageService::dealNewsImage();
//DealImageService::dealSkuDetailAndImage();
}
}
......@@ -42,7 +42,7 @@ class DealImageService
//先去处理芯媒体的图片链接
public static function dealNewsImage()
{
$newsList = DB::connection('liexin')->table('article')->where('deal_status', '!=', 1)->orderBy('art_id', 'desc')->limit(100)->get();
$newsList = DB::connection('liexin')->table('article')->orderBy('art_id', 'desc')->limit(1000)->get();
$redis = new RedisModel();
foreach ($newsList as $news) {
$addon = DB::connection('liexin')->table('article_addon')->where('art_id', $news['art_id'])->first();
......@@ -74,9 +74,9 @@ class DealImageService
'body' => $news['body'],
]);
DB::connection('liexin')->table('article')->where('art_id', $news['art_id'])->update([
'deal_status' => 1,
]);
// DB::connection('liexin')->table('article')->where('art_id', $news['art_id'])->update([
// 'deal_status' => 1,
// ]);
dump('处理文章id : ' . $news['art_id']);
......@@ -91,6 +91,7 @@ class DealImageService
//先去找出所有带有图片的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();
foreach ($baseList as $base) {
$imageUrl = self::checkImage($base['images']);
if (empty($imageUrl)) {
......@@ -104,6 +105,7 @@ class DealImageService
foreach ($imageMap as $originImage => $newImage) {
$base['images'] = str_replace($originImage, $newImage, $base['images']);
}
dump($base['base_id']);
//回写到数据库
DB::connection('mysql')->table('lie_base')->where('base_id', $base['base_id'])->update([
'images' => $base['images']
......
......@@ -84,7 +84,7 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
});
Route::match(['get', 'post'], '/test', function () {
\App\Http\Services\DealImageService::dealCmsImage();
\App\Http\Services\DealImageService::dealNewsImage();
//\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