import { request } from './request'

const baseUri = ''
const dictUri = '/wx/dictController'
const controller = '/wx/data'
const pub = '/wx/public'

export function listBizAll(userId) {
    return request({
        url: baseUri + controller + '/listBizAll/' + userId,
        method: 'post'
    })
}

export function listProjectAll(data) {
    return request({
        url: baseUri + pub + '/listProjectAll',
        method: 'post',
        data
    })
}

export function getByCodes(data) {
    return request({
        url: baseUri + dictUri + '/getByCodes',
        method: 'post',
        data
    })
}

export function getDictData(code) {
    const codes = []
    for (let i = 0; i < code.length; i++) {
        codes.push(code[i])
    }
    const postData = {
        codes: JSON.stringify(codes)
    }
    return new Promise((resolve, reject) => {
        getByCodes(postData).then((res) => {
            resolve(res)
        }).catch((err, x) => {
            reject(err, x)
        })
    })
}

