|
|
@@ -69,7 +69,9 @@ class UserNotice extends BaseModel
|
|
|
) and uid in (%d, 0) and del_time=0
|
|
|
", $tnotice, $tnotice_see, $uid, $uid);
|
|
|
$row = Db::query($sql);
|
|
|
- return intval($row[0]['unread']);
|
|
|
+ $num = intval($row[0]['unread']);
|
|
|
+ $max = Config::get('app.notice_max', 30);
|
|
|
+ return $num > $max ? $max : $num;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -77,15 +79,18 @@ class UserNotice extends BaseModel
|
|
|
* @return array
|
|
|
*/
|
|
|
public static function getNoticeList($uid, $page, $limit = 20){
|
|
|
+ $max = Config::get('app.notice_max', 30);
|
|
|
+ $limit = $max;
|
|
|
$prefix = Env::get('database.prefix', 'eb_');
|
|
|
$tnotice = $prefix . 'user_notice';
|
|
|
$tnotice_see = $prefix . 'user_notice_see';
|
|
|
$sql = sprintf("
|
|
|
select n.id, n.icon, n.`user` as `from`, n.title as subject, n.content as `body`, n.add_time as ts, n.`type`, s.id as `read`
|
|
|
- from %s n left join %s s on n.id = s.nid
|
|
|
+ from %s n left join (select id,nid from %s where uid=%d) s on n.id = s.nid
|
|
|
where n.uid in (%d, 0) and n.del_time=0
|
|
|
order by n.add_time desc limit %d,%d
|
|
|
- ", $tnotice, $tnotice_see, $uid, ($page-1)*$limit, $limit);
|
|
|
+ ", $tnotice, $tnotice_see, $uid, $uid, ($page-1)*$limit, $limit);
|
|
|
+ // echo $sql;
|
|
|
$data = Db::query($sql);
|
|
|
|
|
|
return $data;
|