26 if (!Loader::includeModule(self::$moduleId))
33 $params = Option::get(self::$moduleId, self::OPTION_NAME,
"");
34 $params = ($params !==
"" ? @unserialize($params, [
"allowed_classes" =>
false]) : []);
35 $params = (is_array($params) ? $params : []);
41 "count" => ChatTable::getCount(),
45 if ($params[
"count"] > 0)
47 $result[
"steps"] =
"";
48 $result[
"count"] = $params[
"count"];
50 $ids = ChatTable::getList(
52 'order' => [
'ID' =>
'ASC'],
54 '>ID' => $params[
"lastId"],
62 $ids = array_map(
function($item){
66 $idsCount = count($ids);
69 $params[
"lastId"] = $ids[$idsCount - 1];
70 $params[
"number"] += $idsCount;
72 $implodedIds = implode(
',', $ids);
78 LEFT JOIN b_user U ON R.USER_ID = U.ID
79 WHERE R.CHAT_ID = C.ID AND U.ACTIVE = 'Y'
81 WHERE C.ID IN (" .$implodedIds.
")
86 Option::set(self::$moduleId, self::OPTION_NAME, serialize($params));
91 Option::delete(self::$moduleId, [
"name" => self::OPTION_NAME]);
94 $result[
"steps"] = $params[
"number"];