const $f = require('./baserequest') const util = require('../utils/util') module.exports = { //获取台账类型 getNotification: function (userId, page, fun, perPage = 3) { let cb = { url: `/notifications`, params: { userId: userId, page: page, per_page: perPage }, } Object.assign(cb, fun) let fun1 = util.deepCopy(cb) fun1.success = function (res) { res.forEach(r => { r.authorPicUrl = $f.basePicUrl + r.authorPicUrl r.picUrl = $f.basePicUrl + r.picUrl }); cb.success(res) } $f.get(fun1) }, // 更新通知阅读状态 updateReadState(userId, data, fun) { let cb = { url: `/notifications/${userId}/readState`, data: data, }; Object.assign(cb, fun); $f.post(cb); }, getUnReadNoticeCount(userId, fun) { let cb = { url: `/notifications/${userId}/unread`, } Object.assign(cb, fun) $f.get(cb) } }