package com.example.system.chat;

import com.example.system.chat.service.MessageService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Slf4j
@RestController
@RequestMapping("/message")
public class MessageController {
    @Resource
    private MessageService messageService;
    /**
     * 获取sessionID会话的历史消息，按时间降序从start+1开始获取10条
     * @param sessionId
     * @param start
     * @return
     */
    @RequestMapping("/getHistoryMessage")
    public Object getHistoryMessage(Integer sessionId, Integer start) {
        log.info("获取sessionID会话的历史消息 sessionId: {} start: {}", sessionId, start);
        return messageService.getHistoryMessage(sessionId, start);
    }
}
