import http from './scan/httpUtil'
import { message } from './scan/config'

/*************************消息中心接口****************************/

/**
 * title: 统计数量
 * info: 查询总数量不传参数，查询 已读Read = true，未读 Read = false
 */
export function messgeCount(param, success) {
  let url = `${message}/message/count`;
  http.postJson(url, param, success)
}

/**
 * title: 创建消息
 * info: 消息类型：提示(Info)、警告(Warning)、错误(Error)、成功(Success)
 */
export function messgeCreate(param, success) {
  let url = `${message}/message/create`;
  http.postJson(url, param, success)
}

/**
 * title: 删除消息
 */
export function messgeDelete(param, success) {
  let url = `${message}/message/delete`;
  http.postJson(url, param, success)
}

/**
 * title: 查询消息列表
 */
export function messgeQuery(param, success) {
  let url = `${message}/message/page-query`;
  http.postJson(url, param, success)
}

/**
 * title: 更新消息状态
 * info: 是否读过：未读（f）、已读（t）
 */
export function messgeUpdate(param, success) {
  let url = `${message}/message/update`;
  http.postJson(url, param, success)
}

/**
 * title: 根据接收人将消息置为已读
 * info: 已读Read = true,*UserId
 */
export function messgeUpdateState(param, success) {
  let url = `${message}/message/update-state`;
  http.postJson(url, param, success)
}
