import request from '@/utils/request.js'
import {
	getSession
} from '@/utils/auth.js'
const preUrl = '/clientServices.do?iscrypt=1'

//获取用户消息列表
export function getMessageList(params) {
	return request({
		url: preUrl,
		method: 'post',
		data: {
			'serviceId': 'oa_2017V001PHONE_messageList',
			'params': {
				"currentUser": params.currentUser, //useid
				"isRead": params.isRead,
				"pSize": params.pSize,
				"type": params.type,
				"p": params.p,
			}
		}
	})
}

//获取用户公告列表
export function getNoticeList(params) {
	return request({
		url: preUrl,
		method: 'post',
		data: {
			'serviceId': 'eu_notice_2013V0010PHONE001',
			'params': {
				"notice_title": params.notice_title,
				"p": params.p,
				"pSize": params.pSize,
				"userId": params.userId,
				"unitId": params.unitId,
			}
		}
	})
}

//获取公告详情
export function getNoticeInfo(params) {
	return request({
		url: preUrl,
		method: 'post',
		data: {
			'serviceId': 'eu_notice_2013V0010PHONE002',
			'params': {
				'userId': params.userId, //当前用户id
				'noticeId': params.noticeId
			}
		}
	})
}

//获取消息详情
export function getMessageInfo(params) {
	return request({
		url: preUrl,
		method: 'post',
		data: {
			'serviceId': 'oa_2017V002PHONE_messageInfo',
			'params': {
				'universalid': params.universalId,
				'messageId': params.messageId
			}
		}
	})
}

export function getUnReadMessageNum(useId) {
	return request({
		url: preUrl,
		method: 'post',
		data: {
			'serviceId': 'eu_2013V01readMessage',
			'params': {
				'staffId': useId
			}
		}
	})
}

//设置消息已读
export function setMsgIsRead(universalids) {
	return request({
		url: '/readMsgs.do?universalids=' + universalids,
		method: 'post',
		isSession: true,
	})
}