Update (route)

This commit is contained in:
2023-11-21 21:24:40 +08:00
parent 27035c1a9b
commit 4827130183
6 changed files with 60 additions and 5 deletions

View File

@@ -4,6 +4,7 @@
use App\Jobs\ParseRssPostMetadataJob;
use App\Models\RssPost;
use App\Models\ServiceCostUsage;
use Exception;
use Illuminate\Support\Facades\Http;
use League\HTMLToMarkdown\HtmlConverter;
@@ -34,7 +35,16 @@ public static function handle(int $rss_post_id)
if ($response->successful()) {
$raw_html = $response->body();
$costs['unblocker'] = calculate_smartproxy_cost(round(strlen($raw_html) / 1024, 2), 'rotating_global');
$cost = calculate_smartproxy_cost(round(strlen($raw_html) / 1024, 2), 'rotating_global');
$service_cost_usage = new ServiceCostUsage;
$service_cost_usage->cost = $cost;
$service_cost_usage->name = 'smartproxy-CrawlRssPostTask';
$service_cost_usage->reference_1 = 'rss_post';
$service_cost_usage->reference_2 = strval($rss_post_id);
$service_cost_usage->output = null;
$service_cost_usage->save();
} else {
$raw_html = null;
$response->throw();