fuchengshen
2022-07-15 dfdcca599b595c7340b31ee7cd5878f29a3268eb
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
import { isObject } from "/@/cool/utils";
 
export function parseContent({ content, contentType }: any) {
    const data = isObject(content) ? content : JSON.parse(content);
    let text = "";
 
    switch (contentType) {
        case 0:
            text = data.text;
            break;
        case 1:
            text = "[图片]";
            break;
        case 2:
            text = "[表情]";
            break;
        case 3:
            text = "[语音]";
            break;
        case 4:
            text = "[视频]";
            break;
        case 5:
            text = "[商品信息]";
            break;
    }
 
    data._text = text;
 
    return data;
}