Commit e7f59143 authored by qinhaitao's avatar qinhaitao

feat: 🎸 注册积分

parent db419887
/** @format */
import { CommonUserService, CommonBaseService } from '../../service/common'
import { getSellerSession } from '../../utils'
import { getSellerSession, getUserOrderlist } from '../../utils'
import { formatVipCbUrl, getShopVip } from '../../utils/common/vip'
import { CODE_TYPES } from '../../errorCode'
import { resultsModel } from '../../sdk'
import { resultsModel, TBAPIS } from '../../sdk'
export type IInfo = 'session' | 'vipInfo'
export type IInfo = 'session' | 'vipInfo' | 'taobaoOrderist' | 'credits'
async function initBaseInfo(context: IContext<IParams>, baseInfos: ICheckControllerInfos, needInfos: IInfo[]) {
const handler = context?.cloud?.dataspace?.context?.handler
......@@ -39,6 +39,21 @@ async function initBaseInfo(context: IContext<IParams>, baseInfos: ICheckControl
const vipInfo = await getShopVip(context, baseInfos.activityInfo, formatVipCbUrl(context))
baseInfos.vipInfo = vipInfo
}
if (needInfos.includes('taobaoOrderist') && !baseInfos.taobaoOrderist) {
const taobaoOrderist = await getUserOrderlist(
context,
baseInfos?.userInfo?.createTime || baseInfos?.activityInfo?.startTime || Date.now(),
Date.now()
)
baseInfos.taobaoOrderist = taobaoOrderist
}
if (needInfos.includes('credits') && !baseInfos.credits) {
const credits = await TBAPIS.queryCredits(this.context)
baseInfos.credits = credits
}
return baseInfos
}
......
......@@ -28,6 +28,8 @@ interface IControllerInfos {
vipInfo?: IVipInfo
activityInfo: IActivityInfo
session?: string
credits?: number
taobaoOrderist?: ITaoBaoOrders[]
}
interface ICheckControllerInfos extends IControllerInfos {
......
......@@ -8,3 +8,14 @@ interface ITaoBaoItems {
image: string
desc: string
}
interface ITaoBaoOrders {
payTime: string
itemId: string
time: string
price: string
orderId: string
img: string
title: string
tId: string
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment