37 lines
726 B
PHP
37 lines
726 B
PHP
<?php
|
|
|
|
namespace app\adminapi\validate\article;
|
|
|
|
use app\common\model\article\ArticleAiCommentTask;
|
|
use app\common\validate\BaseValidate;
|
|
|
|
class ArticleAiCommentTaskValidate extends BaseValidate
|
|
{
|
|
protected $rule = [
|
|
'id' => 'require|checkTask',
|
|
];
|
|
|
|
protected $message = [
|
|
'id.require' => '任务id不能为空',
|
|
];
|
|
|
|
public function sceneDelete()
|
|
{
|
|
return $this->only(['id']);
|
|
}
|
|
|
|
public function sceneRetry()
|
|
{
|
|
return $this->only(['id']);
|
|
}
|
|
|
|
public function checkTask($value)
|
|
{
|
|
$task = ArticleAiCommentTask::findOrEmpty($value);
|
|
if ($task->isEmpty()) {
|
|
return '任务不存在';
|
|
}
|
|
return true;
|
|
}
|
|
}
|