import http from "../utils/http";
import config from "../config/config";

/**
 * 获取聊天配置
 * @author Seven
 * @data 2025-1-27
 * @param { type: "json", uid: uid }
 * @returns {  }
 * @see https://mall.gpxscs.cn/api/mobile/sns/im/getImConfig?typ=json&uid=10001
 */

export function GetImConfig(params) {
  return http({
    url: "/sns/im/getImConfig",
    method: "get",
    params,
    baseURL: config.baseApi,
  });
}

/**
 * 获取聊天记录
 * @author Seven
 * @data 2025-1-27
 * @param {typ: json,user_other_id: 10028,type: friend,page: 1} params
 * @returns {  }
 * @see https://mall.gpxscs.cn/api/mobile/sns/userMessage/listChatMsg?typ=json&user_other_id=10028&type=friend&page=1
 */

export function GetImMsgList(params) {
  return http({
    url: "https://mall.gpxscs.cn/api/mobile/sns/userMessage/listChatMsg",
    method: "get",
    params,
    baseURL: config.apiMobile,
  });
}

/**
 * 获取聊天记录
 * @author Seven
 * @data 2025-1-27
 * @param {typ: json,user_other_id: 10028,type: friend,page: 1} params
 * @returns {  }
 * @see https://mall.gpxscs.cn/api/mobile/sns/userMessage/add
 */

export function GetSendMsgAdd(params) {
  return http({
    url: "https://mall.gpxscs.cn/api/mobile/sns/userMessage/add",
    method: "get",
    params,
    baseURL: config.apiMobile,
  });
}

/**
 * 设置消息已读
 * @author Seven
 * @data 2025-1-27
 * @param {message_id}
 * @returns {  }
 * @see https://mall.gpxscs.cn/mobile/sns/userMessage/setRead
 */

export function SetMsgRead(params) {
  return http({
    url: "https://mall.gpxscs.cn/mobile/sns/userMessage/setRead",
    method: "post",
    data: params,
    baseURL: config.baseApi,
  });
}
