riku
2024-11-26 efefef06c76a8b366bc676382e7b78316583b3ef
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import { $fytz } from '../index';
 
const id = 'BbEfZ4izeR4TEZ2N';
const name = 'pcheck';
 
export default {
  /**
   * 获取通知历史记录
   */
  getNoticeHistory({ type, subtype = null, page = 1, perPage = 20 }) {
    const params = `userId=${id}&page=${page}&per_page=${perPage}`;
    return $fytz
      .post(`notifications/history?${params}`, {
        ecNoticetype: type,
        ecNoticesubtype: subtype
      })
      .then((res) => res.data);
  },
 
  /**
   * 获取用户未读通知
   */
  getNotification() {
    return $fytz
      .get('notifications', {
        params: {
          userId: id,
          page: 1,
          per_page: 30
        }
      })
      .then((res) => res.data);
  },
 
  /**
   * 发布通知
   * @param {
        //发布者id
        authorId: '',
        //发布者名字
        authorName: '',
        //通知类型数组
        _typeArray: [0],
        //通知类型id
        typeId: '',
        //通知子类型id
        subTypeId: '',
        //通知标题
        title: '',
        //通知内容
        content: '',
        //通知图片
        picUrl: '',
        //通知链接
        bodyUrl: '',
        //是否需要签收
        needSigned: false,
        //接受用户场景类型
        receiverType: '0',
        //接受用户区县
        district: '0',
        //接受用户id
        receiverId: '',
      }
   */
  releaseNotice(notice) {
    notice.authorId = id;
    notice.authorName = name;
    return $fytz.post(`notifications/${id}/release2`, notice).then((res) => res.data);
  }
};