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

//微信api
const wxApp={
	getOpenId:p => http.get('/wx-app/getOpenId', {params:p}),
	getOpenData:p => http.post('/wx-app/getOpenData',p),
	getGenerateScheme:p => http.get('/wx-app/getGenerateScheme', {params:p}),
	createWxaQrCode:p => http.get('/wx-app/createWxaQrCode', {params:p}),
}

//字典
const dict={
	list:p => http.get('/blade-system/dict-biz/dictionary', {params:p}),
}


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

//活动管理
const activity = {
	//音乐之声活动
	yyzs_list:p => http.get('yyzs/cyzh-activity/activity/selectPageWithTag', {params:p,custom: {yyzs: true}}),
	//商户活动
	list:p => http.get("/common/activity/list", {params:p}),
	//活动详情
	detail:p => http.get("ldt_activity/activity/detail", {params:p}),
	//获取地址信息
	getLocation:p => http.get("/common/activity/getLocation", {params:p}),
}

//用户管理
const loginUser={
	detail:p => http.get('ldt_user/loginuser/detail', {params:p}),
	submit:p => http.post('ldt_user/loginuser/submit', p),
	login:p => http.post('client/user/login', p),
	payBefore:p => http.post('cyzh-ldt/loginuser/payBeforeNew', p),
	payBeforeForNormal:p => http.post('cyzh-ldt/loginuser/payBeforeForNormal', p),
	getBillrecordFromRedis:p => http.get('cyzh-ldt/loginuser/getBillrecordFromRedis', {params:p}),
	clearBillRecordCache:p => http.get('cyzh-ldt/loginuser/clearBillRecordCache', {params:p}),
}



//商户管理
const shop={
	list:p => http.get('shop/list', {params: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 mall={
	//获取商场列表
	list:p => http.get('mall/list',{params:p}),
}

//代理商
const agenter={
	list:p => http.get('ldt_agent/agentrecord/list',{params:p}),
	submit:p => http.post('ldt_agent/agentrecord/submit', p),
	statistics:p => http.get('app/agent/agenterInfo',{params:p}),
	earningsDetail:p => http.get('app/agent/earningsDetail',{params:p}),
}

//代理类型
const agenterType={
	detail:p => http.get('ldt_platform/platformsetting/detail',{params:p}),
}


//用户银行
const userBank={
	detail:p => http.get('ldt_user/userbank/detail',{params:p}),
	list:p => http.get('ldt_user/userbank/list',{params:p}),
	appList:p => http.get('common/userbank/list',{params:p}),
	submit:p => http.post('ldt_user/userbank/submit', p),
	remove:p => http.post('ldt_user/userbank/remove?ids='+p),
}

//支付
const pay={
	//获取wx支付所需参数
	getPayOrderPamams:p => http.post('client/trade/scanPay',p),
	//h5获取wx支付所需参数
	getPayOrderPamamsForH5:p => http.post('client/trade/scanPayByWeChat',p),
	//wx支付
	payOrder:p => http.get('payment/payOrder/YEE_PAY/MINI_PROGRAM',{params:p}),
	//扫码支付
	payOrderOfscanCode:p => http.get('payment/payOrder/YEE_PAY/SCAN_CODE',{params:p}),
	//支付策略
	getPointPayType:p => http.post('cyzh-ldt/loginuser/getPointPayType',p),
}

const billRecord={
	addAgentOrder: p => http.post('/app/agent/addAgentOrder',p),
	submit:p => http.post('ldt_bills/bills/submit', p),
	detail:p => http.get('ldt_bills/bills/detail', {params:p}),
}

const balanceBills={
	list:p => http.get('common/balancebills/list',{params:p}),
}

const pointbills={
	list:p => http.get('ldt_bills/pointbills/list',{params:p}),
} 

const setting = {
	feedback: p => http.post('ldt_feedback/feedback/submit', p)
}

//账号
const account = {
	pointList:p => http.get('cyzh-ldt/loginuser/channeluserpoint/list',{params:p}),
	remainList:p => http.get('cyzh-ldt/loginuser/remaining/list',{params:p}),
}

//webSocket
const webSocket={
	sendInfo:p => http.post('webSocket/sendInfo',p),
}

const joinRecord={
	//活动详情查看该活动的参加者
	list:p => http.get("ldt_activity/joinrecord/list", {params:p}),
}

const statistics={
	getBillStatistics:p => http.get('/common/bills/getBillStatistics',{params:p})
}

const withdraw={
	submit:p => http.post('common/withdrawrec/withdraw',p),
	payOrder:p => http.get('payment/payOrder/YEE_PAY/USER_WITHDRAW',{params:p}),
	list:p => http.get("ldt_bills/withdrawrec/list", {params:p}),
}

const goods={
	menu:p => http.get("goods/getGoodsMenuList", {params:p}),
	order:p => http.post('ldt_bills/goodsbills/order',p),
}

const address={
	list:p => http.get("client/useraddress/list", {params:p}),
	detail:p => http.get("ldt_user_address/useraddress/detail", {params:p}),
	submit:p => http.post('client/useraddress/submit', p),
}


const userChannelPoint={
	list:p => http.get('ldt_user/userchannelpoint/list',{params:p}),
} 



export const api={
	wxApp,
	dict,
	uploadFile,
	activity,
	loginUser,
	shop,
	audit,
	mall,
	agenter,
	agenterType,
	userBank,
	pay,
	billRecord,
	balanceBills,
	pointbills,
	setting,
	account,
	webSocket,
	joinRecord,
	statistics,
	withdraw,
	goods,
	address,
	userChannelPoint
}