Files
sbnews/server/app/adminapi/validate/community/CommunityCommentValidate.php
T
2026-06-11 12:15:29 +08:00

39 lines
829 B
PHP

<?php
namespace app\adminapi\validate\community;
use app\common\validate\BaseValidate;
use app\common\model\community\CommunityComment;
class CommunityCommentValidate extends BaseValidate
{
protected $rule = [
'id' => 'require|checkComment',
'status' => 'require|in:0,1',
];
protected $message = [
'id.require' => '评论id不能为空',
'status.require' => '状态不能为空',
];
public function sceneDelete()
{
return $this->only(['id']);
}
public function sceneStatus()
{
return $this->only(['id', 'status']);
}
public function checkComment($value)
{
$comment = CommunityComment::findOrEmpty($value);
if ($comment->isEmpty()) {
return '评论不存在';
}
return true;
}
}