refactor: 文章评论相关接口修改

This commit is contained in:
2025-02-13 15:29:34 +08:00
parent 1724bf8afb
commit d3594feabd
3 changed files with 3 additions and 11 deletions

View File

@@ -56,7 +56,7 @@ class ArticleLeaveMessage
$id = request()->param('id'); $id = request()->param('id');
// 审核/反审核 // 审核/反审核
$message = ArticleLeaveMessageModel::id($id)->find(); $message = ArticleLeaveMessageModel::bypk($id)->find();
if (is_null($message)) { if (is_null($message)) {
return error('请确认操作对象'); return error('请确认操作对象');
} }
@@ -75,7 +75,7 @@ class ArticleLeaveMessage
$id = request()->param('id'); $id = request()->param('id');
// 删除 // 删除
$message = ArticleLeaveMessageModel::id($id)->find(); $message = ArticleLeaveMessageModel::bypk($id)->find();
if (is_null($message)) { if (is_null($message)) {
return error('请确认操作对象'); return error('请确认操作对象');
} }

View File

@@ -22,12 +22,6 @@ class ArticleLeaveMessageModel extends ArticleLeaveMessageBaseModel
return $this->belongsTo(ArticleModel::class, 'article_id', 'id'); return $this->belongsTo(ArticleModel::class, 'article_id', 'id');
} }
// 根据id查询
public function scopeId($query, $value)
{
$query->where('id', '=', $value);
}
// 审核状态查询 // 审核状态查询
public function scopeIsAudited($query, $is_audited) public function scopeIsAudited($query, $is_audited)
{ {

View File

@@ -3,12 +3,10 @@ declare (strict_types = 1);
namespace app\common\model; namespace app\common\model;
use think\Model;
/** /**
* @mixin \think\Model * @mixin \think\Model
*/ */
class ArticleLeaveMessageBaseModel extends Model class ArticleLeaveMessageBaseModel extends BaseModel
{ {
// 表名 // 表名
protected $name = 'article_leave_message'; protected $name = 'article_leave_message';