ChatMessageService.php 705 B

123456789101112131415161718192021222324252627
  1. <?php
  2. namespace app\admin\service\statistics;
  3. use app\model\Appointment;
  4. use app\model\ChatMessage;
  5. use support\Db;
  6. class ChatMessageService
  7. {
  8. public static function getChatMessage()
  9. {
  10. // 今日咨询
  11. $todayStartUnix = strtotime(date('Y-m-d'));
  12. $chats= ChatMessage::whereBetween('chat_message_addtimes',[$todayStartUnix,time()])->get()->toArray();
  13. $memberIds = [];
  14. foreach ($chats as $chat){
  15. if (substr($chat['join_message_send_id'],0,2) == 'MR'){
  16. $memberIds[$chat['join_message_send_id']] = $chat['join_message_send_id'];
  17. }
  18. }
  19. $data['todayChat'] = count($memberIds);
  20. return $data;
  21. }
  22. }