49 lines
1.3 KiB
PHP
49 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace addon\message\model;
|
|
|
|
use app\model\BaseModel;
|
|
|
|
class MessageRead extends BaseModel{
|
|
/**
|
|
* 获取列表
|
|
* @param array $condition
|
|
* @param int $page
|
|
* @param int $page_size
|
|
* @param string $order
|
|
* @param string $field
|
|
* @param string $alias
|
|
* @param array $join
|
|
* @return array
|
|
*/
|
|
public function getPageList($condition = [], $page = 1, $page_size = PAGE_LIST_ROWS, $order = '', $field = 'a.*', $alias = 'a', $join = [])
|
|
{
|
|
$list = model('message_center_read')->pageList($condition, $field, $order, $page, $page_size, $alias, $join);
|
|
return $this->success($list);
|
|
}
|
|
/**
|
|
* Common: 用户是否存在未读消息
|
|
* Author: wu-hui
|
|
* Time: 2023/04/04 10:31
|
|
* @param $memberId
|
|
* @return bool
|
|
*/
|
|
public function isHasUnread($memberId){
|
|
// 条件生成
|
|
$condition = [
|
|
['a.member_id', '=', $memberId ],
|
|
['a.is_see', '=', 0 ],
|
|
['mc.type', '<>', 4 ],
|
|
];
|
|
// 表关联
|
|
$join = [
|
|
['message_center mc', 'mc.id = a.message_center_id', 'left'],
|
|
];
|
|
$isHas = model('message_center_read')->getCount($condition, 'a.id', 'a', $join);
|
|
|
|
return (int)$isHas;
|
|
}
|
|
|
|
|
|
|
|
} |