import AjmHttp from 'ajm-framework/core/utils/ajm-http';
import AjmConfig from 'ajm-framework/core/utils/ajm-config';

import SessionContextHodler from 'ajm-framework/core/utils/ajm-session'
// http请求对象
let $http = new AjmHttp({ contextPath: AjmConfig.get("MESSAGE_CONTEXT_PATH") }).getHttpClient();

// 消息服务对象
let messageService = {

    // 查询最新消息通知
    findMessageInformation() {
        return $http.get('/api/message/findMessageInformation').then(resp => resp.data);
    },


    // 20180622 前端往后端发消息通知
    sendMessage(params) {
        return $http.post('/api/message/sendMessage', params).then(resp => resp.data);
    },

    //20181025 前端往后端发消息通知 不保存数据 走ijiami-manager
    sendUserLoginMessage(params) {
        return $http.post('/api/user/sendUserLoginMessage', params).then(resp => resp.data);
    },
    //查询消息列表/api/message/findMessageList
    findMessageList(params){
        if (!params) {
            params = {};
        }
        return $http.post('/api/message/findMessageList', params).then(res => res.data);
    },

    //查询消息分页列表/api/message/findMessageListByPage
    findMessageListByPage(params){
        if (!params) {
            params = {};
        }
        return $http.post('/api/message/findMessageListByPage', params).then(res => res.data);
    },

    //更新消息状态/api/message/findMessageDetailByMessageId/{messageId}
    findMessageDetailByMessageId(messageId){
        return $http.get('/api/message/findMessageDetailByMessageId/' + messageId).then(res => res.data);
    }

}

export default messageService;
