dao->getToDayInfo($chatId); if ($info) { if ($todaySum) { $info->today_sum++; } if ($todayReturnSum) { $info->today_return_sum++; } $info->chat_sum = $chatSum; $info->chat_return_sum = $chatReturnSum; $info->save(); } else { $this->dao->save([ 'group_id' => $chatId, 'today_sum' => $todaySum ? 1 : 0, 'today_return_sum' => $todayReturnSum ? 1 : 0, 'chat_sum' => $chatSum, 'chat_return_sum' => $chatReturnSum, ]); } } /** * 群统计列表 * @param int $id * @param string $time * @return array */ public function getChatStatisticsList(int $id, string $time) { [$page, $limit] = $this->getPageValue(); $list = $this->dao->getDataList(['time' => $time, 'group_id' => $id], ['*'], $page, $limit); $count = $this->dao->count(['time' => $time, 'group_id' => $id]); return compact('list', 'count'); } }