AI智能回复搜索中,请稍后...
7 回答
/** * 定期清理已读通知 * * @param $period 周期, 单位: 秒 */ public function clean_mark_read_notifications($period) { while ($notifications = $this->fetch_all('notification', 'read_flag = 1 AND add_time < ' . (time() - $period), 'notification_id ASC', 1000)) { foreach ($notifications AS $k => $v) { $this->delete('notification', 'notification_id = ' . $v['notification_id']); $this->delete('notification_data', 'notification_id = ' . $v['notification_id']); } } return true; }加在计划任务里即可,一个月是 2592000 秒