xc-app/API/index.js

712 lines
18 KiB
JavaScript

import {
httpUrlFormat,
ajaxCarryAuthorization,ajaxSync
} from '@/utils/httpUtils.js'
import { ApiVersion,AppVersion } from '@/config/baseConfig.js'
const headerVersion = {
'API-Version': ApiVersion(),
'APP-Version':AppVersion()
}
const _flag = 'apiBaseUrl' // 请求的api空间
const apiUrl = {
'boxesPinnedApi': httpUrlFormat('/boxes/pinned', _flag),
'boxesTagsApi': httpUrlFormat('/boxes/tags', _flag),
'boxesApi': httpUrlFormat('/boxes', _flag),
'boxRecordApi': httpUrlFormat('/box/record', _flag),
'boxOrderApi': httpUrlFormat('/box/order', _flag),
'boxOrderReviewApi': httpUrlFormat('/box/order/review', _flag),
'boxOrderPaidApi': httpUrlFormat('/box/order/paid', _flag),
'orderPaidApi': httpUrlFormat('/order/paid', _flag),
'boxRecordResultApi': httpUrlFormat('/box/record/result', _flag),
'boxDeliveryPreviewApi': httpUrlFormat('/order/box/delivery/preview', _flag),
'boxDeliveryApi': httpUrlFormat('/order/box/delivery', _flag),
'boxActivityApi': httpUrlFormat('/boxes/activity', _flag),//活动盲盒
'boxActivityListApi': httpUrlFormat('/boxes/activity/list', _flag),//活动盲盒
'promptCountApi': httpUrlFormat('/user/prompt/count', _flag),//用户提示卡数量
'usePromptApi': httpUrlFormat('/box/order/use/prompt', _flag),//使用提示卡
'activityDetailApi': httpUrlFormat('/boxes/activity/detail', _flag),//
'activityDetailSourceApi': httpUrlFormat('/boxes/activity/detail/source', _flag),//
'activityBuyApi': httpUrlFormat('/coin/gear/activity/box', _flag),//活动盲盒购买
'activitySourceBuyApi': httpUrlFormat('/box/order/activity/source', _flag),//活动盲盒购买
'activityReviewApi': httpUrlFormat('/box/order/activity/review', _flag),//活动盲盒订单预览
'activityReviewSourceApi': httpUrlFormat('/box/order/activity/review/source', _flag),//活动盲盒订单预览-新
'activityOrderApi': httpUrlFormat('/box/order/activity', _flag),
'recoveryBatchApi': httpUrlFormat('/box/record/recovery/batch', _flag),
'deliveryReviewBatchApi': httpUrlFormat('/order/box/delivery/preview/batch', _flag),
'deliveryBatchApi': httpUrlFormat('/order/box/delivery/batch', _flag),
'promptExchangeBatchApi': httpUrlFormat('/user/prompt/exchange/batch', _flag),
'boxResultApi': httpUrlFormat('/misc/box/result', _flag),
'noOpenListApi': httpUrlFormat('/box/record/no/open/list', _flag),//未开奖记录
'openListApi': httpUrlFormat('/box/record/open', _flag),//开奖记录
'boxesChannelPinnedApi': httpUrlFormat('/boxes/channel/pinned', _flag),//首页盲盒-渠道
'orderReceive': httpUrlFormat('/order/receive', _flag),
'orderList': httpUrlFormat('/order/mall_order', _flag),
'boxOrder': httpUrlFormat('/order/box_order', _flag),
'boxRecord': httpUrlFormat('/order/box_record', _flag),
'boxOpen': httpUrlFormat('/order/box_open', _flag),
'boxPickup': httpUrlFormat('/order/box_pickup', _flag),
'boxRecycle': httpUrlFormat('/order/box_recycle', _flag),
'boxInfo': httpUrlFormat('/order/box_info', _flag),
'orderCancel': httpUrlFormat('/order/cancel', _flag),
'boxOpenByBoxId': httpUrlFormat('/order/box_open_by_box_id', _flag),
'popupAdPageApi': httpUrlFormat('/misc/popup/ad/page', _flag),
'popupAdPageChannelApi': httpUrlFormat('/misc/popup/ad/page/channel', _flag),
'activityIconApi': httpUrlFormat('/activity/icon', _flag),
'activityDetailNewApi': httpUrlFormat('/activity/detail', _flag),
'pointClearApi': httpUrlFormat('/user/point/clear', _flag),
'activityTaskAwardApi': httpUrlFormat('/activity/task/award', _flag),
'activityTaskCreateApi': httpUrlFormat('/box/order/activity/create', _flag),
'freeBoxApi': httpUrlFormat('/boxes/free/box', _flag),
'activityGuideApi': httpUrlFormat('/activity/guide', _flag),
'indexGuideApi': httpUrlFormat('/user/index/guide', _flag),
'activityTopLastApi': httpUrlFormat('/activity/top/last', _flag),
}
export function boxRecoveryApi(data) {
return ajaxCarryAuthorization({
header: headerVersion,
// header: {'Content-Type': 'application/x-www-form-urlencoded'},
url: httpUrlFormat(`/box/record/recovery/${data.id}`, _flag),
method: 'PUT',
data
})
}
//分页盲盒
export function boxesApi(data) {
return ajaxCarryAuthorization({
header: headerVersion,
// header: {'Content-Type': 'application/x-www-form-urlencoded'},
url: apiUrl.boxesApi,
method: 'GET',
data: data
})
}
//首页盲盒
export function boxesPinnedApi(data) {
return ajaxCarryAuthorization({
header: headerVersion,
url: apiUrl.boxesPinnedApi,
method: 'GET',
data: data
})
}
//盲盒标签
export function boxesTagsApi(data) {
return ajaxCarryAuthorization({
header: headerVersion,
// header: {'Content-Type': 'application/x-www-form-urlencoded'},
url: apiUrl.boxesTagsApi,
method: 'GET',
data: data
})
}
//盲盒开奖记录
export function boxRecordApi(data) {
return ajaxCarryAuthorization({
header: headerVersion,
// header: {'Content-Type': 'application/x-www-form-urlencoded'},
url: apiUrl.boxRecordApi,
method: 'GET',
data: data
})
}
// 盲盒详情
export function boxesDetail(data,header = {}) {
const headerObj = {...headerVersion,...header}
// header['API-Version'] = ApiVersion()
return ajaxCarryAuthorization({
header:headerObj,
// header: {'Content-Type': 'application/x-www-form-urlencoded'},
url: httpUrlFormat(`/boxes/${data.id}`, _flag),
method: 'GET',
data
})
}
// 创建盲盒订单
export function boxOrderApi(data) {
return ajaxCarryAuthorization({
header: headerVersion,
// header: {'Content-Type': 'application/x-www-form-urlencoded'},
url: apiUrl.boxOrderApi,
method: 'POST',
data
})
}
export function boxOrderListApi(data) {
return ajaxCarryAuthorization({
header: headerVersion,
// header: {'Content-Type': 'application/x-www-form-urlencoded'},
url: apiUrl.boxOrderApi,
method: 'GET',
data
})
}
// 活动盲盒
export function boxActivityApi(data) {
return ajaxCarryAuthorization({
header: headerVersion,
// header: {'Content-Type': 'application/x-www-form-urlencoded'},
url: apiUrl.boxActivityApi,
method: 'GET',
data
})
}
// 活动盲盒
export function boxActivityListApi(data) {
return ajaxCarryAuthorization({
header: headerVersion,
// header: {'Content-Type': 'application/x-www-form-urlencoded'},
url: apiUrl.boxActivityListApi,
method: 'GET',
data
})
}
// 创建盲盒订单
export function boxOrderReviewApi(data) {
return ajaxCarryAuthorization({
header: headerVersion,
// header: {'Content-Type': 'application/x-www-form-urlencoded'},
url: apiUrl.boxOrderReviewApi,
method: 'GET',
data
})
}
// 创建盲盒订单
export function boxOrderPaidApi(data) {
return ajaxCarryAuthorization({
header: headerVersion,
// header: {'Content-Type': 'application/x-www-form-urlencoded'},
url: apiUrl.boxOrderPaidApi,
method: 'GET',
data
})
}
export function orderPaidApi(data) {
return ajaxCarryAuthorization({
header: headerVersion,
// header: {'Content-Type': 'application/x-www-form-urlencoded'},
url: apiUrl.orderPaidApi,
method: 'GET',
data
})
}
// 盲盒开奖结果
export function boxRecordResultApi(data) {
return ajaxCarryAuthorization({
header: headerVersion,
// header: {'Content-Type': 'application/x-www-form-urlencoded'},
url: apiUrl.boxRecordResultApi,
method: 'GET',
data
})
}
export function boxDeliveryPreviewApi(data) {
const headerObj = {...headerVersion,'Content-Type': 'application/x-www-form-urlencoded'}
return ajaxCarryAuthorization({
header:headerObj,
// header: {'Content-Type': 'application/x-www-form-urlencoded','API-Version': ApiVersion()},
// url: apiUrl.cart_item,
url: apiUrl.boxDeliveryPreviewApi,
// url: httpUrlFormat(`/order/box/delivery/preview?boxRecordId=${data.boxRecordId}&quantity=${data.quantity}`, _flag),
method: 'POST',
data: data
})
}
export function boxDeliveryApi(data) {
return ajaxCarryAuthorization({
header: headerVersion,
// url: apiUrl.cart_item,
url: apiUrl.boxDeliveryApi,
method: 'POST',
data: data
})
}
export function boxesChannelPinnedApi(data) {
return ajaxCarryAuthorization({
header: headerVersion,
// header: {'Content-Type': 'application/x-www-form-urlencoded'},
url: apiUrl.boxesChannelPinnedApi,
method: 'GET',
data
})
}
//商城订单列表
export function orderList(data) {
return ajaxCarryAuthorization({
header: headerVersion,
// header: {'Content-Type': 'application/x-www-form-urlencoded'},
url: apiUrl.order,
method: 'GET',
data: data
})
}
// 删除订单
export function delOrder(data) {
const headerObj = {...headerVersion,'Content-Type': 'application/x-www-form-urlencoded'}
return ajaxCarryAuthorization({
header: headerObj,
// url: apiUrl.cart_item,
url: apiUrl.order,
method: 'DELETE',
data: data
})
}
// 取消订单
export function orderCancel(data) {
const headerObj = {...headerVersion,'Content-Type': 'application/x-www-form-urlencoded'}
return ajaxCarryAuthorization({
header: headerObj,
// url: apiUrl.cart_item,
url: apiUrl.orderCancel,
method: 'PUT',
data: data
})
}
// 确认收货
export function orderReceive(data) {
const headerObj = {...headerVersion,'Content-Type': 'application/x-www-form-urlencoded'}
return ajaxCarryAuthorization({
header: headerObj,
// url: apiUrl.cart_item,
url: apiUrl.orderReceive,
method: 'POST',
data: data
})
}
//创建商城订单
export function createOrder(data) {
return ajaxCarryAuthorization({
header: headerVersion,
// header: {'Content-Type': 'application/x-www-form-urlencoded'},
url: apiUrl.orderList,
method: 'POST',
data: data
})
}
//订单预览
export function orderPreview(data) {
const headerObj = {...headerVersion,'Content-Type': 'application/x-www-form-urlencoded'}
return ajaxCarryAuthorization({
header: headerObj,
url: apiUrl.orderPreview,
method: 'POST',
data: data
})
}
//盲盒订单列表
export function boxOrderList(data) {
return ajaxCarryAuthorization({
header: headerVersion,
// header: {'Content-Type': 'application/x-www-form-urlencoded'},
url: apiUrl.boxOrder,
method: 'GET',
data: data
})
}
//创建盲盒订单
export function boxCreateOrder(data) {
return ajaxCarryAuthorization({
header: headerVersion,
// header: {'Content-Type': 'application/x-www-form-urlencoded'},
url: apiUrl.boxOrder,
method: 'POST',
data: data
})
}
//礼盒/物品列表
export function boxRecord(data) {
return ajaxCarryAuthorization({
header: headerVersion,
// header: {'Content-Type': 'application/x-www-form-urlencoded'},
url: apiUrl.boxRecord,
method: 'GET',
data: data
})
}
//开盲盒
export function boxOpen(data) {
const headerObj = {...headerVersion,'Content-Type': 'application/x-www-form-urlencoded'}
return ajaxCarryAuthorization({
// header: {'Content-Type': 'application/x-www-form-urlencoded'},
header: headerObj,
url: apiUrl.boxOpen,
method: 'POST',
data: data
})
}
//提取盲盒
export function boxPickup(data) {
return ajaxCarryAuthorization({
header: headerVersion,
// header: {'Content-Type': 'application/x-www-form-urlencoded'},
url: apiUrl.boxPickup,
method: 'POST',
data: data
})
}
//回收盲盒
export function boxRecycle(data) {
const headerObj = {...headerVersion,'Content-Type': 'application/x-www-form-urlencoded'}
return ajaxCarryAuthorization({
header: headerObj,
url: apiUrl.boxRecycle,
method: 'POST',
data: data
})
}
// 订单详情
export function orderDetail(no,data) {
return ajaxCarryAuthorization({
header: headerVersion,
url: httpUrlFormat(`/order/${no}`, _flag),
method: 'GET',
data: data
})
}
//盲盒详情
export function boxInfo(data) {
return ajaxCarryAuthorization({
header: headerVersion,
url: apiUrl.boxInfo,
method: 'GET',
data: data
})
}
// 根据盲盒id开盒
export function boxOpenByBoxId(data) {
const headerObj = {...headerVersion,'Content-Type': 'application/x-www-form-urlencoded'}
return ajaxCarryAuthorization({
header: headerObj,
url: apiUrl.boxOpenByBoxId,
method: 'POST',
data: data
})
}
// 用户提示卡数量
export function promptCountApi(data) {
return ajaxCarryAuthorization({
header: headerVersion,
url: apiUrl.promptCountApi,
method: 'GET',
data: data
})
}
// 使用提示卡
export function usePromptApi(data) {
const headerObj = {...headerVersion,'Content-Type': 'application/x-www-form-urlencoded'}
return ajaxCarryAuthorization({
header: headerObj,
url: apiUrl.usePromptApi,
method: 'POST',
data: data
})
}
export function activityDetailApi(data,header = {}) {
// header['API-Version'] = ApiVersion()
const headerObj = {...headerVersion,...header}
return ajaxCarryAuthorization({
header:headerObj,
url: apiUrl.activityDetailApi,
method: 'GET',
data: data
})
}
export function activityDetailSourceApi(data,header = {}) {
// header['API-Version'] = ApiVersion()
const headerObj = {...headerVersion,...header}
return ajaxCarryAuthorization({
header:headerObj,
url: apiUrl.activityDetailSourceApi,
method: 'GET',
data: data
})
}
export function activityBuyApi(data) {
const headerObj = {...headerVersion,'Content-Type': 'application/x-www-form-urlencoded'}
return ajaxCarryAuthorization({
header: headerObj,
url: apiUrl.activityBuyApi,
method: 'POST',
data: data
})
}
export function activitySourceBuyApi(data) {
const headerObj = {...headerVersion,'Content-Type': 'application/x-www-form-urlencoded'}
return ajaxCarryAuthorization({
header: headerObj,
url: apiUrl.activitySourceBuyApi,
method: 'POST',
data: data
})
}
export function activityReviewApi(data) {
return ajaxCarryAuthorization({
header: headerVersion,
url: apiUrl.activityReviewApi,
method: 'GET',
data: data
})
}
export function activityReviewSourceApi(data) {
return ajaxCarryAuthorization({
header: headerVersion,
url: apiUrl.activityReviewSourceApi,
method: 'GET',
data: data
})
}
export function activityOrderApi(data) {
const headerObj = {...headerVersion,'Content-Type': 'application/x-www-form-urlencoded'}
return ajaxCarryAuthorization({
header: headerObj,
url: apiUrl.activityOrderApi,
method: 'POST',
data: data
})
}
export function recoveryBatchApi(data) {
const headerObj = {...headerVersion,'Content-Type': 'application/x-www-form-urlencoded'}
return ajaxCarryAuthorization({
header: headerObj,
url: apiUrl.recoveryBatchApi,
method: 'PUT',
data: data
})
}
export function deliveryReviewBatchApi(data) {
const headerObj = {...headerVersion,'Content-Type': 'application/x-www-form-urlencoded'}
return ajaxCarryAuthorization({
header: headerObj,
url: apiUrl.deliveryReviewBatchApi,
method: 'POST',
data: data
})
}
export function deliveryBatchApi(data) {
return ajaxCarryAuthorization({
header: headerVersion,
// header: {'Content-Type': 'application/x-www-form-urlencoded'},
url: apiUrl.deliveryBatchApi,
method: 'POST',
data: data
})
}
export function promptExchangeBatchApi(data) {
const headerObj = {...headerVersion,'Content-Type': 'application/x-www-form-urlencoded'}
return ajaxCarryAuthorization({
header: headerObj,
url: apiUrl.promptExchangeBatchApi,
method: 'POST',
data: data
})
}
export function boxResultApi(data,header = {}) {
const headerObj = {...headerVersion,...header}
return ajaxCarryAuthorization({
header:headerObj,
url: apiUrl.boxResultApi,
method: 'GET',
data: data
})
}
export function noOpenListApi(data,header = {}) {
const headerObj = {...headerVersion,...header}
// header['API-Version'] = ApiVersion()
return ajaxCarryAuthorization({
header:headerObj,
url: apiUrl.noOpenListApi,
method: 'GET',
data: data
})
}
// export function openListApi(data,header = {}) {
// // header['API-Version'] = ApiVersion()
// const headerObj = {...headerVersion,...header}
// return ajaxCarryAuthorization({
// header:headerObj,
// url: apiUrl.openListApi,
// method: 'GET',
// data: data
// })
// }
export function openListApi(data,header = {}) {
// header['API-Version'] = ApiVersion()
const headerObj = {...headerVersion,...header}
return ajaxCarryAuthorization({
header:headerObj,
url: httpUrlFormat(`/box/record/open?ids=${data}`, _flag),
method: 'GET',
data: data
})
}
export function popupAdPageApi(data) {
return ajaxCarryAuthorization({
header:headerVersion,
url: apiUrl.popupAdPageApi,
method: 'GET',
data: data
})
}
export function popupAdPageChannelApi(data) {
return ajaxCarryAuthorization({
header:headerVersion,
url: apiUrl.popupAdPageChannelApi,
method: 'GET',
data: data
})
}
export function activityIconApi(data) {
return ajaxCarryAuthorization({
header: headerVersion,
// header: {'Content-Type': 'application/x-www-form-urlencoded'},
url: apiUrl.activityIconApi,
method: 'POST',
data: data
})
}
export function activityDetailNewApi(data) {
return ajaxCarryAuthorization({
header: headerVersion,
// header: {'Content-Type': 'application/x-www-form-urlencoded'},
url: apiUrl.activityDetailNewApi,
method: 'POST',
data: data
})
}
export function pointClearApi(data) {
const headerObj = {...headerVersion,'Content-Type': 'application/x-www-form-urlencoded'}
return ajaxCarryAuthorization({
header: headerObj,
url: apiUrl.pointClearApi,
method: 'POST',
data: data
})
}
export function activityTaskAwardApi(data) {
return ajaxCarryAuthorization({
header: headerVersion,
url: apiUrl.activityTaskAwardApi,
method: 'POST',
data: data
})
}
export function activityTaskCreateApi(data) {
return ajaxCarryAuthorization({
header: headerVersion,
url: apiUrl.activityTaskCreateApi,
method: 'POST',
data: data
})
}
// 免费开盲盒
export function freeBoxApi(data) {
return ajaxCarryAuthorization({
header: headerVersion,
url: apiUrl.freeBoxApi,
method: 'GET',
data
})
}
export function activityGuideApi(data) {
return ajaxCarryAuthorization({
header: headerVersion,
url: apiUrl.activityGuideApi,
method: 'GET',
data: data
})
}
export function setActivityGuideApi(data) {
const headerObj = {...headerVersion,'Content-Type': 'application/x-www-form-urlencoded'}
return ajaxCarryAuthorization({
header: headerObj,
url: apiUrl.activityGuideApi,
method: 'POST',
data: data
})
}
export function indexGuideApi(data) {
return ajaxCarryAuthorization({
header: headerVersion,
url: apiUrl.indexGuideApi,
method: 'GET',
data: data
})
}
export function setIndexGuideApi(data) {
const headerObj = {...headerVersion,'Content-Type': 'application/x-www-form-urlencoded'}
return ajaxCarryAuthorization({
header: headerObj,
url: apiUrl.indexGuideApi,
method: 'POST',
data: data
})
}
export function activityTopLastApi(data) {
return ajaxCarryAuthorization({
header: headerVersion,
url: apiUrl.activityTopLastApi,
method: 'GET',
data: data
})
}