zhaojs
2023-09-15 39e2103e28830337c3be4dbd3dc7ad0a829ee78b
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
function getUrlPar(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return unescape(r[2]);
    return null;
}
 
 
function formatDate(time, fmt) {
    let date = new Date(time);
    const o = {
        'M+': date.getMonth() + 1, //月份
        'd+': date.getDate(), //日期
        'h+': date.getHours(), //小时
        'm+': date.getMinutes(), //分
        's+': date.getSeconds(), //秒
        'q+': Math.floor((date.getMonth() + 3) / 3), //季度
        'S': date.getMilliseconds() //毫秒
    };
    if (/(y+)/.test(fmt)) {
        fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substring(4 - RegExp.$1.length));
    }
    for (let k in o) {
        if (new RegExp('(' + k + ')').test(fmt)) {
            fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substring(('' + o[k])
                .length)));
        }
    }
    return fmt;
}
 
function getSmsStatus(status) {
    switch (status) {
        case 0:
            return '审核中';
        case 1:
            return '审核成功';
        case 2:
            return '审核失败';
        case 3:
            return '等待发送';
        case 4:
            return '发送中';
        case 5:
            return '接收中';
        case 6:
            return '接收成功';
        case 7:
            return '接收失败';
        default:
            return '接收失败';
    }
}
 
module.exports = {
    getUrlPar,
    formatDate,
    getSmsStatus
}