Commit ab387899 by 杨树贤

修复数据

parent 012e9ec9
......@@ -9,6 +9,7 @@ use App\Model\SupplierBlacklistModel;
use App\Model\SupplierChannelModel;
use http\Exception\InvalidArgumentException;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
//处理多个系统的图片替换问题
class DealImageService
......@@ -113,6 +114,24 @@ class DealImageService
}
}
public static function replaceCmsImage()
{
$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) {
if (strpos($base['images'], 'imgscdn.ichunt.com/show/big') !== false || strpos($base['images'], 'image.liexindev.net/show/big') !== false) {
$base['images'] = str_replace('big', 'origin', $base['images']);
//回写到数据库
DB::connection('mysql')->table('lie_base')->where('base_id', $base['base_id'])->update([
'images' => $base['images']
]);
}
dump($base['base_id']);
}
}
//处理新闻的缩略图
public static function dealNewsPic()
{
......
......@@ -84,7 +84,7 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
});
Route::match(['get', 'post'], '/test', function () {
\App\Http\Services\DealImageService::dealNewsPic();
\App\Http\Services\DealImageService::replaceCmsImage();
//\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