import {http} from './service.js'

//文件上传
const uploadFile= p=> http.upload('/blade-resource/oss/endpoint/put-pic-md5', {name:'file',filePath:p})

//生成二维码
const generateCode = p => http.post('/community-app-service/app/miniprogram/generateCode',p)

//获取accessToken
const getAccessToken = p =>http.post('/community-app-service/app/miniprogram/getAccessToken',p)

//getOpenid
const getOpenid =p => http.post("/community-app-service/app/miniprogram/getOpenid",p)
//通过openid获取会员信息
const getMemberByOpenid=p => http.post('/community-app-service/app/miniprogram/getMemberByOpenid',p)
//获取地理位置
const getLocation =p => http.post('/community-app-service/app/miniprogram/ws/geocoder/v1/location',p)
//获取区列表
const getDistrictChildren = p =>http.post('/community-app-service/app/miniprogram/ws/district/v1/getchildren',p)

//通过会员id获取房间列表
const getRoomByMemberId = p =>http.post('/community-app-service/app/estate/getRoomByMemberId',p)

//通过区code查询小区列表
const getResidentialByRegionArea = p =>http.post('/community-app-service/app/residential/getByRegionArea',p)
//通过小区id获取楼栋列表
const getBuildingsByResidentialId = p =>http.post('/community-app-service/app/building/getBuildingsByResidentialId',p)
//通过楼栋id获取单元列表
const getUnitsByBuildingId = p =>http.post('/community-app-service/app/unit/getUnitsByBuildingId',p)
//通过单元id获取房间列表
const getRoomsByUnitId = p =>http.post('/community-app-service/app/room/getByUnitId',p)
//根据会员id获取访客授权列表
const getGuestRecordsByMemberId = p =>http.post('/community-app-service/app/guestRecord/getListByMemberId',p)

//会员获取验证码
const getSmsCode = p =>http.post('/community-app-service/app/member/getSmsCode',p)

//会员注册接口
const memberRegister = p =>http.post('/community-app-service/app/member/memberRegister',p)
//会员注册用户/添加家人
const authentication = p =>http.post('/community-app-service/app/member/authentication',p)
//编辑家人
const editFamily = p =>http.post('/community-app-service/app/houseuser/editUser',p)

//删除家人
const deleteUserById = p => http.post('/community-app-service/app/houseuser/deleteUserById',p)

//通过房间id获取房屋成员
const getFamilyByRoomIds = p => http.post('/community-app-service/app/houseuser/getUserByRoomId',p)


//banner列表
const adList = p => http.post('/community-app-service/app/adPushApp/getList',p)

//公告列表
const getNoticeList = p => http.post('/community-app-service/app/notice/noticeList',p)

//获取门禁设备列表
const getAuthDeviceByMemberId = p =>http.post("/community-app-service/app/member/getAuthDeviceByMemberId",p)


//获取字典接口
const getDictByCode = code => http.get('/blade-system/dict-biz/dictionary?code='+code);

//获取住户车辆列表
const carPage = p => http.post('/community-app-service/app/car/page',p)
//新增或编辑车辆
const saveOrUpdateCar = p => http.post('/community-app-service/app/car/saveOrUpdate',p)
//根据memberId获取家人列表
const getAllUserByMemberId = p => http.post('/community-app-service/app/houseuser/getAllUserByMemberId',p)
//获取住户审核记录
const getAllApplyUserByMemberId = p => http.post('/community-app-service/app/applyuser/getAllApplyUserByMemberId',p)
//通过房间获取住户审核记录
const getAllApplyUserByRoomIds = p => http.post('/community-app-service/app/applyuser/getAllApplyUserByRoomIds',p)

//住户审核
const updateCheckState = p => http.post('/community-app-service/app/applyuser/updateCheckState',p)

//根据MemberId获取访客授权记录
const getGuestAuthorizeList = p =>http.post('/community-app-service/app/guestAuthorize/getListByMemberId',p)
//新增授权记录
const addGuestAuthorize = p => http.post('/community-app-service/app/guestAuthorize/addGuestAuthorize',p)
//撤销授权记录
const guestAuthorizeCancel = p =>http.post('/community-app-service/app/guestAuthorize/cancel',p)

//新增物业报修工单
const addEstateRepair = p => http.post('/community-app-service/app/estateRepair/addEstateRepair',p)
//物业报修列表
const estateRepairList = p => http.post('/community-app-service/app/estateRepair/estateRepairList',p)
//物业保修详情
const estateRepairDetail = p => http.post('/community-app-service/app/estateRepair/estateRepairDetail',p)

//新增防疫登记
const addPratique = p => http.post('/community-app-service/app/pratique/addPratique',p)

//防疫登记列表
const pratiqueList = p =>http.post("/community-app-service/app/pratique/getListByMemberId",p)
//远程开门
const openDoor = p =>http.post("/community-app-service/app/member/openDoor",p)
//获取我家的设备
const iotDeviceList = p=>http.post("/community-app-service/app/iotdevice/list",p)

export const api={
	//文件上传
	uploadFile,
	//生成二维码
	generateCode,
	//获取accessToken
	getAccessToken,
	//通过openid获取会员信息
	getMemberByOpenid,
	//获取地理位置
	getLocation,
	//获取区信息
	getDistrictChildren,
	//通过会员id获取房间列表
	getRoomByMemberId,
	//通过区code查询小区列表
	getResidentialByRegionArea,
	//通过小区id获取楼栋列表
	getBuildingsByResidentialId,
	//通过楼栋id获取单元列表
	getUnitsByBuildingId,
	//通过单元id获取房间列表
	getRoomsByUnitId,
	//根据会员id获取访客授权列表
	getGuestRecordsByMemberId,
	//会员注册用户/添加家人
	authentication,
	//编辑家人
	editFamily,
	//删除家人
	deleteUserById,
	//通过房间id获取房屋成员
	getFamilyByRoomIds,
	
	getOpenid,
	
	//会员获取验证码
	getSmsCode,
	//会员注册接口
	memberRegister,	
	
	adList,
	//公告列表
	getNoticeList,
	
	//获取字典接口
	getDictByCode,
	//获取住户车辆列表
	carPage,
	//新增或编辑车辆
	saveOrUpdateCar,
	//根据memberId获取家人列表
	getAllUserByMemberId,
	//获取住户审核记录
	getAllApplyUserByMemberId,
	//通过房间获取住户审核记录
	getAllApplyUserByRoomIds,
	//住户审核
	updateCheckState,
	//根据MemberId获取访客授权记录
	 getGuestAuthorizeList,
	 //新增授权记录
	  addGuestAuthorize,
	  //撤销授权记录
	  guestAuthorizeCancel,
	  //新增物业报修工单
	  addEstateRepair,
	  //物业报修列表
	  estateRepairList,
	  //物业报修详情
	  estateRepairDetail,
	  //新增防疫登记
	  addPratique,
	  //防疫登记列表
	  pratiqueList,
	  //获取门禁设备列表
	  getAuthDeviceByMemberId,
	  //远程开门
	  openDoor,
	  //获取我家的设备
	  iotDeviceList
}