import request from '@/utils/request';
import { resolve } from 'path';



function DelShare(ids) {
    return request({
        url: '/api/equipment/share/' + ids,
        method: 'delete'
    });
}
//添加分享数据
function SaveShare(data,type){

    let promise=null;
   if(type=='add'){
    promise=addShare(data);
   }else{
    promise=powerSet(data);
   }
   return promise;
}
//添加
function addShare(data) {
    return request({
        url: '/api/equipment/share/deviceShare',
        method: 'post',
        data: data
    });
}

//修改
function powerSet(data) {
    return request({
        url: '/api/equipment/share/permission',
        method: 'post',
        data: data
    });

}
//查询
function searchShare(params) {
    return request({
        url: '/api/equipment/share/deviceShareList',
        method: 'get',
        params: params
    })
}

//发送验证码
function sendSms(phoneNumber) {
    return request({
        url: '/api/equipment/share/sms/code',
        method: 'get',
        params: {
            phonenumber: phoneNumber
        }
    });

    // return new Promise((resolve,reject)=>{
    //     resolve({
    //         code:200
    //     });
    // });
}

function getUsrs(){
     return request({
        url: '/WebApp/user/list',
        method: 'get',
        params: {
           pageNum:1,
           pageSize:9999
        }
    });
    
}

export default {
    powerSet: powerSet,
    DelShare: DelShare,
    SaveShare: SaveShare,
    searchShare: searchShare,
sendSms:sendSms,
getUsrs:getUsrs
}
