<?php

namespace App\FormModel\spider;
use App\Helpers\AppHelper;
use App\Model\AppArticle;
use App\Model\AppSpiderArticle;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Contract\RequestInterface;

class ReviewModel
{
    #[Inject]
    private readonly RequestInterface $_request;

    public function pass($spiderArticleId)
    {
        $query = AppSpiderArticle::find($spiderArticleId);
        $model = new AppArticle();
        $model->title = $query->title;
        $model->aid = AppHelper::generateAid();
        $model->cover = $query->cover;
        $model->images = $query->images;
        $model->year = $query->year;
        $model->module = $query->module;
        $model->brand = $query->brand;
        $model->spider_article_id = $spiderArticleId;
        $model->save();

        $query->deleted_at = time();
        $query->save();
    }
}