function indexOf(array, appointmentAuth, checkAuth) {
    // var userMsg= wx.getStorageSync('userMsg')
    // 1预约权限;2审核权限 
    if (array) {
        if (array.length == 2 && (appointmentAuth || checkAuth)) {
            return true
        }
        if (array.indexOf(1) > -1) {
            if (appointmentAuth) {
                return true
            } else {
                return false
            }
        }
        if (array.indexOf(2) > -1) {

            if (checkAuth) {
                return true
            } else {
                return false
            }
        }
    }
}

function indexOf1(array, value) {
    if (array) {
        if (array.indexOf(value) < 0) {
            return false;
        } else {
            return true;
        }
    }
}

function getVehicleType(id) {
    var drivingModelList = [{
            id: 1,
            name: 'A1'
        },
        {
            id: 2,
            name: 'A2'
        },
        {
            id: 3,
            name: 'A3'
        },
        {
            id: 4,
            name: 'B1'
        },
        {
            id: 5,
            name: 'B2'
        },
        {
            id: 6,
            name: 'C1'
        },
        {
            id: 7,
            name: 'C2'
        },
        {
            id: 8,
            name: 'C3'
        },
        {
            id: 9,
            name: 'C4'
        },
        {
            id: 10,
            name: 'C5'
        },
        {
            id: 11,
            name: 'D'
        },
    ]
    var name = ''
    drivingModelList.forEach(function (item) {
        if (item.id == id) {
            name = item.name
        }
    })
    return name
}

function desensitization(string = "", start, end) {
    var star = ''

    function makeStar(number) {
        if (number > 0) {
            star += '*';
            return makeStar(--number)
        } else {
            return star
        }
    };
    return string.substring(0, start) + makeStar(end - start) + string.substring(end)
}

module.exports = {
    indexOf: indexOf,
    indexOf1: indexOf1,
    getVehicleType: getVehicleType,
    desensitization: desensitization,
}