52 lines
1.3 KiB
PHP
52 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace app\repository;
|
|
use app\model\Comment as CommentModel;
|
|
use app\service\Repository;
|
|
use think\Model;
|
|
|
|
/**
|
|
* 评论相关
|
|
*
|
|
* Class CommentRepository
|
|
* @package app\repository
|
|
* @method self getInstance(Model $model = null) static
|
|
*/
|
|
class CommentRepository extends Repository
|
|
{
|
|
/**
|
|
* 评论列表
|
|
* @param array $whereMap
|
|
* @param array $field
|
|
* @param int $page
|
|
* @param int $size
|
|
* @param array $order
|
|
*/
|
|
public function myCommentZone($page = 1, $size = 10)
|
|
{
|
|
$whereMap = [
|
|
["a.is_delete", "=", CommentModel::COMMON_OFF],//未删除
|
|
["a.state", "=", CommentModel::COMMON_ON],//审核通过
|
|
];
|
|
return CommentModel::alias("a")
|
|
->join("account b" ,"a.user_code = b.user_code")
|
|
->where($whereMap)
|
|
->field([
|
|
"a.comment",
|
|
"a.user_code as userCode",
|
|
"a.business_code as businessCode",
|
|
"b.nick_name as consumerName",
|
|
"b.avatar_url as avator",
|
|
"a.create_time as createTime",
|
|
"a.url",
|
|
"a.type",
|
|
])
|
|
->page($page,$size)
|
|
->order("a.create_time desc")
|
|
->select();
|
|
}
|
|
|
|
|
|
|
|
|
|
} |