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);
75 SET C.USER_COUNT = (SELECT COUNT(1) FROM b_im_relation R WHERE R.CHAT_ID = C.ID )
76 WHERE C.ID IN (" .$implodedIds.
")
81 Option::set(self::$moduleId, self::OPTION_NAME, serialize($params));
86 Option::delete(self::$moduleId, [
"name" => self::OPTION_NAME]);
89 $result[
"steps"] = $params[
"number"];