import { requestApi } from '../util/network'

// 发送聊天
export const addInstantMessage =
    (data) =>
      requestApi(
        '/seller_instant_message/add',
        'POST',
        data,
        'seller'
      )
// 加入聊天
export const joinChat =
    (client_id) =>
      requestApi(
        '/seller_instant_message/join',
        'POST',
        {
          client_id: client_id
        },
        'seller'
      )
// 已读消息
export const setMessage =
    (data) =>
      requestApi(
        '/seller_instant_message/set_message',
        'POST',
        data,
        'seller'
      )
// 聊天历史
export const getChatHistory =
    (params, t_id) =>
      requestApi(
        '/seller_instant_message/get_chat_log',
        'POST',
        {
          page: params.page,
          per_page: params.per_page,
          t_id: t_id
        },
        'seller'
      )
// 最近消息
export const getChatList =
    () =>
      requestApi(
        '/seller_instant_message/get_user_list',
        'POST',
        {
          recent: 1
        },
        'seller'
      )
