riku
2024-11-13 48145f787eda81815f653ad21161a60e89b6a303
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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)
  }
}