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


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

//手机验证码
const sms={
	send:p => http.post('/sms/sendSms'+p)
}

const system={
	login:p => http.post('blade-auth/oauth/token'+p,{},{header:{'Authorization': "Basic c2FiZXI6c2FiZXJfc2VjcmV0"}}),
}


//商场管理
const mall={
	login:p => http.post('/shop/account/login',p),
	detail:p => http.get("ldt_mall/mall/detail", {params:p}),
	submit:p => http.post("ldt_mall/mall/submit", p),
	list:p => http.get("/ldt_mall/mall/list", {params:p}),
	memberInfo:p => http.get('mall/memberInfo',{params:p}),
	getShopList:p => http.get("shop/list",{params:p}),
	statistic:p => http.get("mall/statistic?mallId="+p),
	getTagSelect:p => http.get("blade-system/dict-biz/list",{params:p}),
	getSetTag:p => http.post("ldt_mall/mall/submit",p),
	getTagRemove:p => http.post("cyzh-ldt/mallshoplabel/remove?ids="+p),
}



const appaccount={
	login:p => http.post('/common/account/login',p),
	forgetPsw :p=> http.post('/common/account/forgetPsw',p),
	phoneLogin:p => http.post('/common/account/phoneLogin',p),
	setPassword:p => http.post('/common/account/updatePsw',p),
}


//会员中心
const member={
	list:p => http.get('ldt_user/member/list',{params:p}),
}



const shop={
	update:p => http.post('ldt_shop/shop/update',p),
	submit:p => http.post('ldt_shop/shop/submit',p),
	detail:p => http.get("ldt_shop/shop/detail", {params:p}),
	indexInfo:p => http.get("shop/indexInfo", {params:p}),
}

const audit={
	list:p => http.get("ldt_shop/audit/list", {params:p}),
	submit:p => http.post('ldt_shop/audit/submit',p),
	detail:p => http.get("ldt_shop/audit/detail", {params:p}),
}

const activity={
	//发起活动
	publish:(p)=> http.post('/common/activity/publish',p),
	//已发起的活动
	list:p => http.get("/common/activity/list", {params:p}),
	//可参加的活动
	getCanJoinActivity:p => http.get("/common/activity/getCanJoinActivity", {params:p}),
	//活动详情
	detail:p => http.get("ldt_activity/activity/detail", {params:p}),
	//结束活动
	stop:(p)=> http.post('ldt_activity/activity/submit',p),
}

const joinRecord={
	//活动详情查看该活动的参加者
	list:p => http.get("ldt_activity/joinrecord/list", {params:p}),
	//活动清单中查看自己参加的活动
	joined:p => http.get("common/joinrecord/list", {params:p}),
	//退出活动
	remove:p => http.post("ldt_activity/joinrecord/remove?ids="+p),
	//参加活动
	submit:(p)=> http.post('ldt_activity/joinrecord/submit',p),
}


const flow={
	//获取流程自定义主键
	getProcessDefinitionId:p => http.get('blade-flow/work/start-list',{params:p}),
	//获取任务id
	getTaskId:p => http.get('blade-flow/work/todo-list', {params:p}),
	//获取流程历史记录
	historyFlowList:p => http.get('blade-flow/process/history-flow-list', {params:p}),
	//提交审核流程
	flowAuditSubmit:p => http.post("blade-flow/work/complete-task", p),
}

export const api={
	uploadFile,
	sms,
	system,
	mall,
	appaccount,
	member,
	shop,
	audit,
	activity,
	joinRecord,
	flow
}