chore: 重写初始提交(清空历史,整理后全量提交)
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/*
|
||||
* @Author: YwxApp <ywx@ywxapp.cn>
|
||||
* @Date: 2026-08-10 15:28:26
|
||||
* @LastEditors: YwxApp <ywx@ywxapp.cn>
|
||||
* @LastEditTime: 2026-08-15 10:17:49
|
||||
* @Description:
|
||||
* @FilePath: \ywxapp_dev\addon\articles\model\ArticleComment.php
|
||||
* @CustomString: Copyright (c) 2026 YwxApp
|
||||
*/
|
||||
// +----------------------------------------------------------------------
|
||||
// | YwxApp [ WE CAN DO IT JUST THINK ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 文章评论模型
|
||||
// +----------------------------------------------------------------------
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace addon\articles\model;
|
||||
|
||||
use think\model\concern\SoftDelete;
|
||||
use ywxapp\model\BaseModel;
|
||||
|
||||
class ArticleComment extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
|
||||
protected $name = 'articles_comment';
|
||||
protected $deleteTime = 'delete_at';
|
||||
protected $defaultSoftDelete = 0;
|
||||
|
||||
protected $autoWriteTimestamp = true;
|
||||
protected $createTime = 'create_at';
|
||||
protected $updateTime = 'update_at';
|
||||
|
||||
protected $type = [
|
||||
'pid' => 'integer',
|
||||
'aid' => 'integer',
|
||||
'uid' => 'integer',
|
||||
'status' => 'integer',
|
||||
'like_count'=> 'integer',
|
||||
];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(\ywxapp\model\MemberUser::class, 'uid', 'uid')
|
||||
->bind(['nickname', 'avatar']);
|
||||
}
|
||||
|
||||
public static function getByArticle(int $aid, int $page = 1, int $size = 10)
|
||||
{
|
||||
return self::with(['user'])
|
||||
->where('delete_at', 0)
|
||||
->where('aid', $aid)
|
||||
->where('status', 1)
|
||||
->order('id', 'asc')
|
||||
->paginate(['list_rows' => $size, 'page' => $page]);
|
||||
}
|
||||
|
||||
public static function ensureSchema(): void
|
||||
{
|
||||
$prefix = self::currentPrefix();
|
||||
self::ensureTableFromInstall($prefix, 'articles_comment');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user