Commit 791f2c96 authored by qinhaitao's avatar qinhaitao

feat: 🎸 c_client

parent aa90a275
No preview for this file type
module.exports = [
{
type: 'input',
name: 'author',
message: 'author?',
},
{
type: 'input',
name: 'description',
message: 'description?',
}
]
\ No newline at end of file
const app = getApp();
const { tbcc, cloudName, cloud, requestType } = app;
const { utils: { generateAPI }, request: tbccRequest, capi } = tbcc;
const request = tbccRequest({
cloud,
cloudName,
requestType
});
// api handle 列表
const apiList = {
...capi,
getIndex: {
handle: 'index',
isShowLoading: true
},
login: 'login'
};
// 生成API
const API = generateAPI(apiList, request);
export default API;
page {
background: #f7f7f7;
font-family: 'Helvetica Neue', Helvetica, Hiragino Sans GB, 'Microsoft Yahei', STHeiTi, Arial, sans-serif;
}
* {
box-sizing: border-box;
}
.d-flex {
display: flex
}
.d-flex__item {
flex: 1;
}
.d-flex--aligncenter {
align-items: center;
}
.modal-animate-fade-in {
opacity: 0;
animation: modalAnimateFadeIn .3s forwards;
}
.modal-animate-zoom-in {
transform: scale(0);
animation: modalAnimateZoomIn .3s forwards;
}
.modal-animate-fly-in {
transform: translateY(100%);
animation: modalAnimateFlyIn .3s forwards;
}
.btn-animate-pulse {
animation: btnAnimatePulse .8s infinite;
}
@keyframes modalAnimateFadeIn {
to {
opacity: 1;
}
}
@keyframes modalAnimateZoomIn {
to {
transform: scale(1);
}
}
@keyframes modalAnimateFlyIn {
to {
transform: translateY(0);
}
}
@keyframes btnAnimatePulse {
from {
transform: scale(1);
}
50% {
transform: scale(1.1);
}
to {
transform: scale(1);
}
}
\ No newline at end of file
import cloud from '@tbmp/mp-cloud-sdk';
import tbcc from './tbcc-sdk';
cloud.init({
env: 'test' // 云函数环境 test 测试环境 online 线上环境
});
App({
requestType: 'ams', // ams:ams接口,cloud: 云函数
cloudName: 'clientTemplate2C', // 主云函数项目名
cloud,
tbcc,
onLaunch(options) {
this.handleQuery(options.query || {});
},
onShow(options) {
// 从后台被 scheme 重新打开
},
/**
* 处理链接参数
* @param {object} query 小程序链接上的参数
*/
handleQuery(query) {
const { activityId } = query;
this.activityId = activityId || 'testId';
}
});
{
"pages": [
"pages/index/index",
"pages/testPage/testPage",
"pages/tbccDemo/tbccDemo",
"pages/myprize/myprize"
],
"window": {
"defaultTitle": "C端模板"
}
}
### 注意!
assets文件夹只做本地开发测试使用
因为淘宝打包有体积限制,最大不超过1M,所以打包提审请同步图片等资源到CDN上,然后删除assets文件夹再打包提审。
\ No newline at end of file
.common-modal {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 20;
}
.common-modal__shade {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.75);
}
.common-modal__container {
position: absolute;
width: 500rpx;
height: 300rpx;
background: #4eafd7;
background-size: 100% 100%;
left: 50%;
top: 50%;
margin-left: -250rpx;
margin-top: -150rpx;
padding: 30rpx;
}
.common-modal__bd {
font-size: 28rpx;
text-align: center;
color: #fff;
padding: 50rpx 0;
}
.common-modal__close {
position: absolute;
right: -20rpx;
top: -80rpx;
height: 86rpx;
width: 86rpx;
background: url('../../assets/modal_close_btn.png') center center no-repeat;
background-size: 48rpx 48rpx;
z-index: 9;
}
.common-modal__confirm-btn {
margin: 0 auto;
text-align: center;
width: 341rpx;
height: 77rpx;
line-height: 77rpx;
background: #FFF;
background-size: 100% 100%;
font-size: 30rpx;
color: #0077a9;
font-weight: bold;
}
<view class="common-modal">
<view class="common-modal__shade modal-animate-fade-in" />
<view class="common-modal__container modal-animate-zoom-in">
<view class="common-modal__close" onTap="onModalClose" />
<view class="common-modal__bd">
<text>{{data.content}}</text>
</view>
<view class="common-modal__ft" a:if="{{data.btnText}}">
<view onTap="onModalConfirm" class="common-modal__confirm-btn">{{data.btnText}}</view>
</view>
</view>
</view>
Component({
methods: {
onModalClose() {
const { onModalClose } = this.props;
onModalClose && onModalClose();
},
onModalConfirm () {
const { onModalConfirm } = this.props;
onModalConfirm && onModalConfirm();
}
}
});
\ No newline at end of file
{
"component": true
}
\ No newline at end of file
.rule-modal {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 20;
}
.rule-modal__shade {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.75);
}
.rule-modal__container {
position: absolute;
width: 500rpx;
height: 600rpx;
background: #4eafd7;
background-size: 100% 100%;
left: 50%;
top: 50%;
margin-left: -250rpx;
margin-top: -300rpx;
}
.rule-modal__bd {
position: absolute;
top: 40rpx;
left: 40rpx;
right: 40rpx;
bottom: 40rpx;
overflow-x: hidden;
font-size: 24rpx;
color: #fff;
line-height: 1.5;
}
.rule-modal__close {
position: absolute;
right: -20rpx;
top: -80rpx;
height: 86rpx;
width: 86rpx;
background: url('../../assets/modal_close_btn.png') center center no-repeat;
background-size: 48rpx 48rpx;
z-index: 9;
}
<view class="rule-modal">
<view class="rule-modal__shade modal-animate-fade-in" />
<view class="rule-modal__container modal-animate-zoom-in">
<view class="rule-modal__close" onTap="onModalClose" />
<view class="rule-modal__bd">
<slot />
</view>
</view>
</view>
Component({
methods: {
onModalClose() {
const { onModalClose } = this.props;
onModalClose && onModalClose();
}
}
});
\ No newline at end of file
const { tbcc } = getApp();
const { constants: tbccConstants } = tbcc;
// 分享配置
export const SHARE_CONFIG = {
title: '分享测试标题',
desc: '分享测试描述',
imageUrl: '', // 分享图片URL
path: 'pages/index/index'
};
// 链接配置
export const REDIRECT_URL = {
'testpage': '/pages/testPage/testPage',
'tmall': 'https://www.tmall.com'
};
export const DRAW_STATUS = tbccConstants.DRAW_STATUS;
export const PRIZE_TYPE = tbccConstants.PRIZE_TYPE;
{
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@tbmp/mp-cloud-sdk": {
"version": "1.3.4",
"resolved": "https://registry.npm.taobao.org/@tbmp/mp-cloud-sdk/download/@tbmp/mp-cloud-sdk-1.3.4.tgz",
"integrity": "sha1-+1HCYryYfVc0kze0SOWv1oL6xgk="
}
}
}
{
"name": "",
"version": "1.0.0",
"main": "",
"license": "MIT",
"dependencies": {
"@tbmp/mp-cloud-sdk": "*"
}
}
.index-page {
min-height: 100vh;
}
.index-rule-btn, .index-myprize-btn {
position: absolute;
top: 30rpx;
width: 126rpx;
height: 48rpx;
line-height: 48rpx;
font-size: 22rpx;
background: rgba(0, 0, 0, 0.8);
color: #FFF;
text-align: center;
z-index: 5;
}
.index-rule-btn {
left: 0;
border-radius: 0 48rpx 48rpx 0;
}
.index-myprize-btn {
right: 0;
border-radius: 48rpx 0 0 48rpx;
}
.index-page__title {
font-size: 50rpx;
text-align: center;
padding: 100rpx 0 50rpx 0;
}
.index-page__content {
text-align: center;
font-size: 30rpx;
}
.index-page__tips {
padding-top: 40rpx;
text-align: center;
font-size: 22rpx;
}
.index-start-btn {
background: #0077a9;
color: #FFF;
width: 300rpx;
height: 80rpx;
line-height: 80rpx;
text-align: center;
border-radius: 10rpx;
margin: 100rpx auto 50rpx auto;
font-size: 30rpx;
}
.index-tbcc-btn {
background: #0077a9;
color: #FFF;
width: 300rpx;
height: 80rpx;
line-height: 80rpx;
text-align: center;
border-radius: 10rpx;
margin: 0 auto;
font-size: 30rpx;
}
.index-link-btn {
text-align: center;
color: #333;
font-size: 26rpx;
}
\ No newline at end of file
<view class="index-page">
<view class="index-rule-btn" onTap="showRuleModal">活动规则</view>
<navigator open-type="navigate" url="/pages/myprize/myprize" class="index-myprize-btn">我的奖品</navigator>
<view class="index-page__title">{{title}}</view>
<view class="index-page__content">{{content}}</view>
<view class="index-page__tips">AM接口只支持PC端预览,手机淘宝预览需要使用云函数模式</view>
<view class="index-start-btn" onTap="doStart">开始</view>
<navigator open-type="navigate" url="/pages/tbccDemo/tbccDemo" class="index-tbcc-btn">tbcc demo</navigator>
</view>
<rule-modal a:if="{{ruleModalVisible}}" onModalClose="closeRuleModal"><text>{{rule}}</text></rule-modal>
<common-modal a:if="{{commonModalVisible}}" data="{{commonModalData}}" onModalClose="closeCommonModal" onModalConfirm="confirmCommonModal" />
\ No newline at end of file
import { SHARE_CONFIG, REDIRECT_URL } from '../../constants';
import API from '../../api';
const app = getApp();
const { tbcc } = app;
const { commonToast, getAuthUserInfo, navigateToOutside } = tbcc.tb;
Page({
data: {
title: '',
content: '',
rule: '',
commonModalData: {
content: '',
btnText: ''
},
commonModalConfirm: null,
commonModalVisible: false,
ruleModalVisible: false
},
onLoad(query) {
// 页面加载
this.getAuth();
console.info(`Page onLoad with query: ${JSON.stringify(query)}`);
},
init() {
this.getIndex();
},
onReady() {
// 页面加载完成
},
onShow() {
// 页面显示
},
onHide() {
// 页面隐藏
},
onUnload() {
// 页面被关闭
},
onTitleClick() {
// 标题被点击
},
onPullDownRefresh() {
// 页面被下拉
},
onReachBottom() {
// 页面被拉到底部
},
/**
* 获取用户授权信息
*/
async getAuth() {
const userInfo = await getAuthUserInfo().catch(err => {
console.log('未授权成功', err);
});
if (userInfo) {
console.log('userInfo', userInfo);
const { nickName, avatar } = userInfo;
app.nickName = nickName;
app.avatar = avatar;
this.login();
}
},
/**
* 获取主接口
*/
async getIndex() {
const { success, data } = await API.getIndex().catch(res => {
commonToast(res && res.message);
}) || {};
if (success && data) {
const { title, content, rule } = data;
this.setData({ title, content, rule });
}
},
/**
* 登录接口
*/
async login() {
const { nickName, avatar } = app;
const { success } = await API.login({ nickName, avatar }).catch(res => {
commonToast(res && res.message);
}) || {};
if (success) {
this.init();
}
},
/**
* 显示规则弹层
*/
showRuleModal() {
this.setData({
ruleModalVisible: true
});
},
/**
* 通用弹出确认按钮回调
*/
confirmCommonModal() {
const { commonModalConfirm } = this.data;
commonModalConfirm && commonModalConfirm();
},
/**
* 执行开始
*/
doStart() {
this.showCommonModal({
content: '活动还未开始\n请稍后',
btnText: '我知道了',
commonModalVisible: true,
confirmCallback: () => {
this.closeCommonModal();
}
});
},
/**
* 显示通用弹层
* @param {object} options content: 通用弹层内容 btnText:按钮文案 confirmCallback: 按钮确认回调
*/
showCommonModal({ content, btnText, confirmCallback }) {
this.setData({
commonModalConfirm: confirmCallback || null,
commonModalVisible: true,
commonModalData: { content, btnText }
});
},
/**
* 跳转到天猫页面
*/
goTmallPage() {
navigateToOutside(REDIRECT_URL['tmall']);
},
/**
* 关闭通用弹层
*/
closeCommonModal() {
this.setData({
commonModalVisible: false
});
},
/**
* 关闭活动规则弹层
*/
closeRuleModal() {
this.setData({
ruleModalVisible: false
});
},
onShareAppMessage() {
// 返回自定义分享信息
return SHARE_CONFIG;
},
});
{
"usingComponents": {
"rule-modal": "/components/ruleModal/ruleModal",
"common-modal": "/components/commonModal/commonModal"
}
}
\ No newline at end of file
<view>
<button onTap="receiveObjectPrize">领取实物</button>
<button onTap="receiveEnamePrize">领取权益</button>
</view>
\ No newline at end of file
import API from '../../api';
const app = getApp();
const { tbcc } = app;
const { commonToast } = tbcc.tb;
Page({
data: {},
onLoad() {
this.getMyPrizeList();
},
async getMyPrizeList() {
const result = await API.getMyPrizeList().catch(res => {
commonToast(res && res.message);
});
console.log(result);
},
async receiveObjectPrize(_id) {
const success = await API.fn.receiveObjectPrize({ _id });
if (success) {
commonToast('保存成功');
}
},
async receiveEnamePrize(_id) {
const success = await API.fn.receiveEnamePrize({ _id });
if (success) {
commonToast('领取成功');
}
}
});
{}
\ No newline at end of file
.tbcc-demo-page {
text-align: center;
padding: 60rpx 20rpx 20rpx;
}
.tbcc-demo-page button {
margin-bottom: 10rpx;
}
.tbcc-demo-page .upload-image {
width: 200rpx;
height: 200rpx;
}
.tbcc-demo-page .input-item {
width: 684rpx;
height: 80rpx;
}
.text-risk-item {
margin: 30rpx auto;
}
.tbcc-demo__title {
padding: 20rpx;
font-weight: bold;
font-size: 36rpx;
}
\ No newline at end of file
<view class="tbcc-demo-page">
<view class="tbcc-demo__title">常用tb方法</view>
<button onTap="showCommomToast">弱提示</button>
<button onTap="showCommomConfirm">通用确认弹层</button>
<button onTap="getAuth">获取用户授权</button>
<button onTap="getSystemInfo">获取系统信息</button>
<button onTap="getServerTime">获取系统时间</button>
<button onTap="favorShop">关注店铺(百草味为例需预览)</button>
<button onTap="checkShopFavoredStatus">店铺关注状态(百草味为例需预览)</button>
<button onTap="getUserAddress">获取收货地址(需预览)</button>
<button onTap="collectGoods">收藏商品(iPad Pro为例)</button>
<button onTap="checkGoodsCollectedStatus">商品收藏状态(iPad Pro为例)</button>
<button onTap="openDetail">跳转淘宝商品页(iPad Pro为例)</button>
<button onTap="navigateToOutside">跳转外部链接(需预览)</button>
<button onTap="navigateTo">跳转内部链接(新开窗口)</button>
<button onTap="redirectTo">跳转内部链接(不新开窗口)</button>
<button onTap="uploadImage">选择上传图片</button>
<view a:if="{{uploadImgUrl}}">
<image mode="aspectFit" src="{{uploadImgUrl}}" class="upload-image"></image>
</view>
<button onTap="chattingSendCard">分享到群聊卡片(需预览)</button>
<view class="text-risk-item">
<input type="text" onInput="bindKeyInput" data-name="riskInput" placeholder="请输入校验文本" class="input-item" />
<button onTap="textRiskIdentification">文本风险检测(需预览)</button>
</view>
<view class="tbcc-demo__title">通用API方法</view>
<button onTap="receiveObjectPrize">领取实物奖励</button>
<button onTap="receiveEnamePrize">领取权益奖励</button>
</view>
import API from '../../api';
const app = getApp();
const { tbcc } = app;
const {
commonToast,
simpleAlert,
commonConfirm,
getAuthUserInfo,
getSystemInfo,
getServerTime,
favorShop,
checkShopFavoredStatus,
getUserAddress,
collectGoods,
checkGoodsCollectedStatus,
openDetail,
navigateToOutside,
navigateTo,
redirectTo,
uploadImage,
chattingSendCard,
textRiskIdentification
} = tbcc.tb;
const { dateFormatter, versionCompare } = tbcc.utils;
Page({
data: {
uploadImgUrl: '',
riskInput: ''
},
onLoad() {},
bindKeyInput(e) {
const { value } = e.detail;
const { name } = e.target.dataset;
this.setData({
[name]: value,
});
},
/**
* toast提示
*/
showCommomToast() {
commonToast('tbcc', 3000, () => {
console.log('tbcc toast loaded');
});
},
/**
* confirm弹窗
*/
showCommomConfirm() {
commonConfirm('提示', '内容', () => {
commonToast('保存成功');
});
},
/**
* 获取用户授权信息
*/
async getAuth() {
const userInfo = await getAuthUserInfo().catch(err => {
console.log('未授权成功', err);
});
if (userInfo) {
console.log('userInfo', userInfo);
const { nickName, avatar } = userInfo;
app.nickName = nickName;
app.avatar = avatar;
simpleAlert(nickName);
}
},
/**
* 获取系统信息
*/
async getSystemInfo() {
const systemInfo = await getSystemInfo().catch(err => {
console.log('获取系统信息失败', err);
});
if (systemInfo) {
console.log('systemInfo', systemInfo);
const { version } = systemInfo;
const compareVersion = '9.8.0';
const isNewVersion = versionCompare(version, compareVersion);
simpleAlert('当前版本:' + version + `${isNewVersion ? '为新版本': '为老版本'}`);
}
},
/**
* 获取系统时间
*/
async getServerTime() {
const severTime = await getServerTime().catch(err => {
console.log('获取系统时间失败', err);
});
simpleAlert('系统时间:' + dateFormatter(severTime, 'yyyy/MM/dd hh:mm:ss'));
},
/**
* 关注店铺
*/
async favorShop() {
const sellerId = 628189716; // 百草味sellerId
const favorStatus = await favorShop(sellerId).catch(err => {
console.log('关注店铺失败', err);
});
commonToast(favorStatus ? '关注成功' : '关注失败');
},
/**
* 查询店铺关注状态
*/
async checkShopFavoredStatus() {
const sellerId = 628189716; // 百草味sellerId
const favoredStatus = await checkShopFavoredStatus(sellerId).catch(err => {
console.log('查询关注店铺状态失败', err);
});
simpleAlert(favoredStatus ? '已关注店铺' : '未关注店铺');
},
/**
* 获取用户收货地址
*/
async getUserAddress() {
const userAddress = await getUserAddress().catch(err => {
commonToast(err.errorMessage);
});
if (userAddress) {
console.log('userAddress', userAddress);
const { name, phone, address } = userAddress.duibaAddress;
commonConfirm('提示', '确认使用该收货地址:' + name + phone + address, () => {
// TODO 保存接口
commonToast('保存成功');
});
}
},
/**
* 收藏商品
*/
async collectGoods() {
const itemId = 622499363381; // iPad Pro 为例
const collectGoodsStatus = await collectGoods(itemId).catch(err => {
console.log('收藏商品失败', err);
});
commonToast(collectGoodsStatus ? '收藏商品成功' : '收藏商品失败');
},
/**
* 收藏商品
*/
async checkGoodsCollectedStatus() {
const itemId = 622499363381; // iPad Pro 为例
const goodscollectedStatus = await checkGoodsCollectedStatus(itemId).catch(err => {
console.log('查询商品收场状态失败', err);
});
simpleAlert(goodscollectedStatus ? '商品已收藏' : '商品未收藏');
},
/**
* 跳转到淘宝商品页
*/
async openDetail() {
const itemId = '622499363381'; // iPad Pro 为例
await openDetail(itemId).catch(err => {
console.log('打开淘宝商品页失败', err);
});
},
/**
* 跳转到外部链接
*/
navigateToOutside() {
const url = 'https://www.tmall.com';
navigateToOutside(url);
},
/**
* 跳转到小程序内部链接(新开窗口)
*/
navigateTo() {
const url = '/pages/index/index';
navigateTo(url);
},
/**
* 跳转到小程序内部链接(不新开窗口)
*/
redirectTo() {
const url = '/pages/index/index';
redirectTo(url);
},
/**
* 选择上传图片
*/
async uploadImage() {
const uploadImageResultUrl = await uploadImage().catch(err => {
commonToast(err && (err.errorMessage || '上传图片失败'));
});
if (uploadImageResultUrl) {
this.setData({
uploadImgUrl: uploadImageResultUrl
});
}
},
/**
* 分享到群聊卡片
*/
async chattingSendCard() {
// 测试请求参数(格式示例)
const requestInfo = {
"biz_ext_map": "{\"activityId\":\"028fe748-9413-4df1-ad15-7d21d9ca16c9\",\"shareId\":\"AAGrFC1BALWl0Axwb3svqUyd\"}",
"card_template_id": 1588754547060,
"group_id": "0_G_2207623078795_1591670473134",
"weex_data_json": "{\"url\":\"https://m.duanqu.com?_ariver_appid=3000000005188064&nbsv=0.1.2007151634.12&nbsource=debug&nbsn=DEBUG&_mp_code=tb&query=activityId%3D028fe748-9413-4df1-ad15-7d21d9ca16c9%26groupId%3D0_G_2207623078795_1591670473134%26shareId%3DAAGrFC1BALWl0Axwb3svqUyd\",\"act_title\":\"一起出道赢大奖\",\"share\":\"@pilee0827 多度\",\"picture3\":\"https://yun.duiba.com.cn/upload/ltuwhbf39x.jpg\"}",
"message_id": "5f0fcdfeef507182be6c2247",
"app_secret": "appSecret",
"app_code": "30123678"
};
const messageResult = await chattingSendCard(requestInfo).catch(err => {
commonToast(err && err.errorMessage);
});
if (messageResult) {
const { result: { value, success } } = messageResult;
commonToast(value && success ? '分享到群聊成功' : '分享到群聊失败');
}
},
/**
* 文本风险校验
*/
async textRiskIdentification() {
const { riskInput } = this.data;
const success = await textRiskIdentification(riskInput).catch(err => {
console.log(err);
});
simpleAlert(`检测文本"${riskInput}",校验结果${success ? '通过' : '不通过'}`);
},
/**
* 领取实物奖励
*/
async receiveObjectPrize() {
const _id = '123'; // 测试奖品ID
const success = await API.fn.receiveObjectPrize({ _id });
if (success) {
commonToast('保存成功');
}
},
/**
* 领取权益奖励
*/
async receiveEnamePrize() {
const _id = '123'; // 测试奖品ID
const success = await API.fn.receiveEnamePrize({ _id });
if (success) {
commonToast('领取成功');
}
}
});
.test-page {
text-align: center;
padding: 100rpx 0;
}
\ No newline at end of file
<view class="test-page">
测试跳转页面
</view>
\ No newline at end of file
Page({
data: {},
onLoad() {}
});
import * as tb from './lib/tb';
import * as tbMock from './lib/tbMock';
import * as utils from './lib/utils';
import * as constants from './lib/constants';
import capi from './lib/capi';
import request from './lib/request';
const isH5 = 'undefined' !== typeof window;
// 如果为h5环境走mock数据
let _tb = {};
Object.entries(tb).forEach(([key, value]) => {
_tb[key] = isH5 ? tbMock[key] : value;
});
export default {
capi,
tb: _tb,
utils,
request,
constants
};
\ No newline at end of file
const capi = {
getMyPrizeList: {
handle: 'getMyPrizeList',
isShowLoading: true
},
receiveObjectPrize: 'receiveObjectPrize',
receiveEnamePrize: 'receiveEnamePrize'
};
export default capi;
import { getUserAddress, commonToast } from './tb';
import { getRequestParams } from './utils';
// 通用API封装方法
const capiFn = (apiList, request) => {
return {
async receiveObjectPrize(params) {
const { handle, method, ext } = getRequestParams(apiList['receiveObjectPrize']);
const userAddress = await getUserAddress().catch(err => {
commonToast(err.errorMessage);
});
if (userAddress) {
const { name, phone, address } = userAddress.duibaAddress;
commonConfirm('提示', '确认使用该收货地址:' + name + phone + address, async () => {
params = {
name,
phone,
address,
...params
}
const result = await request(handle, method, params, ext).catch(res => {
commonToast(res && res.message);
});
if (result && result.success) {
return true;
}
});
}
return false;
},
async receiveEnamePrize(params) {
const { handle, method, ext } = getRequestParams(apiList['receiveEnamePrize']);
const result = await request(handle, method, params, ext).catch(res => {
commonToast(res && res.message);
});
if (result && result.success) {
return true;
}
return false;
}
}
};
export default capiFn;
// 领取奖品状态
export const DRAW_STATUS = {
// 待领取
WAITAWARD: 1,
// 处理中
PROCESSING: 2,
// 领取成功
SUCCESS: 3,
// 领取失败
FAIL: 4,
// 已过期
EXPIRED: 5,
// 重新领取
RETRY: 6
}
// 奖品类型
export const PRIZE_TYPE = {
ENAME: 1,
CREDITS: 2,
OBJECT: 3,
THANKS: 5
};
const AMS_URL = 'https://ams.dui88.com/server/index.php?g=Web&c=Mock&o=simple&projectID=218&uri=';
const request = ({ cloud, cloudName, requestType = 'cloud' }) => {
if (!cloud) {
console.error('请传入cloud');
return false;
}
if (!cloudName) {
console.error('请传入云函数名称');
return false;
}
return async (handle, method, params, ext = {}) => {
const { activityId } = getApp();
// 默认注入activityId
params = { activityId, ...params };
if (!params.activityId) {
console.error(`${handle}:请传入activityId`);
return false;
}
const _cloudName = ext.cloudName || cloudName;
const { isShowLoading } = ext;
const hideMyLoading = () => {
if (isShowLoading) {
my.hideLoading();
}
};
if (isShowLoading) {
my.showLoading();
}
const requestAms = () => {
return new Promise((resolve, reject) => {
my.request({
url: AMS_URL + _cloudName + '.' + handle,
method,
data: params,
dataType: 'json'
}).then(({ data: res }) => {
hideMyLoading();
if (res && res.success) {
resolve(res);
} else {
reject(res);
}
}).catch(() => {
hideMyLoading();
reject();
});
})
};
const requestCloud = () => {
return new Promise((resolve, reject) => {
cloud.function.invoke(_cloudName, params, handle).then(res => {
console.log(handle, params, res);
hideMyLoading();
if (res && res.success) {
resolve(res);
} else {
reject(res);
}
return res;
}).catch(() => {
hideMyLoading();
reject();
});
});
};
return requestType === 'ams' ? requestAms() : requestCloud();
};
};
export default request;
\ No newline at end of file
/**
* 通用toast
* @param {string} content toast内容
* @param {number} duration 显示时长
* @param {function} successCb 成功回调
*/
export const commonToast = (content, duration = 3000, successCb) => {
my.showToast({
content: content || '换个姿势再试一次~',
duration,
success: successCb
});
};
/**
* 简易alert
* @param {string} content toast内容
*/
export const simpleAlert = content => {
my.alert({
content
});
};
/**
* 通用确认弹窗
* @param {string} title 标题
* @param {string} content 内容
* @param {function} successCb 成功回调
*/
export const commonConfirm = (title = '提示', content, successCb) => {
my.confirm({
title,
content,
confirmButtonText: '确定',
cancelButtonText: '取消',
success: result => {
const { confirm } = result;
if (confirm) {
successCb && successCb();
}
}
});
};
/**
* 获取授权用户信息
* @returns {object} 用户登录信息
*/
export const getAuthUserInfo = async () => {
return new Promise((resolve, reject) => {
my.authorize({
scopes: 'scope.userInfo',
success: () => {
my.getAuthUserInfo({
success: userInfo => {
resolve(userInfo);
},
fail: err => {
reject(err);
}
});
},
fail: err => {
reject(err);
}
});
});
};
/**
* 获取系统信息
* @returns {object} 小程序系统信息
*/
export const getSystemInfo = async () => {
return new Promise((resolve, reject) => {
my.getSystemInfo({
success: res => {
resolve(res);
},
fail: err => {
reject(err);
}
});
});
};
/**
* 执行关注店铺
* @param {number} sellerId 店铺归属的卖家Id
* @returns {boolean} 关注状态
*/
export const favorShop = async sellerId => {
if (!sellerId) {
console.error('favorShop: 请传入卖家Id');
return false;
}
return new Promise((resolve, reject) => {
my.tb.favorShop({
id: +sellerId,
success: res => {
resolve(res);
},
fail: err => {
if (err.error === 11) {
// error code 11 为用户取消操作不认作失败场景
resolve(false);
}
reject(err);
}
});
});
};
/**
* 判断是否关注店铺
* @param {number} sellerId 店铺归属的卖家Id
* @returns {boolean} 关注状态
*/
export const checkShopFavoredStatus = async sellerId => {
if (!sellerId) {
console.error('checkShopFavoredStatus: 请传入卖家Id');
return false;
}
return new Promise((resolve, reject) => {
my.tb.checkShopFavoredStatus({
id: +sellerId,
success: res => {
resolve(res.isFavor);
},
fail: err => {
reject(err);
}
});
});
};
/**
* 跳转到外部链接
* @param {string} url 跳转链接
*/
export const navigateToOutside = url => {
if (!url) {
console.error('navigateToOutside: 请传入url');
return false;
}
my.call('navigateToOutside', { url });
};
/**
* 跳转到内部链接(新开窗口)
* @param {string} url 跳转链接
*/
export const navigateTo = url => {
if (!url) {
console.error('navigateTo: 请传入url');
return false;
}
my.navigateTo({ url });
};
/**
* 跳转到内部链接(不新开窗口)
* @param {string} url 跳转链接
*/
export const redirectTo = url => {
if (!url) {
console.error('redirectTo: 请传入url');
return false;
}
my.redirectTo({ url });
};
/**
* 获取服务器时间
* @returns {number} 服务器时间戳
*/
export const getServerTime = async () => {
return new Promise((resolve, reject) => {
my.getServerTime({
success: res => {
resolve(res.time);
},
fail: err => {
reject(err);
}
});
});
};
/**
* 收藏商品
* @param {number} 商品id
* @returns {object} 收藏结果
*/
export const collectGoods = async id => {
if (!id) {
console.error('collectGoods: 请传入商品id');
return false;
}
return new Promise((resolve, reject) => {
my.tb.collectGoods({
id: +id,
success: res => {
resolve(res);
},
fail: err => {
if (err.error === 11) {
// error code 11 为用户取消操作不认作失败场景
resolve(false);
}
reject(err);
}
});
});
};
/**
* 查询商品收藏状态
* @param {number} 商品id
* @returns {boolean} 商品收场状态
*/
export const checkGoodsCollectedStatus = async id => {
if (!id) {
console.error('checkGoodsCollectedStatus: 请传入商品id');
return false;
}
return new Promise(resolve => {
my.tb.checkGoodsCollectedStatus({
id: +id,
success: res => {
resolve(res.isCollect);
}
});
});
};
/**
* 跳转到淘宝商品页
* @param {string} itemId 商品ID
*/
export const openDetail = async itemId => {
if (!itemId) {
console.error('openDetail: 请传入商品id');
return false;
}
return new Promise((resolve, reject) => {
my.tb.openDetail({
itemId: itemId + '',
success: res => {
resolve(res);
},
fail: res => {
reject(res);
}
});
});
};
/**
* 创建音频类
*/
class AudioModel {
constructor(opts = {}) {
const { src } = opts;
if (!src) {
console.error('请输入音频链接');
return false;
}
try {
const innerAudioContext = my.createInnerAudioContext();
Object.keys(opts).forEach(item => {
innerAudioContext[item] = opts[item];
});
return innerAudioContext;
} catch (e) {
console.error('当前版本不支持音频');
}
}
}
/**
* 创建音频实例
* @param {object} opts 配置对象 例 { src: '音频链接', autoplay: false }
*/
export const createAudio = opts => {
const audioInstance = new AudioModel(opts);
return audioInstance;
};
/**
* 获取淘宝用户收货地址
*/
export const getUserAddress = async (opts = {}) => {
let defaults = {
addAddress: 'show',
searchAddress: 'hide',
locateAddress: 'hide',
joinTag: '' // 分割收货地址符号(淘宝商家有特定发货需求)
};
let _opts = Object.assign({}, defaults, opts);
return new Promise((resolve, reject) => {
my.authorize({
scopes: 'scope.addressList',
success: () => {
const { addAddress, searchAddress, locateAddress, joinTag } = _opts;
if (!my.tb.chooseAddress) {
reject({
noSupport: true,
errorMessage: '当前版本不支持选择收货地址,请升级到最新版本'
});
return false;
}
my.tb.chooseAddress(
{
addAddress,
searchAddress,
locateAddress
},
res => {
const { error, provinceName, countyName, cityName, streetName, detailInfo, name, telNumber } = res;
// 如果有error为用户取消操作不做操作
if (error) {
resolve(false);
} else {
resolve({
...res,
duibaAddress: {
name,
phone: telNumber,
address: [provinceName, cityName, countyName, streetName, detailInfo].join(joinTag)
}
});
}
},
res => {
reject(res);
}
);
}
});
});
};
/**
* 选择图片
*/
export const chooseImage = async (opts = {}) => {
let defaults = {
count: 1,
sourceType: ['camera', 'album'],
compressLevel: 1
};
let _opts = Object.assign({}, defaults, opts);
const { count, sourceType, compressLevel } = _opts;
return new Promise((resolve, reject) => {
if (!my.chooseImage) {
reject({
noSupport: true,
errorMessage: '当前版本不支持选择收货地址,请升级到最新版本'
});
return false;
}
my.chooseImage({
count,
sourceType,
success: res => {
my.compressImage({
apFilePaths: res.apFilePaths,
level: compressLevel,
success: data => {
resolve(data);
},
fail: err => {
resolve(err);
}
});
},
fail: err => {
// error code 2001 为摄像头授权取消、ios 11为用户取消操作不认作失败场景 、安卓 为1
if (err.error !== 2001 && err.error !== 11 && err.error !== 1) {
reject(err);
} else {
resolve(false);
}
}
});
});
};
/**
* 获取图片信息
* @param {string} src 图片地址
*/
export const getImageInfo = async src => {
return new Promise((resolve, reject) => {
my.getImageInfo({
src,
success: res => {
resolve(res);
},
fail: err => {
reject(err);
}
});
});
};
/**
* 获取图片信息
* @param {*} opts chooseImage配置参数
*/
export const uploadImage = async (opts = {}) => {
const { cloud } = getApp();
if (!cloud) {
console.error('chattingSendCard: 请传入app.cloud');
return false;
}
const chooseImageResult = await chooseImage(opts).catch(err => {
commonToast(err && (err.errorMessage || '选择图片失败'));
});
if (chooseImageResult) {
const { apFilePaths } = chooseImageResult;
const filePath = apFilePaths[0];
const imageInfo = await getImageInfo(filePath).catch(err => {
commonToast(err && err.errorMessage);
});
// 找不到图片信息
if (!imageInfo) {
return false;
}
const { path: imagePath } = imageInfo;
const { url } = await cloud.file.uploadFile({
filePath,
fileType: 'image',
fileName: imagePath.split('/').pop()
});
return url;
}
return false;
}
/**
* 分享到群聊卡片
* @param {object} requestInfo 分享到群聊卡片所需请求参数
*/
export const chattingSendCard = async (requestInfo) => {
const { cloud } = getApp();
if (!cloud) {
console.error('chattingSendCard: 请传入app.cloud');
return false;
}
if (!requestInfo) {
console.error('chattingSendCard: 请传入卡片请求参数');
return false;
}
return new Promise((resolve, reject) => {
my.authorize({
scopes: 'scope.groupChat',
success: async () => {
const result = await cloud.topApi
.invoke({
api: 'taobao.chatting.platform.message.sendcard',
data: { request_info: JSON.stringify(requestInfo) }
})
.catch(err => {
reject(err);
});
if (result) {
const { error } = result;
if (error) {
resolve(false);
} else {
resolve(result);
}
}
},
fail: err => {
if (err.error === 11) {
// error code 11 为用户取消操作不认作失败场景
resolve(false);
}
reject(err);
}
});
});
};
/**
* 分享到群聊卡片
* @param {*} cloud 小程序云
* @param {object} requestInfo 分享到群聊卡片所需请求参数
*/
export const textRiskIdentification = async (text) => {
return new Promise((resolve, reject) => {
if (!my.tb.textRiskIdentification) {
reject({
noSupport: true,
errorMessage: '不支持文本校验'
});
}
my.tb.textRiskIdentification({
data:{
text
},
success: res => {
if (res.data && res.data.result) {
const { suggestion }= res.data.result;
if (suggestion === 'pass') {
resolve(true);
}
}
resolve(false);
},
fail: err => {
reject(err)
},
})
})
}
\ No newline at end of file
/**
* 通用toast
* @param {string} content toast内容
* @param {number} duration 显示时长
* @param {function} successCb 成功回调
*/
export const commonToast = (content, duration = 3000, successCb) => {
return '暂不支持toast';
};
/**
* 简易alert
* @param {string} content toast内容
*/
export const simpleAlert = content => {
alert(content);
};
/**
* 通用确认弹窗
* @param {string} title 标题
* @param {string} content 内容
* @param {function} successCb 成功回调
*/
export const commonConfirm = (title = '提示', content, successCb) => {
my.confirm({
title,
content,
confirmButtonText: '确定',
cancelButtonText: '取消',
success: result => {
const { confirm } = result;
if (confirm) {
successCb && successCb();
}
}
});
};
/**
* 获取授权用户信息
* @returns {object} 用户登录信息
*/
export const getAuthUserInfo = async () => {
return {
nickName: 'nickName',
avatar: '123',
mixNick: '1234'
};
};
/**
* 获取系统信息
* @returns {object} 小程序系统信息
*/
export const getSystemInfo = async () => {
return {
version: '9.5.0'
};
};
/**
* 执行关注店铺
* @param {number} sellerId 店铺归属的卖家Id
* @returns {boolean} 关注状态
*/
export const favorShop = async sellerId => {
if (!sellerId) {
console.error('favorShop: 请传入卖家Id');
return false;
}
return {};
};
/**
* 判断是否关注店铺
* @param {number} sellerId 店铺归属的卖家Id
* @returns {boolean} 关注状态
*/
export const checkShopFavoredStatus = async sellerId => {
if (!sellerId) {
console.error('checkShopFavoredStatus: 请传入卖家Id');
return false;
}
return true;
};
/**
* 跳转到外部链接
* @param {string} url 跳转链接
*/
export const navigateToOutside = url => {
if (!url) {
console.error('navigateToOutside: 请传入url');
return false;
}
window.location = url;
};
/**
* 跳转到内部链接(新开窗口)
* @param {string} url 跳转链接
*/
export const navigateTo = url => {
if (!url) {
console.error('navigateTo: 请传入url');
return false;
}
window.location = url;
};
/**
* 跳转到内部链接(不新开窗口)
* @param {string} url 跳转链接
*/
export const redirectTo = url => {
if (!url) {
console.error('redirectTo: 请传入url');
return false;
}
window.replace(url);
};
/**
* 获取服务器时间
* @returns {number} 服务器时间戳
*/
export const getServerTime = async () => {
return +new Date();
};
/**
* 收藏商品
* @param {number} 商品id
* @returns {object} 收藏结果
*/
export const collectGoods = async id => {
if (!id) {
console.error('collectGoods: 请传入商品id');
return false;
}
return {};
};
/**
* 查询商品收藏状态
* @param {number} 商品id
* @returns {boolean} 商品收场状态
*/
export const checkGoodsCollectedStatus = async id => {
if (!id) {
console.error('checkGoodsCollectedStatus: 请传入商品id');
return false;
}
return true;
};
/**
* 跳转到淘宝商品页
* @param {string} itemId 商品ID
*/
export const openDetail = async itemId => {
if (!itemId) {
console.error('openDetail: 请传入商品id');
return false;
}
window.location = 'https://item.taobao.com/item.htm?id=' + itemId;
};
/**
* 获取淘宝用户收货地址
*/
export const getUserAddress = async (opts = {}) => {
return {
name: 1,
phone: 1,
address: 123
}
};
/**
* 选择图片
*/
export const chooseImage = async (opts = {}) => {
let defaults = {
count: 1,
sourceType: ['camera', 'album'],
compressLevel: 1
};
let _opts = Object.assign({}, defaults, opts);
const { count, sourceType, compressLevel } = _opts;
return new Promise((resolve, reject) => {
if (!my.chooseImage) {
reject({
noSupport: true,
errorMessage: '当前版本不支持选择收货地址,请升级到最新版本'
});
return false;
}
my.chooseImage({
count,
sourceType,
success: res => {
my.compressImage({
apFilePaths: res.apFilePaths,
level: compressLevel,
success: data => {
resolve(data);
},
fail: err => {
resolve(err);
}
});
},
fail: err => {
// error code 2001 为摄像头授权取消、ios 11为用户取消操作不认作失败场景 、安卓 为1
if (err.error !== 2001 && err.error !== 11 && err.error !== 1) {
reject(err);
} else {
resolve(false);
}
}
});
});
};
/**
* 获取图片信息
* @param {string} src 图片地址
*/
export const getImageInfo = async src => {
return new Promise((resolve, reject) => {
my.getImageInfo({
src,
success: res => {
resolve(res);
},
fail: err => {
reject(err);
}
});
});
};
/**
* 获取图片信息
* @param {*} opts chooseImage配置参数
*/
export const uploadImage = async (opts = {}) => {
const { cloud } = getApp();
if (!cloud) {
console.error('chattingSendCard: 请传入app.cloud');
return false;
}
const chooseImageResult = await chooseImage(opts).catch(err => {
commonToast(err && (err.errorMessage || '选择图片失败'));
});
if (chooseImageResult) {
const { apFilePaths } = chooseImageResult;
const filePath = apFilePaths[0];
const imageInfo = await getImageInfo(filePath).catch(err => {
commonToast(err && err.errorMessage);
});
// 找不到图片信息
if (!imageInfo) {
return false;
}
const { path: imagePath } = imageInfo;
const { url } = await cloud.file.uploadFile({
filePath,
fileType: 'image',
fileName: imagePath.split('/').pop()
});
return url;
}
return false;
}
/**
* 分享到群聊卡片
* @param {object} requestInfo 分享到群聊卡片所需请求参数
*/
export const chattingSendCard = async (requestInfo) => {
alert('无法模拟');
return false;
};
/**
* 分享到群聊卡片
* @param {*} cloud 小程序云
* @param {object} requestInfo 分享到群聊卡片所需请求参数
*/
export const textRiskIdentification = async (text) => {
return true;
}
\ No newline at end of file
import capiFn from './capiFn';
/**
* 时间格式化
* @param date 接收可以被new Date()方法转换的内容
* @param format 字符串,需要的格式例如:'yyyy/MM/dd hh:mm:ss'
* @returns {String}
*/
export const dateFormatter = (date, format = 'yyyy/MM/dd') => {
if (!date) return '-';
date = new Date(
typeof date === 'string' && isNaN(date) ? date.replace(/-/g, '/') : date
);
let o = {
'M+': date.getMonth() + 1,
'd+': date.getDate(),
'h+': date.getHours(),
'm+': date.getMinutes(),
's+': date.getSeconds(),
'q+': Math.floor((date.getMonth() + 3) / 3),
S: date.getMilliseconds()
};
if (/(y+)/.test(format)) {
format = format.replace(
RegExp.$1,
(date.getFullYear() + '').substr(4 - RegExp.$1.length)
);
}
for (let k in o) {
if (new RegExp('(' + k + ')').test(format)) {
format = format.replace(
RegExp.$1,
RegExp.$1.length === 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length)
);
}
}
return format;
};
/**
* 版本比较
* @param {string} cur 当前版本
* @param {string} compare 比较版本
*/
export const versionCompare = (cur, compare) => {
const _cur = cur.split('.');
const _compare = compare.split('.');
if (+_cur[0] < +_compare[0]) {
return false;
} else if ( +_cur[0] === +_compare[0] && +_cur[1] < +_compare[1] ) {
return false;
} else if (+_cur[0] === +_compare[0] && +_cur[1] === +_compare[1] && +_cur[2] < +_compare[2]) {
return false;
}
return true;
};
/**
* 获取request请求所需参数
* @param {object/string} value API项配置
*/
export const getRequestParams = value => {
if (typeof value === 'string') {
return {
handle: value,
method: 'POST',
ext: {}
}
} else if (typeof value === 'object') {
const { handle, method = 'POST', ...ext } = value;
return {
handle,
method,
ext: { ...ext }
}
} else {
console.error('getRequestParams: 传参有误');
}
};
/**
* 生成API
* @param {array} apiList API数据数组
* @param {function} request 请求
*/
export const generateAPI = (apiList, request) => {
const api = {};
Object.entries(apiList).forEach(([key, value]) => {
const { handle, method, ext } = getRequestParams(value);
api[key] = params => request(handle, method, params, ext);
});
api.fn = capiFn(apiList, request);
return api;
};
\ No newline at end of file
{
"cloud": {
"type": "CLOUDAPP"
}
}
{
"cloud": {
"type": "CLOUDAPP"
}
}
{
"templates": [
{
"name": "c_server_ts",
"branch": "c_server_ts",
"tags": [
{
"desc": "通用模板",
"version": "2.0"
}
]
}
]
}
/** @format */
module.exports = {
parser: '@typescript-eslint/parser',
extends: ['prettier/@typescript-eslint', 'plugin:prettier/recommended'],
parserOptions: {
ecmaVersion: 2019,
sourceType: 'module'
},
env: {
browser: true,
node: true
}
}
.tea
.DS_Store
.vscode
debug.log
node_modules
\ No newline at end of file
module.exports = {
"printWidth": 120,
"semi": false,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": true,
"arrowParens": "avoid",
"insertPragma": true,
"tabWidth": 2,
"useTabs": false
};
\ No newline at end of file
# 安装依赖
```bash
yarn
```
# 编译ts代码
```bash
➜ npm start
```
# 启动mockServr
```bash
➜ npm run mock
```
## 库表规范
http://cf.dui88.com/pages/viewpage.action?pageId=63937755
## sdk 接口文档说明
http://cf.dui88.com/pages/viewpage.action?pageId=66194323
{
"runtime": "nodejs8",
"version": "1.0"
}
\ No newline at end of file
/** @format */
interface Iconfig {
generateVipCallBackUrl(activityId?: string): string;
}
export declare const getConfig: (context: IContext<{}>) => Iconfig;
export {};
"use strict";
/** @format */
Object.defineProperty(exports, "__esModule", { value: true });
exports.getConfig = void 0;
var online_1 = require("./online");
var test_1 = require("./test");
var configs = {
online: online_1.default,
test: test_1.default,
mock: test_1.default
};
// 根据服务环境获取配置
exports.getConfig = function (context) {
var env = context.env;
return configs[env] || configs.online;
};
//# sourceMappingURL=index.js.map
\ No newline at end of file
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":";AAAA,cAAc;;;AAEd,mCAA6B;AAC7B,+BAAyB;AAMzB,IAAM,OAAO,GAAG;IACd,MAAM,kBAAA;IACN,IAAI,gBAAA;IACJ,IAAI,EAAE,cAAI;CACX,CAAA;AAED,aAAa;AACA,QAAA,SAAS,GAAG,UAAC,OAAqB;IAC7C,IAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAA;IACvB,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,MAAM,CAAA;AACvC,CAAC,CAAA"}
\ No newline at end of file
/** @format */
declare const _default: {
generateVipCallBackUrl(activityId: string): string;
};
export default _default;
"use strict";
/** @format */
Object.defineProperty(exports, "__esModule", { value: true });
var constants_1 = require("../constants");
exports.default = {
generateVipCallBackUrl: function (activityId) {
return "https://m.duanqu.com/?_ariver_appid=" + constants_1.appId + "&query=activityId%3D" + activityId;
}
};
//# sourceMappingURL=online.js.map
\ No newline at end of file
{"version":3,"file":"online.js","sourceRoot":"","sources":["../../src/config/online.ts"],"names":[],"mappings":";AAAA,cAAc;;AAEd,0CAAoC;AAEpC,kBAAe;IACb,sBAAsB,EAAtB,UAAuB,UAAkB;QACvC,OAAO,yCAAuC,iBAAK,4BAAuB,UAAY,CAAA;IACxF,CAAC;CACF,CAAA"}
\ No newline at end of file
declare const _default: {
generateVipCallBackUrl(): string;
};
/** @format */
export default _default;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/** @format */
exports.default = {
generateVipCallBackUrl: function () {
return "\u5BA2\u6237\u7AEF\u751F\u6210\u7684\u9884\u89C8\u5730\u5740";
}
};
//# sourceMappingURL=test.js.map
\ No newline at end of file
{"version":3,"file":"test.js","sourceRoot":"","sources":["../../src/config/test.ts"],"names":[],"mappings":";;AAAA,cAAc;AACd,kBAAe;IACb,sBAAsB;QACpB,OAAO,8DAAY,CAAA;IACrB,CAAC;CACF,CAAA"}
\ No newline at end of file
/** @format */
export declare const BusinessError: {
ERROR_UPDATE_RETRY: {
code: string;
defaultMsg: string;
};
ERROR_NO_ACTIVITY: {
code: string;
defaultMsg: string;
};
ERROR_ACTIVITY_NOSTART: {
code: string;
defaultMsg: string;
};
ERROR_ACTIVITY_OVER: {
code: string;
defaultMsg: string;
};
ERROR_NO_USER: {
code: string;
defaultMsg: string;
};
ERROR_NO_VIP: {
code: string;
defaultMsg: string;
};
ERROR_TASK_NORECEIVE: {
code: string;
defaultMsg: string;
};
ERROR_TASK_ALREADYRECEIVE: {
code: string;
defaultMsg: string;
};
ERROR_TASK_COMPLETE: {
code: string;
defaultMsg: string;
};
ERROR_INVALID_INVITE_ID: {
code: string;
defaultMsg: string;
};
ERROR_NO_CREDITS: {
code: string;
defaultMsg: string;
};
ERROR_TASK_LIMIT: {
code: string;
defaultMsg: string;
};
ERROR_AREADY_INVITE_SUCCESS: {
code: string;
defaultMsg: string;
};
ERROR_FORBIDDEN_OPE: {
code: string;
defaultMsg: string;
};
ERROR_RECEIVE_PRIZE: {
code: string;
defaultMsg: string;
};
ERROR_SEND_PRIZE: {
code: string;
defaultMsg: string;
};
ERROR_NO_PRIZE: {
code: string;
defaultMsg: string;
};
ERROR_NO_STOCK: {
code: string;
defaultMsg: string;
};
ERROR_PRIZE_EXPIRED: {
code: string;
defaultMsg: string;
};
};
export declare const CODE_TYPES: {
PARAMS_ERROR: import("taobao-mini-sdk/lib/utils/codetypes").CodeType;
SYSTEM_ERROR: import("taobao-mini-sdk/lib/utils/codetypes").CodeType;
SUCCESS: import("taobao-mini-sdk/lib/utils/codetypes").CodeType;
} & {
ERROR_UPDATE_RETRY: {
code: string;
defaultMsg: string;
};
ERROR_NO_ACTIVITY: {
code: string;
defaultMsg: string;
};
ERROR_ACTIVITY_NOSTART: {
code: string;
defaultMsg: string;
};
ERROR_ACTIVITY_OVER: {
code: string;
defaultMsg: string;
};
ERROR_NO_USER: {
code: string;
defaultMsg: string;
};
ERROR_NO_VIP: {
code: string;
defaultMsg: string;
};
ERROR_TASK_NORECEIVE: {
code: string;
defaultMsg: string;
};
ERROR_TASK_ALREADYRECEIVE: {
code: string;
defaultMsg: string;
};
ERROR_TASK_COMPLETE: {
code: string;
defaultMsg: string;
};
ERROR_INVALID_INVITE_ID: {
code: string;
defaultMsg: string;
};
ERROR_NO_CREDITS: {
code: string;
defaultMsg: string;
};
ERROR_TASK_LIMIT: {
code: string;
defaultMsg: string;
};
ERROR_AREADY_INVITE_SUCCESS: {
code: string;
defaultMsg: string;
};
ERROR_FORBIDDEN_OPE: {
code: string;
defaultMsg: string;
};
ERROR_RECEIVE_PRIZE: {
code: string;
defaultMsg: string;
};
ERROR_SEND_PRIZE: {
code: string;
defaultMsg: string;
};
ERROR_NO_PRIZE: {
code: string;
defaultMsg: string;
};
ERROR_NO_STOCK: {
code: string;
defaultMsg: string;
};
ERROR_PRIZE_EXPIRED: {
code: string;
defaultMsg: string;
};
};
export declare const TBERROR: {
USER_PERMISSION_EXCEED_MAX_RIGHT_COUNT_IN_DAY: string;
COUPON_INVALID_OR_DELETED: string;
APPLY_OWNSELF_COUPON: string;
APPLY_SINGLE_COUPON_COUNT_EXCEED_LIMIT: string;
NO_RIGHT_QUANTITY: string;
ERRORA_3_567: string;
'Invalid session': string;
};
export declare const DRAW_STATUS: {
WAITAWARD: number;
PROCESSING: number;
SUCCESS: number;
FAIL: number;
EXPIRED: number;
RETRY: number;
};
export declare const appId = "${\u9700\u8981\u8865\u5145}";
export declare const C_APP_NAME: string;
export declare const TAOBAO_SUCCESS_ORDER_STATUS: string[];
export declare const enum ACTIVITY_STATUS {
NORMAL = 1,
DELETE = 2
}
export declare const enum DELETE_STATUS {
NORMAL = 1,
DELETE = 2
}
export declare const TASK_RATE_TYPE: {
FOREVER: number;
EVERYDAY: number;
NOLIMIT: number;
};
export declare const TASK_STATUS: {
WAIT_DO: number;
WAIT_RECEIVE: number;
DONE: number;
};
export declare const PRIZE_TYPE: {
ENAME: number;
CREDITS: number;
OBJECT: number;
THANKS: number;
};
export declare const PRIZE_DATA_TYPE: {
RANKING: number;
PROBABILITY: number;
};
export declare enum SWICH_TOCK {
LIMIT = 1,
NO_LIMIT = 2
}
"use strict";
/** @format */
Object.defineProperty(exports, "__esModule", { value: true });
exports.SWICH_TOCK = exports.PRIZE_DATA_TYPE = exports.PRIZE_TYPE = exports.TASK_STATUS = exports.TASK_RATE_TYPE = exports.TAOBAO_SUCCESS_ORDER_STATUS = exports.C_APP_NAME = exports.appId = exports.DRAW_STATUS = exports.TBERROR = exports.CODE_TYPES = exports.BusinessError = void 0;
var sdk_1 = require("./sdk");
exports.BusinessError = {
// 更新重试失败(用于并发更新)
ERROR_UPDATE_RETRY: {
code: "210001",
defaultMsg: "\u7CFB\u7EDF\u9519\u8BEF"
},
// 活动不存在
ERROR_NO_ACTIVITY: {
code: "220001",
defaultMsg: "\u6D3B\u52A8\u4E0D\u5B58\u5728"
},
// 活动未开始
ERROR_ACTIVITY_NOSTART: {
code: "220002",
defaultMsg: "\u6D3B\u52A8\u672A\u5F00\u59CB"
},
// 活动已结束
ERROR_ACTIVITY_OVER: {
code: "220003",
defaultMsg: "\u6D3B\u52A8\u5DF2\u7ED3\u675F"
},
// 用户不存在
ERROR_NO_USER: {
code: "310002",
defaultMsg: "\u7528\u6237\u4E0D\u5B58\u5728"
},
// 非店铺会员
ERROR_NO_VIP: {
code: "310003",
defaultMsg: '非店铺会员'
},
// 暂无次数可领取
ERROR_TASK_NORECEIVE: {
code: "430001",
defaultMsg: "\u8BE5\u4EFB\u52A1\u6682\u65E0\u9886\u53D6\u6B21\u6570"
},
// 任务奖励已领取
ERROR_TASK_ALREADYRECEIVE: {
code: "430002",
defaultMsg: "\u4EFB\u52A1\u5956\u52B1\u5DF2\u9886\u53D6"
},
// 任务已完成
ERROR_TASK_COMPLETE: {
code: "430003",
defaultMsg: "\u4EFB\u52A1\u5DF2\u5B8C\u6210"
},
ERROR_INVALID_INVITE_ID: {
code: "430004",
defaultMsg: "\u9080\u8BF7\u7801\u65E0\u6548"
},
ERROR_NO_CREDITS: {
code: "430005",
defaultMsg: "\u4EFB\u52A1\u6240\u9700\u79EF\u5206\u4E0D\u8DB3"
},
ERROR_TASK_LIMIT: {
code: "430006",
defaultMsg: "\u4ECA\u65E5\u8BE5\u4EFB\u52A1\u6B21\u6570\u8D85\u9650"
},
ERROR_AREADY_INVITE_SUCCESS: {
code: "430007",
defaultMsg: "\u5DF2\u7ECF\u6210\u529F\u9080\u8BF7\u8FC7"
},
ERROR_FORBIDDEN_OPE: {
code: "530001",
defaultMsg: "\u975E\u6CD5\u64CD\u4F5C"
},
ERROR_RECEIVE_PRIZE: {
code: "630002",
defaultMsg: "\u5956\u52B1\u5DF2\u9886\u53D6"
},
ERROR_SEND_PRIZE: {
code: "730001",
defaultMsg: "\u53D1\u5956\u5931\u8D25"
},
ERROR_NO_PRIZE: {
code: "730002",
defaultMsg: "\u5956\u54C1\u4E0D\u5B58\u5728"
},
ERROR_NO_STOCK: {
code: "730003",
defaultMsg: "\u5E93\u5B58\u4E0D\u8DB3"
},
ERROR_PRIZE_EXPIRED: {
code: "740001",
defaultMsg: "\u5956\u54C1\u5DF2\u8D85\u8FC7\u9886\u53D6\u65F6\u95F4"
}
};
exports.CODE_TYPES = Object.assign({}, sdk_1.DEFAULT_CODE_TYPES, exports.BusinessError);
// tb 接口返回部分错误
exports.TBERROR = {
USER_PERMISSION_EXCEED_MAX_RIGHT_COUNT_IN_DAY: '今日领取达到上限,明日再来领取哦',
COUPON_INVALID_OR_DELETED: '权益无效或者被删除,请联系商家',
APPLY_OWNSELF_COUPON: '不能领取自己家店铺权益',
APPLY_SINGLE_COUPON_COUNT_EXCEED_LIMIT: '请至卡券包删除无用权益再领取',
NO_RIGHT_QUANTITY: '权益库存不足,请联系商家',
ERRORA_3_567: '领取失败,为风险用户',
'Invalid session': '订购应用已过期,请联系商家处理'
};
// 领取奖品状态
exports.DRAW_STATUS = {
// 待领取
WAITAWARD: 1,
// 处理中
PROCESSING: 2,
// 领取成功
SUCCESS: 3,
// 领取失败
FAIL: 4,
// 已过期
EXPIRED: 5,
// 重新领取
RETRY: 6
};
exports.appId = '${需要补充}';
// C端的APP NAME
exports.C_APP_NAME = "promotioncenter-" + exports.appId;
// 订单状态
exports.TAOBAO_SUCCESS_ORDER_STATUS = [
'WAIT_SELLER_SEND_GOODS',
'SELLER_CONSIGNED_PART',
'WAIT_BUYER_CONFIRM_GOODS',
'TRADE_BUYER_SIGNED',
'TRADE_FINISHED',
'PAID_FORBID_CONSIGN'
];
//任务频率类型常量
exports.TASK_RATE_TYPE = {
FOREVER: 1,
EVERYDAY: 2,
NOLIMIT: 3
};
//任务状态
exports.TASK_STATUS = {
WAIT_DO: 1,
WAIT_RECEIVE: 2,
DONE: 3 // 已完成
};
// 奖品类型
exports.PRIZE_TYPE = {
ENAME: 1,
CREDITS: 2,
OBJECT: 3,
THANKS: 5
};
// 奖品分类
exports.PRIZE_DATA_TYPE = {
RANKING: 1,
PROBABILITY: 2 // 概率
};
// 奖品是否限制库存
var SWICH_TOCK;
(function (SWICH_TOCK) {
SWICH_TOCK[SWICH_TOCK["LIMIT"] = 1] = "LIMIT";
SWICH_TOCK[SWICH_TOCK["NO_LIMIT"] = 2] = "NO_LIMIT";
})(SWICH_TOCK = exports.SWICH_TOCK || (exports.SWICH_TOCK = {}));
//# sourceMappingURL=constants.js.map
\ No newline at end of file
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";AAAA,cAAc;;;AAEd,6BAA0C;AAE7B,QAA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CACX,CAAA;AAED,MAAM;AACO,QAAA,WAAW,GAAG;IACzB,OAAO,EAAE,CAAC;IACV,YAAY,EAAE,CAAC;IACf,IAAI,EAAE,CAAC,CAAC,MAAM;CACf,CAAA;AAED,OAAO;AACM,QAAA,UAAU,GAAG;IACxB,KAAK,EAAE,CAAC;IACR,OAAO,EAAE,CAAC;IACV,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;CACV,CAAA;AAED,OAAO;AACM,QAAA,eAAe,GAAG;IAC7B,OAAO,EAAE,CAAC;IACV,WAAW,EAAE,CAAC,CAAC,KAAK;CACrB,CAAA;AAED,WAAW;AACX,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,6CAAS,CAAA;IACT,mDAAY,CAAA;AACd,CAAC,EAHW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAGrB"}
\ No newline at end of file
/** @format */
import { AwardsService } from '../service';
export interface IPrizeListParams {
activityId: string;
}
export interface IReceiveOjectParams {
activityId: string;
_id: string;
name: string;
phone: string;
province: string;
city: string;
area: string;
addressdetail: string;
}
export interface IReceiveEnameParams {
activityId: string;
_id: string;
}
export default class AwardsController {
/**
* 我的奖品列表
*/
getMyPrizeList(context: IContext<IPrizeListParams>, {}: {}, [awardSer]: [AwardsService]): Promise<IResult<IAwards[]>>;
/**
* 领取实物
*/
receiveObjectPrize(context: IContext<IReceiveOjectParams>, {}: {}, [awardSer]: [AwardsService]): Promise<IResult<boolean>>;
/**
* 权益重新领取
*/
receiveEnamePrize(context: IContext<IReceiveEnameParams>, {}: {}, [awardSer]: [AwardsService]): Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<string | boolean | object | string[] | object[] | number[], false> | import("taobao-mini-sdk/lib/utils/resultmodel").Result<{}, true>>;
/**
* 概率抽奖
*/
drawLotteryPrize(context: IContext<IParams>, { userInfo }: IControllerInfos, [awardSer]: [AwardsService]): Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<string | boolean | object | string[] | object[] | number[], false> | import("taobao-mini-sdk/lib/utils/resultmodel").Result<{
data: {
type: number;
name: string;
};
}, true> | import("taobao-mini-sdk/lib/utils/resultmodel").Result<{
id: any;
type: number;
name: string;
image: string;
}, true>>;
}
"use strict";
/** @format */
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
var decorator_1 = require("../decorator");
var sdk_1 = require("../sdk");
var service_1 = require("../service");
var constants_1 = require("../constants");
var utils_1 = require("../utils");
var AwardsController = /** @class */ (function () {
function AwardsController() {
}
/**
* 我的奖品列表
*/
AwardsController.prototype.getMyPrizeList = function (context, _a, _b) {
var awardSer = _b[0];
return __awaiter(this, void 0, void 0, function () {
var openId, activityId, result;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
openId = context.openId, activityId = context.data.activityId;
return [4 /*yield*/, awardSer.getMyPrizeList({ openId: openId, activityId: activityId })];
case 1:
result = _c.sent();
return [2 /*return*/, sdk_1.resultsModel.success(result)];
}
});
});
};
/**
* 领取实物
*/
AwardsController.prototype.receiveObjectPrize = function (context, _a, _b) {
var awardSer = _b[0];
return __awaiter(this, void 0, void 0, function () {
var _c, province, city, area, addressdetail, _id, name, phone, activityId, result;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
_c = context.data, province = _c.province, city = _c.city, area = _c.area, addressdetail = _c.addressdetail, _id = _c._id, name = _c.name, phone = _c.phone, activityId = _c.activityId;
return [4 /*yield*/, awardSer.recieveObjectPrize(_id, {
activityId: activityId,
province: province,
city: city,
area: area,
addressdetail: addressdetail,
name: name,
phone: phone
})];
case 1:
result = _d.sent();
if (result.code) {
return [2 /*return*/, sdk_1.resultsModel.error(result)];
}
return [2 /*return*/, sdk_1.resultsModel.success(result)];
}
});
});
};
/**
* 权益重新领取
*/
AwardsController.prototype.receiveEnamePrize = function (context, _a, _b) {
var awardSer = _b[0];
return __awaiter(this, void 0, void 0, function () {
var _c, _id, activityId, result;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
_c = context.data, _id = _c._id, activityId = _c.activityId;
return [4 /*yield*/, awardSer.recieveEnamePrize(_id, activityId)
//@ts-ignore
];
case 1:
result = _d.sent();
//@ts-ignore
if (result.code) {
//@ts-ignore
return [2 /*return*/, sdk_1.resultsModel.error(result)];
}
//@ts-ignore
if (result.remark) {
//@ts-ignore
return [2 /*return*/, sdk_1.resultsModel.error(result, result.remark)];
}
return [2 /*return*/, sdk_1.resultsModel.success(result)];
}
});
});
};
/**
* 概率抽奖
*/
AwardsController.prototype.drawLotteryPrize = function (context, _a, _b) {
var userInfo = _a.userInfo;
var awardSer = _b[0];
return __awaiter(this, void 0, void 0, function () {
var openId, _c, activityId, prizeDataType, prizesPool, prize, reduceResult, type, _id, ename, image, name, userNick, record, result;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
openId = context.openId;
_c = context.data, activityId = _c.activityId, prizeDataType = _c.prizeDataType;
return [4 /*yield*/, awardSer.getPrizeConfig({
activityId: activityId,
// 根据需求配置筛选条件
prizeDataType: prizeDataType
})];
case 1:
prizesPool = _d.sent();
utils_1.logger(prizesPool);
return [4 /*yield*/, awardSer.getPrizeByProbability(prizesPool)
// 未找到奖品,降级到谢谢参与
];
case 2:
prize = _d.sent();
// 未找到奖品,降级到谢谢参与
if (!prize) {
return [2 /*return*/, sdk_1.resultsModel.success({
data: {
type: constants_1.PRIZE_TYPE.THANKS,
name: '谢谢参与'
}
})];
}
reduceResult = 1;
if (!(prize.type !== constants_1.PRIZE_TYPE.CREDITS)) return [3 /*break*/, 4];
return [4 /*yield*/, awardSer.reduceStock(prize._id)];
case 3:
reduceResult = _d.sent();
_d.label = 4;
case 4:
// 扣库存失败
if (reduceResult.code)
return [2 /*return*/, sdk_1.resultsModel.error(reduceResult)];
type = prize.type, _id = prize._id, ename = prize.ename, image = prize.image, name = prize.name;
userNick = userInfo.userNick;
record = {
openId: openId,
prizeId: _id,
activityId: activityId,
drawStatus: constants_1.DRAW_STATUS.WAITAWARD,
prizeDataType: prizeDataType,
remark: '',
type: type,
ename: ename,
name: name,
image: image,
userNick: userNick,
createDay: utils_1.getToday()
};
return [4 /*yield*/, awardSer.addAward(record)];
case 5:
result = _d.sent();
return [2 /*return*/, sdk_1.resultsModel.success({
id: result,
type: type,
name: name,
image: image
})];
}
});
});
};
__decorate([
decorator_1.paramsCheck(['activityId']),
decorator_1.userCheck({ intercept: true }),
decorator_1.services([service_1.AwardsService]),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object, Array]),
__metadata("design:returntype", Promise)
], AwardsController.prototype, "getMyPrizeList", null);
__decorate([
decorator_1.paramsCheck(['activityId', '_id', 'name', 'phone', 'province', 'city', 'area', 'addressdetail']),
decorator_1.userCheck({ intercept: true }),
decorator_1.services([service_1.AwardsService]),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object, Array]),
__metadata("design:returntype", Promise)
], AwardsController.prototype, "receiveObjectPrize", null);
__decorate([
decorator_1.paramsCheck(['activityId', '_id']),
decorator_1.userCheck({ intercept: true }),
decorator_1.services([service_1.AwardsService]),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object, Array]),
__metadata("design:returntype", Promise)
], AwardsController.prototype, "receiveEnamePrize", null);
__decorate([
decorator_1.paramsCheck(['activityId', 'prizeDataType']),
decorator_1.activityTimeCheck,
decorator_1.services([service_1.AwardsService]),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object, Array]),
__metadata("design:returntype", Promise)
], AwardsController.prototype, "drawLotteryPrize", null);
return AwardsController;
}());
exports.default = AwardsController;
//# sourceMappingURL=awards.controller.js.map
\ No newline at end of file
{"version":3,"file":"awards.controller.js","sourceRoot":"","sources":["../../src/controller/awards.controller.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEd,0CAAkF;AAClF,8BAAqC;AACrC,sCAA0C;AAC1C,0CAAuE;AACvE,kCAA2C;AAuB3C;IAAA;IA6IA,CAAC;IA5IC;;OAEG;IAIG,yCAAc,GAApB,UACE,OAAmC,EACnC,EAAE,EACF,EAA2B;YAA1B,QAAQ,QAAA;;;;;;wBAGP,MAAM,GAEJ,OAAO,OAFH,EACE,UAAU,GAChB,OAAO,gBADS,CACT;wBACE,qBAAM,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,QAAA,EAAE,UAAU,YAAA,EAAE,CAAC,EAAA;;wBAA9D,MAAM,GAAG,SAAqD;wBAClE,sBAAO,kBAAY,CAAC,OAAO,CAAC,MAAM,CAAC,EAAA;;;;KACpC;IAED;;OAEG;IAIG,6CAAkB,GAAxB,UACE,OAAsC,EACtC,EAAE,EACF,EAA2B;YAA1B,QAAQ,QAAA;;;;;;wBAEL,KAAwE,OAAO,CAAC,IAAI,EAAlF,QAAQ,cAAA,EAAE,IAAI,UAAA,EAAE,IAAI,UAAA,EAAE,aAAa,mBAAA,EAAE,GAAG,SAAA,EAAE,IAAI,UAAA,EAAE,KAAK,WAAA,EAAE,UAAU,gBAAA,CAAiB;wBAE3E,qBAAM,QAAQ,CAAC,kBAAkB,CAAC,GAAG,EAAE;gCAClD,UAAU,YAAA;gCACV,QAAQ,UAAA;gCACR,IAAI,MAAA;gCACJ,IAAI,MAAA;gCACJ,aAAa,eAAA;gCACb,IAAI,MAAA;gCACJ,KAAK,OAAA;6BACN,CAAC,EAAA;;wBARE,MAAM,GAAG,SAQX;wBAEF,IAAK,MAAmB,CAAC,IAAI,EAAE;4BAC7B,sBAAO,kBAAY,CAAC,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V,IAAI,MAAA;gCACJ,IAAI,MAAA;gCACJ,KAAK,OAAA;6BACN,CAAC,EAAA;;;;KACH;IArID;QAHC,uBAAW,CAAC,CAAC,YAAY,CAAC,CAAC;QAC3B,qBAAS,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;QAC9B,oBAAQ,CAAC,CAAC,uBAAa,CAAC,CAAC;;;;0DAYzB;IAQD;QAHC,uBAAW,CAAC,CAAC,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,CAAC,CAAC;QAChG,qBAAS,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;QAC9B,oBAAQ,CAAC,CAAC,uBAAa,CAAC,CAAC;;;;8DAsBzB;IAQD;QAHC,uBAAW,CAAC,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;QAClC,qBAAS,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;QAC9B,oBAAQ,CAAC,CAAC,uBAAa,CAAC,CAAC;;;;6DAgBzB;IAQD;QAHC,uBAAW,CAAC,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC;QAC5C,6BAAiB;QACjB,oBAAQ,CAAC,CAAC,uBAAa,CAAC,CAAC;;;;4DA+DzB;IACH,uBAAC;CAAA,AA7ID,IA6IC;kBA7IoB,gBAAgB"}
\ No newline at end of file
/** @format */
import { BaseService } from '../service';
export default class BaseController {
/**
* 活动基本信息
*/
getActivityBaseInfoById(context: IContext<{
activityId: string;
}>, {}: {}, [baseService]: [BaseService]): Promise<IResult<IActivityInfo>>;
/**
* 获取商品列表
*/
getItemListByItemIds(context: IContext<{
itemIds: string;
}>, { session }: IControllerInfos, [baseService]: [BaseService]): Promise<IResult<ITaoBaoItems[]>>;
}
"use strict";
/** @format */
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
var constants_1 = require("./../constants");
var decorator_1 = require("../decorator");
var sdk_1 = require("../sdk");
var service_1 = require("../service");
var BaseController = /** @class */ (function () {
function BaseController() {
}
/**
* 活动基本信息
*/
BaseController.prototype.getActivityBaseInfoById = function (context, _a, _b) {
var baseService = _b[0];
return __awaiter(this, void 0, void 0, function () {
var activityId, activityInfo;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
activityId = context.data.activityId;
// 参数校验
if (!activityId) {
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.PARAMS_ERROR, "activityId\u5FC5\u586B")];
}
return [4 /*yield*/, baseService.getBaseInfo(activityId)];
case 1:
activityInfo = _c.sent();
return [2 /*return*/, sdk_1.resultsModel.success(activityInfo)];
}
});
});
};
/**
* 获取商品列表
*/
BaseController.prototype.getItemListByItemIds = function (context, _a, _b) {
var session = _a.session;
var baseService = _b[0];
return __awaiter(this, void 0, void 0, function () {
var itemIds, list;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
itemIds = context.data.itemIds;
return [4 /*yield*/, baseService.getItemListByIds(itemIds, session)];
case 1:
list = _c.sent();
return [2 /*return*/, sdk_1.resultsModel.success(list)];
}
});
});
};
__decorate([
decorator_1.paramsCheck(['activityId']),
decorator_1.services([service_1.BaseService]),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object, Array]),
__metadata("design:returntype", Promise)
], BaseController.prototype, "getActivityBaseInfoById", null);
__decorate([
decorator_1.paramsCheck(['itemIds']),
decorator_1.services([service_1.BaseService]),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object, Array]),
__metadata("design:returntype", Promise)
], BaseController.prototype, "getItemListByItemIds", null);
return BaseController;
}());
exports.default = BaseController;
//# sourceMappingURL=base.controller.js.map
\ No newline at end of file
{"version":3,"file":"base.controller.js","sourceRoot":"","sources":["../../src/controller/base.controller.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEd,4CAA2C;AAC3C,0CAAoD;AAEpD,8BAAqC;AAErC,sCAAwC;AACxC;IAAA;IAuCA,CAAC;IAtCC;;OAEG;IAGG,gDAAuB,GAA7B,UACE,OAEE,EACF,EAAE,EACF,EAA4B;YAA3B,WAAW,QAAA;;;;;;wBAEJ,UAAU,GAAK,OAAO,CAAC,IAAI,WAAjB,CAAiB;wBACnC,OAAO;wBACP,IAAI,CAAC,UAAU,EAAE;4BACf,sBAAO,kBAAY,CAAC,KAAK,CAAC,sBAAU,CAAC,YAAY,EAAE,wBAAc,CAAC,EAAA;yBACnE;wBAEoB,qBAAM,WAAW,CAAC,WAAW,CAAC,UAAU,CAAC,EAAA;;wBAAxD,YAAY,GAAG,SAAyC;wBAC9D,sBAAO,kBAAY,CAAC,OAAO,CAAC,YAAY,CAAC,EAAA;;;;KAC1C;IAED;;OAEG;IAGG,6CAAoB,GAA1B,UACE,OAAsC,EACtC,EAA6B,EAC7B,EAA4B;YAD1B,OAAO,aAAA;YACR,WAAW,QAAA;;;;;;wBAEJ,OAAO,GAAK,OAAO,CAAC,IAAI,QAAjB,CAAiB;wBAEnB,qBAAM,WAAW,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,EAAA;;wBAA3D,IAAI,GAAG,SAAoD;wBAEjE,sBAAO,kBAAY,CAAC,OAAO,CAAC,IAAI,CAAC,EAAA;;;;KAClC;IAhCD;QAFC,uBAAW,CAAC,CAAC,YAAY,CAAC,CAAC;QAC3B,oBAAQ,CAAC,CAAC,qBAAW,CAAC,CAAC;;;;iEAgBvB;IAOD;QAFC,uBAAW,CAAC,CAAC,SAAS,CAAC,CAAC;QACxB,oBAAQ,CAAC,CAAC,qBAAW,CAAC,CAAC;;;;8DAWvB;IACH,qBAAC;CAAA,AAvCD,IAuCC;kBAvCoB,cAAc"}
\ No newline at end of file
export declare const getGameInfo: any;
export declare const doLike: any;
export declare const getGamePrize: any;
export declare const getEntryStatus: any;
export declare const getSurpriseVideo: any;
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSurpriseVideo = exports.getEntryStatus = exports.getGamePrize = exports.doLike = exports.getGameInfo = void 0;
var decorator_1 = require("../decorator");
var sdk_1 = require("../sdk");
var constants_1 = require("../constants");
var service_1 = require("../service");
var utils_1 = require("../utils");
var resultsModel = new sdk_1.ResultsModel();
exports.getGameInfo = decorator_1.decorators([
decorator_1.paramsCheck(['activityId']),
decorator_1.userCheck({ intercept: true }),
decorator_1.vipCheck({ intercept: false })
], [service_1.UserService, service_1.AccessService, service_1.RecordService, service_1.AwardsService])(function (context, _a, _b) {
var userInfo = _a.userInfo, vipInfo = _a.vipInfo;
var userService = _b[0], accessService = _b[1], recordService = _b[2], awardsService = _b[3];
return __awaiter(void 0, void 0, void 0, function () {
var openId, activityId, remainLikes, doLikeCount, orderGoods, _id, hasShowedModal, game2unLockSurpriseClicked, game2NeedBuyTotal, game2StartTime, allNeedLikeTotal, queryTime, done, orderResult, targetOrders, i, order, hasUserGame2Buy, game2unLock, accessTimes, allLikedTotal, isShowModal, myPrizesRecord, has1Prize, has2Prize, has3Prize, has4Prize, has5Prize, prizesDataTypeReceived, game2BuyedTotal, now, today, mockData, likedToday, allLikedTotalString;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
openId = context.openId, activityId = context.data.activityId;
remainLikes = userInfo.remainLikes, doLikeCount = userInfo.doLikeCount, orderGoods = userInfo.orderGoods, _id = userInfo._id, hasShowedModal = userInfo.hasShowedModal, game2unLockSurpriseClicked = userInfo.game2unLockSurpriseClicked;
game2NeedBuyTotal = constants_1.GAME_INFO_CONFIG.game2NeedBuyTotal, game2StartTime = constants_1.GAME_INFO_CONFIG.game2StartTime, allNeedLikeTotal = constants_1.GAME_INFO_CONFIG.allNeedLikeTotal;
queryTime = orderGoods.queryTime, done = orderGoods.done;
if (!!done) return [3 /*break*/, 7];
return [4 /*yield*/, utils_1.getUserOrderlist(context, queryTime || Date.now())];
case 1:
orderResult = _c.sent();
if (!orderResult.some(function (v) { return constants_1.TASK_GOODS_ID.includes(v.itemId); })) return [3 /*break*/, 5];
orderGoods.remainTimes = constants_1.TASK_REWARDS.orderGoods;
orderGoods.done = true;
orderGoods.queryTime = Date.now();
targetOrders = orderResult.filter(function (v) {
return constants_1.TASK_GOODS_ID.includes(v.itemId);
});
i = 0;
_c.label = 2;
case 2:
if (!(i < targetOrders.length)) return [3 /*break*/, 5];
order = targetOrders[i];
return [4 /*yield*/, recordService.addRecord(constants_1.RECORD_TYPE.BUY_ORDER.type, __assign({}, order))];
case 3:
_c.sent();
_c.label = 4;
case 4:
i++;
return [3 /*break*/, 2];
case 5: return [4 /*yield*/, userService.updateUser(_id, {
orderGoods: orderGoods
})];
case 6:
_c.sent();
_c.label = 7;
case 7:
hasUserGame2Buy = !!orderGoods.done;
game2unLock = new Date(game2StartTime).getTime() <= Date.now();
return [4 /*yield*/, accessService.getAccessCount()];
case 8:
accessTimes = _c.sent();
return [4 /*yield*/, recordService.getLikeTotal()];
case 9:
allLikedTotal = _c.sent();
isShowModal = hasShowedModal ? false : accessTimes <= 1;
return [4 /*yield*/, userService.updateUser(_id, {
hasShowedModal: true
})];
case 10:
_c.sent();
return [4 /*yield*/, recordService.getGamePrizeRecordDetail()];
case 11:
myPrizesRecord = _c.sent();
console.log(myPrizesRecord, 'myPrizes');
has1Prize = myPrizesRecord.some(function (v) { return v.prizeDataType === constants_1.DO_LIKE_PRIZE_DATA_TYPE.DO_LIKE_1; });
has2Prize = myPrizesRecord.some(function (v) { return v.prizeDataType === constants_1.DO_LIKE_PRIZE_DATA_TYPE.DO_LIKE_2; });
has3Prize = myPrizesRecord.some(function (v) { return v.prizeDataType === constants_1.DO_LIKE_PRIZE_DATA_TYPE.DO_LIKE_3; });
has4Prize = myPrizesRecord.some(function (v) { return v.prizeDataType === constants_1.DO_LIKE_PRIZE_DATA_TYPE.GAME_2; });
has5Prize = myPrizesRecord.some(function (v) { return v.prizeDataType === constants_1.DO_LIKE_PRIZE_DATA_TYPE.GAME_DONE; });
prizesDataTypeReceived = [];
has1Prize && prizesDataTypeReceived.push(constants_1.DO_LIKE_PRIZE_DATA_TYPE.DO_LIKE_1);
has2Prize && prizesDataTypeReceived.push(constants_1.DO_LIKE_PRIZE_DATA_TYPE.DO_LIKE_2);
has3Prize && prizesDataTypeReceived.push(constants_1.DO_LIKE_PRIZE_DATA_TYPE.DO_LIKE_3);
has4Prize && prizesDataTypeReceived.push(constants_1.DO_LIKE_PRIZE_DATA_TYPE.GAME_2);
has5Prize && prizesDataTypeReceived.push(constants_1.DO_LIKE_PRIZE_DATA_TYPE.GAME_DONE);
return [4 /*yield*/, userService.getBuyedCount()];
case 12:
game2BuyedTotal = _c.sent();
now = Date.now();
today = utils_1.getToday();
if (!constants_1.MOCK_LIKE_DATA[today]) return [3 /*break*/, 14];
mockData = constants_1.MOCK_LIKE_DATA[today];
if (!(allLikedTotal < mockData.count)) return [3 /*break*/, 14];
return [4 /*yield*/, recordService.getLikeByDay(today)];
case 13:
likedToday = _c.sent();
allLikedTotal = mockData.count + likedToday;
_c.label = 14;
case 14:
allLikedTotal = 12600000;
allLikedTotalString = allLikedTotal;
if (allLikedTotal >= 10000 && allLikedTotal <= 12500000) {
allLikedTotalString = (allLikedTotal / 10000).toFixed(1) + "\u4E07";
console.log(allLikedTotalString);
}
console.log(allLikedTotal, allNeedLikeTotal);
return [2 /*return*/, resultsModel.success({
isShowModal: isShowModal,
remainLikes: remainLikes,
myLikedTotal: 100,
// myLikedTotal: doLikeCount,
// allLikedTotal: 126000,
allLikedTotal: allLikedTotalString,
likePercent: (allLikedTotal / allNeedLikeTotal).toFixed(2),
// likePercent: '100.00',
allNeedLikeTotal: "1260\u4E07",
game2NeedBuyTotal: game2NeedBuyTotal,
game2BuyedTotal: 1000,
// game2BuyedTotal,
game2unLock: game2unLock,
game2unLockSurpriseClicked: !!game2unLockSurpriseClicked,
hasUserGame2Buy: hasUserGame2Buy,
prizesDataTypeReceived: prizesDataTypeReceived,
taskGoodsUrl: constants_1.TASK_GOODS_LINK
})];
}
});
});
});
exports.doLike = decorator_1.decorators([decorator_1.paramsCheck(['activityId']), decorator_1.actvityTimeCheck, decorator_1.vipCheck({ intercept: true }), decorator_1.userCheck({ intercept: true })], [service_1.UserService, service_1.RecordService])(function (context, _a, _b) {
var userInfo = _a.userInfo;
var userService = _b[0], recordService = _b[1];
return __awaiter(void 0, void 0, void 0, function () {
var remainLikes, doLikeCount, _id, error_1;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
remainLikes = userInfo.remainLikes, doLikeCount = userInfo.doLikeCount, _id = userInfo._id;
if (remainLikes <= 0)
return [2 /*return*/, resultsModel.error(constants_1.CODE_TYPES.ERROR_NO_LIKE_COUNT)];
remainLikes -= 1;
doLikeCount += 1;
_c.label = 1;
case 1:
_c.trys.push([1, 4, , 5]);
return [4 /*yield*/, userService.updateUser(_id, {
remainLikes: remainLikes,
doLikeCount: doLikeCount
})];
case 2:
_c.sent();
return [4 /*yield*/, recordService.addDoLikeRecord()];
case 3:
_c.sent();
return [2 /*return*/, resultsModel.success(true)];
case 4:
error_1 = _c.sent();
return [2 /*return*/, resultsModel.error(constants_1.CODE_TYPES.SYSTEM_ERROR)];
case 5: return [2 /*return*/];
}
});
});
});
exports.getGamePrize = decorator_1.decorators([decorator_1.paramsCheck(['activityId', 'prizeDataType']), decorator_1.vipCheck({ intercept: true }), decorator_1.userCheck({ intercept: true })], [service_1.AwardsService, service_1.UserService, service_1.RecordService])(function (context, _a, _b) {
var userInfo = _a.userInfo;
var awardsService = _b[0], userService = _b[1], recordService = _b[2];
return __awaiter(void 0, void 0, void 0, function () {
var _c, prizeDataType, activityId, openId, myPrize, orderGoods, queryTime, done, orderResult, targetOrders, i, order, fileId, videoResult, videoResult, prize, stockResult, type, _id, ename, name, image, link, record, result, videoUrl, videoResult;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
_c = context.data, prizeDataType = _c.prizeDataType, activityId = _c.activityId, openId = context.openId;
return [4 /*yield*/, awardsService.getMyPrizeByPrizeDataType(prizeDataType)];
case 1:
myPrize = _d.sent();
if (myPrize)
return [2 /*return*/, resultsModel.error(constants_1.CODE_TYPES.ERROR_RECEIVE_PRIZE)];
orderGoods = userInfo.orderGoods;
queryTime = orderGoods.queryTime, done = orderGoods.done;
if (!!done) return [3 /*break*/, 6];
return [4 /*yield*/, utils_1.getUserOrderlist(context, queryTime || Date.now())];
case 2:
orderResult = _d.sent();
if (!orderResult.some(function (v) { return constants_1.TASK_GOODS_ID.includes(v.itemId); })) return [3 /*break*/, 6];
orderGoods.remainTimes = constants_1.TASK_REWARDS.orderGoods;
orderGoods.done = true;
orderGoods.queryTime = Date.now();
targetOrders = orderResult.filter(function (v) {
return constants_1.TASK_GOODS_ID.includes(v.itemId);
});
i = 0;
_d.label = 3;
case 3:
if (!(i < targetOrders.length)) return [3 /*break*/, 6];
order = targetOrders[i];
return [4 /*yield*/, recordService.addRecord(constants_1.RECORD_TYPE.BUY_ORDER.type, __assign({}, order))];
case 4:
_d.sent();
_d.label = 5;
case 5:
i++;
return [3 /*break*/, 3];
case 6:
fileId = '';
// if (prizeDataType === 1) {
// fileId = 'cloud://D6E2B4EC65A0F5BDBF11DBFAB70F5FA1//proccess2.mov';
// }
if (prizeDataType === constants_1.DO_LIKE_PRIZE_DATA_TYPE.DO_LIKE_2) {
fileId = 'cloud://0D5CEE8D0E5FC4DCB24BE7ED842E6156//proccess2.mov';
}
if (prizeDataType === constants_1.DO_LIKE_PRIZE_DATA_TYPE.DO_LIKE_3) {
fileId = 'cloud://3637723FA51F6458FC4889C3EF5A2DB1//process3.mov';
}
if (prizeDataType === constants_1.DO_LIKE_PRIZE_DATA_TYPE.GAME_2) {
fileId = 'cloud://F45A0E181799E0DF032C34ADF999C2C7//buylimit.mov';
}
if (!(prizeDataType === constants_1.DO_LIKE_PRIZE_DATA_TYPE.GAME_DONE)) return [3 /*break*/, 9];
fileId = 'cloud://65B8CD97FE1802355CCFE2721F996B09//game2_done.mov';
return [4 /*yield*/, context.cloud.file.getTempFileURL({ fileId: fileId })];
case 7:
videoResult = _d.sent();
return [4 /*yield*/, recordService.addRecord(constants_1.RECORD_TYPE.GAME_PRIZE, {
prizeDataType: prizeDataType
})];
case 8:
_d.sent();
return [2 /*return*/, resultsModel.success({
videoUrl: videoResult && videoResult.length && videoResult[0].url
})];
case 9:
if (!(prizeDataType === constants_1.DO_LIKE_PRIZE_DATA_TYPE.GAME_2 && !orderGoods.done)) return [3 /*break*/, 12];
return [4 /*yield*/, context.cloud.file.getTempFileURL({ fileId: fileId })];
case 10:
videoResult = _d.sent();
return [4 /*yield*/, recordService.addRecord(constants_1.RECORD_TYPE.GAME_PRIZE, {
prizeDataType: prizeDataType
})];
case 11:
_d.sent();
return [2 /*return*/, resultsModel.success({
videoUrl: videoResult && videoResult.length && videoResult[0].url
})];
case 12: return [4 /*yield*/, awardsService.getGamePrize(prizeDataType)];
case 13:
prize = _d.sent();
return [4 /*yield*/, awardsService.reduceStock(prize._id)];
case 14:
stockResult = _d.sent();
if (!(stockResult !== true)) return [3 /*break*/, 15];
return [2 /*return*/, resultsModel.error(stockResult)];
case 15: return [4 /*yield*/, recordService.addRecord(constants_1.RECORD_TYPE.GAME_PRIZE, {
prizeDataType: prizeDataType
})];
case 16:
_d.sent();
_d.label = 17;
case 17:
type = prize.type, _id = prize._id, ename = prize.ename, name = prize.name, image = prize.image, link = prize.link;
record = {
openId: openId,
prizeId: _id,
activityId: activityId,
drawStatus: constants_1.DRAW_STATUS.WAITAWARD,
prizeDataType: prizeDataType,
remark: '',
type: type,
ename: ename,
name: name,
image: image,
link: link,
userNick: userInfo.userNick,
createDay: utils_1.getToday()
};
return [4 /*yield*/, awardsService.addAward(record)];
case 18:
result = _d.sent();
return [4 /*yield*/, userService.updateUser(userInfo._id, {
orderGoods: orderGoods
})];
case 19:
_d.sent();
videoUrl = '';
if (!fileId) return [3 /*break*/, 21];
return [4 /*yield*/, context.cloud.file.getTempFileURL({ fileId: fileId })];
case 20:
videoResult = _d.sent();
videoUrl = videoResult && videoResult.length && videoResult[0].url;
_d.label = 21;
case 21: return [2 /*return*/, resultsModel.success({
_id: result,
type: type,
name: name,
image: image,
videoUrl: videoUrl
})];
}
});
});
});
exports.getEntryStatus = decorator_1.decorators([])(function () { return __awaiter(void 0, void 0, void 0, function () {
var openTime;
return __generator(this, function (_a) {
openTime = new Date(constants_1.ACTIVITY_ENTRY_TIME).getTime();
return [2 /*return*/, resultsModel.success({
isOpen: Date.now() >= openTime
})];
});
}); });
exports.getSurpriseVideo = decorator_1.decorators([])(function (context) { return __awaiter(void 0, void 0, void 0, function () {
var videoResult;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, context.cloud.file.getTempFileURL({ fileId: 'cloud://65B8CD97FE1802355CCFE2721F996B09//game2_done.mov' })];
case 1:
videoResult = _a.sent();
return [2 /*return*/, resultsModel.success({
videoUrl: videoResult && videoResult.length && videoResult[0].url
})];
}
});
}); });
//# sourceMappingURL=game.controller.js.map
\ No newline at end of file
{"version":3,"file":"game.controller.js","sourceRoot":"","sources":["../../src/controller/game.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAAgG;AAEhG,8BAAqC;AACrC,0CAAiM;AACjM,sCAAsF;AACtF,kCAAqD;AACrD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K,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,MAAM,EAAG,0DAA0D,EAAE,CAAC,EAAA;;gBAA9H,WAAW,GAAG,SAAgH;gBAIpI,sBAAO,YAAY,CAAC,OAAO,CAAC;wBAC1B,QAAQ,EAAE,WAAW,IAAI,WAAW,CAAC,MAAM,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG;qBAClE,CAAC,EAAA;;;KAEH,CAAC,CAAA"}
\ No newline at end of file
export declare const doRecord: any;
export declare const doClickSurpriseBtn: any;
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.doClickSurpriseBtn = exports.doRecord = void 0;
var decorator_1 = require("../decorator");
var sdk_1 = require("../sdk");
var constants_1 = require("../constants");
var service_1 = require("../service");
var resultsModel = new sdk_1.ResultsModel();
exports.doRecord = decorator_1.decorators([
decorator_1.paramsCheck(['activityId', 'type']),
decorator_1.actvityTimeCheck,
decorator_1.userCheck({ intercept: true })
], [service_1.RecordService])(function (context, _a, _b) {
var recordService = _b[0];
return __awaiter(void 0, void 0, void 0, function () {
var type, mapper;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
type = context.data.type;
mapper = {
// 点击分享
share: constants_1.RECORD_TYPE.SHARE,
// 点击助力
help: constants_1.RECORD_TYPE.ClICK_HELP,
// 点击任务按钮
task: constants_1.RECORD_TYPE.CLICK_TASK,
// 点击挑战2按钮
game2: constants_1.RECORD_TYPE.GAME2,
// 点击立即购买按钮
clickGoods: constants_1.RECORD_TYPE.ORDER_TASK
};
if (!mapper[type]) return [3 /*break*/, 2];
return [4 /*yield*/, recordService.addRecord(mapper[type])];
case 1:
_c.sent();
_c.label = 2;
case 2: return [2 /*return*/, resultsModel.success(true)];
}
});
});
});
exports.doClickSurpriseBtn = decorator_1.decorators([
decorator_1.paramsCheck(['activityId']),
decorator_1.actvityTimeCheck,
decorator_1.userCheck({ intercept: true })
], [service_1.UserService])(function (context, _a, _b) {
var userInfo = _a.userInfo;
var userService = _b[0];
return __awaiter(void 0, void 0, void 0, function () {
var _id;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
_id = userInfo._id;
return [4 /*yield*/, userService.updateUser(_id, {
game2unLockSurpriseClicked: true
})];
case 1:
_c.sent();
return [2 /*return*/, resultsModel.success(true)];
}
});
});
});
//# sourceMappingURL=record.controller.js.map
\ No newline at end of file
{"version":3,"file":"record.controller.js","sourceRoot":"","sources":["../../src/controller/record.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAAqF;AAErF,8BAAqC;AACrC,0CAA0C;AAC1C,sCAAuD;AAEvD,IAAM,YAAY,GAAG,IAAI,kBAAY,EAAE,CAAC;AAG3B,QAAA,QAAQ,GAAG,sBAAU,CAChC;IACE,uBAAW,CAAC,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IACnC,4BAAgB;IAChB,qBAAS,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;CAC/B,EACD,CAAE,uBAAa,CAAE,CAClB,CAAC,UAAO,OAAgB,EAAE,EAAE,EAAE,EAAqC;QAAnC,aAAa,QAAA;;;;;;oBAEpC,IAAI,GAAK,OAAO,CAAC,IAAI,KAAjB,CAAkB;oBAExB,MAAM,GAAG;wBACb,OAAO;wBACP,KAAK,EAAE,uBAAW,CAAC,KAAK;wBACxB,OAAO;wBACP,IAAI,EAAE,uBAAW,CAAC,UAAU;wBAC5B,SAAS;wBACT,IAAI,EAAE,uBAAW,CAAC,UAAU;wBAC5B,UAAU;wBACV,KAAK,EAAE,uBAAW,CAAC,KAAK;wBACxB,WAAW;wBACX,UAAU,EAAE,uBAAW,CAAC,UAAU;qBACnC,CAAA;yBAEE,MAAM,CAAC,IAAI,CAAC,EAAZ,wBAAY;oBACb,qBAAM,aAAa,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAA;;oBAA3C,SAA2C,CAAA;;wBAG7C,sBAAO,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,EAAA;;;;CAElC,CAAC,CAAA;AAGW,QAAA,kBAAkB,GAAG,sBAAU,CAC1C;IACE,uBAAW,CAAC,CAAC,YAAY,CAAC,CAAC;IAC3B,4BAAgB;IAChB,qBAAS,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;CAC/B,EACD,CAAE,qBAAW,CAAE,CAChB,CAAC,UAAO,OAAgB,EAAE,EAAY,EAAE,EAAiC;QAA7C,QAAQ,cAAA;QAAM,WAAW,QAAA;;;;;;oBAE5C,GAAG,GAAK,QAAQ,IAAb,CAAc;oBAEzB,qBAAM,WAAW,CAAC,UAAU,CAAC,GAAG,EAAE;4BAChC,0BAA0B,EAAE,IAAI;yBACjC,CAAC,EAAA;;oBAFF,SAEE,CAAA;oBAEF,sBAAO,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,EAAA;;;;CAElC,CAAC,CAAA"}
\ No newline at end of file
/** @format */
import { UserService, AccessService, TaskService } from '../service';
export default class Share {
/**
* 完成分享
*/
doHelp(context: IContext<IParams>, { userInfo, vipInfo, activityInfo }: IControllerInfos, [userService, taskService, accessService]: [UserService, TaskService, AccessService]): Promise<IResult<boolean>>;
}
"use strict";
/** @format */
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
var constants_1 = require("./../constants");
var check_1 = require("../decorator/check");
var services_1 = require("../decorator/services");
var sdk_1 = require("../sdk");
var utils_1 = require("../utils");
var service_1 = require("../service");
var Share = /** @class */ (function () {
function Share() {
}
/**
* 完成分享
*/
Share.prototype.doHelp = function (context, _a, _b) {
var userInfo = _a.userInfo, vipInfo = _a.vipInfo, activityInfo = _a.activityInfo;
var userService = _b[0], taskService = _b[1], accessService = _b[2];
return __awaiter(this, void 0, void 0, function () {
var inviteId, openId, inviteUserInfo, inviteCompleteList, tasks, value, isNewVip, isValidShare, today, inviteUserId;
var _c;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
inviteId = context.data.inviteId;
openId = context.openId;
return [4 /*yield*/, userService.getUserInfoByOpenId(inviteId)
// inviteId的用户信息查询不到, 则inviteId无效
];
case 1:
inviteUserInfo = _d.sent();
// inviteId的用户信息查询不到, 则inviteId无效
if (!inviteUserInfo)
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.ERROR_INVALID_INVITE_ID)];
inviteCompleteList = taskService.getCompleteTaskByUserTaskInfo('invites', inviteUserInfo);
// 邀请成功列表有该用户信息
if (inviteCompleteList.some(function (v) { return v.openId === openId; })) {
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.ERROR_AREADY_INVITE_SUCCESS)];
}
tasks = activityInfo.tasks;
value = (tasks || {}).inviteFriends.value;
isNewVip = userService.checkNewVipStatus(userInfo, vipInfo);
isValidShare = [isNewVip].every(function (v) { return !!v; });
today = utils_1.getToday();
if (!isValidShare) return [3 /*break*/, 3];
inviteUserId = inviteUserInfo._id;
// 增加邀请人的待领取次数和邀请记录
return [4 /*yield*/, userService.updateUser(inviteUserId, {
$inc: {
'remainTimes.invites': value
},
$push: (_c = {},
_c["taskInfo." + today + ".invites"] = { openId: openId, createTime: Date.now() },
_c)
})];
case 2:
// 增加邀请人的待领取次数和邀请记录
_d.sent();
_d.label = 3;
case 3: return [2 /*return*/, sdk_1.resultsModel.success(true)];
}
});
});
};
__decorate([
check_1.paramsCheck(['activityId', 'inviteId']),
check_1.activityTimeCheck,
services_1.services([service_1.UserService, service_1.TaskService, service_1.AccessService]),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object, Array]),
__metadata("design:returntype", Promise)
], Share.prototype, "doHelp", null);
return Share;
}());
exports.default = Share;
//# sourceMappingURL=share.controller.js.map
\ No newline at end of file
{"version":3,"file":"share.controller.js","sourceRoot":"","sources":["../../src/controller/share.controller.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEd,4CAA2C;AAC3C,4CAA8E;AAC9E,kDAAgD;AAEhD,8BAAqC;AACrC,kCAAmC;AACnC,sCAAoE;AAEpE;IAAA;IAyDA,CAAC;IAxDC;;OAEG;IAIG,sBAAM,GAAZ,UACE,OAA0B,EAC1B,EAAqD,EACrD,EAAoF;YADlF,QAAQ,cAAA,EAAE,OAAO,aAAA,EAAE,YAAY,kBAAA;YAChC,WAAW,QAAA,EAAE,WAAW,QAAA,EAAE,aAAa,QAAA;;;;;;;wBAEhC,QAAQ,GAAK,OAAO,CAAC,IAAI,SAAjB,CAAiB;wBACzB,MAAM,GAAK,OAAO,OAAZ,CAAY;wBAEQ,qBAAM,WAAW,CAAC,mBAAmB,CAAC,QAAQ,CAAC;4BACjF,iCAAiC;0BADgD;;wBAA3E,cAAc,GAAc,SAA+C;wBACjF,iCAAiC;wBACjC,IAAI,CAAC,cAAc;4BAAE,sBAAO,kBAAY,CAAC,KAAK,CAAC,sBAAU,CAAC,uBAAuB,CAAC,EAAA;wBAE5E,kBAAkB,GAAG,WAAW,CAAC,6BAA6B,CAAC,SAAS,EAAE,cAAc,CAAC,CAAA;wBAE/F,eAAe;wBACf,IAAI,kBAAkB,CAAC,IAAI,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,MAAM,KAAK,MAAM,EAAnB,CAAmB,CAAC,EAAE;4BACrD,sBAAO,kBAAY,CAAC,KAAK,CAAC,sBAAU,CAAC,2BAA2B,CAAC,EAAA;yBAClE;wBAKO,KAAK,GAAK,YAAY,MAAjB,CAAiB;wBAGX,KAAK,GACZ,CAAA,KAAK,IAAI,EAAE,CAAA,oBADC,CACD;wBAGjB,QAAQ,GAAG,WAAW,CAAC,iBAAiB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;wBAG3D,YAAY,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,CAAC,EAAH,CAAG,CAAC,CAAA;wBAEzC,KAAK,GAAG,gBAAQ,EAAE,CAAA;6BACpB,YAAY,EAAZ,wBAAY;wBACD,YAAY,GAAK,cAAc,IAAnB,CAAmB;wBAC5C,mBAAmB;wBACnB,qBAAM,WAAW,CAAC,UAAU,CAAC,YAAY,EAAE;gCACzC,IAAI,EAAE;oCACJ,qBAAqB,EAAE,KAAK;iCAC7B;gCACD,KAAK;oCACH,GAAC,cAAY,KAAK,aAAU,IAAG,EAAE,MAAM,QAAA,EAAE,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE;uCAClE;6BACF,CAAC,EAAA;;wBARF,mBAAmB;wBACnB,SAOE,CAAA;;4BAGJ,sBAAO,kBAAY,CAAC,OAAO,CAAC,IAAI,CAAC,EAAA;;;;KAClC;IAjDD;QAHC,mBAAW,CAAC,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;QACvC,yBAAiB;QACjB,mBAAQ,CAAC,CAAC,qBAAW,EAAE,qBAAW,EAAE,uBAAa,CAAC,CAAC;;;;uCAkDnD;IACH,YAAC;CAAA,AAzDD,IAyDC;kBAzDoB,KAAK"}
\ No newline at end of file
/** @format */
export interface IStatsParams {
activityId: string;
startDay: string;
endDay: string;
}
/** @format */
export default class StatController {
/**
* 统计数据
*/
getStats(context: IContext<IStatsParams>): Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<any[], true> | import("taobao-mini-sdk/lib/utils/resultmodel").Result<string | boolean | object | string[] | object[] | number[], false>>;
}
"use strict";
/** @format */
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
var db_1 = require("../db");
var sdk_1 = require("../sdk");
var constants_1 = require("../constants");
var xlsx = require("node-xlsx");
/** @format */
var StatController = /** @class */ (function () {
function StatController() {
}
/**
* 统计数据
*/
StatController.prototype.getStats = function (context) {
return __awaiter(this, void 0, void 0, function () {
var _a, activityId, startDay, endDay, userDao, accessDao, oneDay, xlsxData, day, PV, UV, newUV, vipPV, noVipPV, vipUV, noVipUV, newVipUV, newFollowUV, keyValueMapper, tommorrow, buffer, e_1;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
_a = context.data, activityId = _a.activityId, startDay = _a.startDay, endDay = _a.endDay;
userDao = new sdk_1.BaseDao(context, db_1.USER_DB_NAME);
accessDao = new sdk_1.BaseDao(context, db_1.ACCESS_DB_NAME);
oneDay = 24 * 3600 * 1000;
xlsxData = [];
_b.label = 1;
case 1:
_b.trys.push([1, 13, , 14]);
day = startDay;
_b.label = 2;
case 2:
if (!(new Date(day).getTime() <= new Date(endDay).getTime())) return [3 /*break*/, 12];
return [4 /*yield*/, accessDao.count({ activityId: activityId, createDay: day })
// 访问UV
];
case 3:
PV = _b.sent();
return [4 /*yield*/, accessDao.aggregate([
{ $match: { activityId: activityId, createDay: day } },
{ $group: { _id: '$openId', count: { $sum: 1 } } }
])];
case 4:
UV = (_b.sent()).length;
return [4 /*yield*/, userDao.count({
activityId: activityId,
createDay: day
})
// 已入会PV
];
case 5:
newUV = _b.sent();
return [4 /*yield*/, accessDao.count({ activityId: activityId, createDay: day, isVip: true })
// 未入会PV
];
case 6:
vipPV = _b.sent();
return [4 /*yield*/, accessDao.count({ activityId: activityId, createDay: day, isVip: false })
// 已入会UV
];
case 7:
noVipPV = _b.sent();
return [4 /*yield*/, accessDao.aggregate([
{ $match: { activityId: activityId, createDay: day, isVip: true } },
{ $group: { _id: '$openId', count: { $sum: 1 } } }
])];
case 8:
vipUV = (_b.sent()).length;
return [4 /*yield*/, accessDao.aggregate([
{ $match: { activityId: activityId, createDay: day, isVip: false } },
{ $group: { _id: '$openId', count: { $sum: 1 } } }
])];
case 9:
noVipUV = (_b.sent()).length;
return [4 /*yield*/, userDao.count({
activityId: activityId,
'member.newMember': true,
'member.bememberDay': day
})];
case 10:
newVipUV = _b.sent();
return [4 /*yield*/, userDao.count({
activityId: activityId,
'member.follow': true,
'member.followDay': day
})
// 签到任务
// const signTaskUV = await userDao.count({
// activityId,
// [`taskInfo.${day}.sign`]: {
// $exists: true
// }
// })
// 收藏商品
// const collectGoodsTaskUV = await userDao.count({
// activityId,
// [`taskInfo.${day}.collecctGoods`]: {
// $exists: true
// }
// })
];
case 11:
newFollowUV = _b.sent();
keyValueMapper = {
时间: day,
访问PV: PV,
访问UV: UV,
新增UV: newUV,
已入会PV: vipPV,
已入会UV: vipUV,
未入会PV: noVipPV,
未入会UV: noVipUV,
新入会UV: newVipUV,
新增关注UV: newFollowUV
// 收藏商品UV: collectGoodsTaskUV
// 签到任务UV: signTaskUV
};
if (day === startDay) {
xlsxData.push(Object.keys(keyValueMapper));
}
// @ts-ignore
xlsxData.push(Object.values(keyValueMapper));
tommorrow = new Date(day).getTime() + oneDay;
day = sdk_1.dateFormatter(sdk_1.transformBeijingDate(tommorrow), 'yyyy/MM/dd');
return [3 /*break*/, 2];
case 12:
buffer = xlsx.build([
{
name: "\u6570\u636E\u7EDF\u8BA1" + startDay.replace(/\//g, '-') + "-" + endDay.replace(/\//g, '-'),
data: xlsxData
}
]);
// let result = {}
console.log(xlsxData, 'xlsxData');
// let result = await context.cloud.file.uploadFile({
// fileContent: buffer,
// fileName: `数据统计${startDay.replace(/\//g, '-')}-${endDay.replace(/\//g, '-')}.xlsx`
// })
// console.log(xlsxData, 'xlsxData')
// if (result.url) {
// result.url = result.url.replace('http', 'https').replace('-internal', '')
// }
return [2 /*return*/, sdk_1.resultsModel.success(xlsxData)];
case 13:
e_1 = _b.sent();
console.log('上传文件出错', e_1);
// 打印日志
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.SYSTEM_ERROR, "\u4E0A\u4F20\u6587\u4EF6\u9519\u8BEF")];
case 14: return [2 /*return*/];
}
});
});
};
return StatController;
}());
exports.default = StatController;
//# sourceMappingURL=stat.controller.js.map
\ No newline at end of file
{"version":3,"file":"stat.controller.js","sourceRoot":"","sources":["../../src/controller/stat.controller.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEd,4BAAoE;AACpE,8BAAmF;AACnF,0CAAyC;AACzC,gCAAiC;AAQjC,cAAc;AACd;IAAA;IAiIA,CAAC;IAhIC;;OAEG;IACG,iCAAQ,GAAd,UAAe,OAA+B;;;;;;wBACtC,KAAmC,OAAO,CAAC,IAAI,EAA7C,UAAU,gBAAA,EAAE,QAAQ,cAAA,EAAE,MAAM,YAAA,CAAiB;wBAE/C,OAAO,GAAa,IAAI,aAAO,CAAC,OAAO,EAAE,iBAAY,CAAC,CAAA;wBACtD,SAAS,GAAa,IAAI,aAAO,CAAC,OAAO,EAAE,mBAAc,CAAC,CAAA;wBAC1D,MAAM,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAA;wBAEzB,QAAQ,GAAG,EAAE,CAAA;;;;wBAEb,GAAG,GAAG,QAAQ,CAAA;;;6BACX,CAAA,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,CAAA;wBAE/C,qBAAM,SAAS,CAAC,KAAK,CAAC,EAAE,UAAU,YAAA,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC;4BAChE,OAAO;0BADyD;;wBAA1D,EAAE,GAAG,SAAqD;wBAG9D,qBAAM,SAAS,CAAC,SAAS,CAAC;gCACxB,EAAE,MAAM,EAAE,EAAE,UAAU,YAAA,EAAE,SAAS,EAAE,GAAG,EAAE,EAAE;gCAC1C,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE;6BACnD,CAAC,EAAA;;wBAJE,EAAE,GAAG,CACT,SAGE,CACH,CAAC,MAAM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G,CAAC,SAAI,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAG;gCACzE,IAAI,EAAE,QAAQ;6BACf;yBACF,CAAC,CAAA;wBAEF,kBAAkB;wBAClB,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAA;wBACjC,qDAAqD;wBACrD,yBAAyB;wBACzB,uFAAuF;wBACvF,KAAK;wBACL,oCAAoC;wBACpC,oBAAoB;wBACpB,8EAA8E;wBAC9E,IAAI;wBACJ,sBAAO,kBAAY,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAA;;;wBAErC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAC,CAAC,CAAA;wBACxB,OAAO;wBACP,sBAAO,kBAAY,CAAC,KAAK,CAAC,sBAAU,CAAC,YAAY,EAAE,sCAAQ,CAAC,EAAA;;;;;KAE/D;IACH,qBAAC;AAAD,CAAC,AAjID,IAiIC"}
\ No newline at end of file
/** @format */
import { UserService, BaseService } from '../service';
export default class Task {
getTaskList(context: Context, { userInfo, vipInfo }: IControllerInfos, [userService]: [UserService]): Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result>;
/**
* 完成关注店铺任务
*/
doFollowTask(context: Context, { userInfo }: IControllerInfos, [userService, baseService]: [UserService, BaseService]): Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result>;
}
"use strict";
/** @format */
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
var constants_1 = require("./../constants");
var check_1 = require("../decorator/check");
var services_1 = require("../decorator/services");
var sdk_1 = require("../sdk");
var utils_1 = require("../utils");
var service_1 = require("../service");
// {
// "handler": "doFollowTask",
// "data": {
// "activityId": "5f213791964f9706aa59b192"
// }
// }
var Task = /** @class */ (function () {
function Task() {
}
Task.prototype.getTaskList = function (context, _a, _b) {
var userInfo = _a.userInfo, vipInfo = _a.vipInfo;
var userService = _b[0];
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_c) {
console.log(userInfo, userService, 'userInfo');
return [2 /*return*/, sdk_1.resultsModel.success([])];
});
});
};
/**
* 完成关注店铺任务
*/
Task.prototype.doFollowTask = function (context, _a, _b) {
var userInfo = _a.userInfo;
var userService = _b[0], baseService = _b[1];
return __awaiter(this, void 0, void 0, function () {
var activityId, remainTimes, _id, taskInfo, follow, flag, newFollow, hasFollowed, today, tasks, value, followInfo, error_1;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
activityId = context.data.activityId;
remainTimes = userInfo.remainTimes, _id = userInfo._id, taskInfo = userInfo.taskInfo, follow = userInfo.follow;
flag = follow.flag, newFollow = follow.newFollow;
hasFollowed = flag || newFollow;
if (hasFollowed)
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.ERROR_TASK_COMPLETE)];
today = utils_1.getToday();
return [4 /*yield*/, baseService.getBaseInfo(activityId)
// 获取关注店铺奖励
];
case 1:
tasks = (_c.sent()).tasks;
value = (tasks || {}).attentionStore.value;
followInfo = __assign(__assign({}, follow), { newFollow: true, followTime: Date.now(), followDay: today });
// 记录数据
taskInfo[today] = taskInfo[today] || {};
taskInfo[today].follow = 1;
// 增加待领取次数
remainTimes.follow += value;
_c.label = 2;
case 2:
_c.trys.push([2, 4, , 5]);
return [4 /*yield*/, userService.updateUser(_id, {
remainTimes: remainTimes,
follow: followInfo,
taskInfo: taskInfo
})];
case 3:
_c.sent();
return [2 /*return*/, sdk_1.resultsModel.success(true)];
case 4:
error_1 = _c.sent();
console.log('error', error_1);
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.SYSTEM_ERROR)];
case 5: return [2 /*return*/];
}
});
});
};
__decorate([
check_1.paramsCheck(['activityId']),
check_1.userCheck({ intercept: true }),
services_1.services([service_1.UserService]),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object, Array]),
__metadata("design:returntype", Promise)
], Task.prototype, "getTaskList", null);
__decorate([
check_1.paramsCheck(['activityId']),
check_1.activityTimeCheck,
services_1.services([service_1.UserService, service_1.BaseService]),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object, Array]),
__metadata("design:returntype", Promise)
], Task.prototype, "doFollowTask", null);
return Task;
}());
exports.default = Task;
//# sourceMappingURL=task.controller copy.js.map
\ No newline at end of file
{"version":3,"file":"task.controller copy.js","sourceRoot":"","sources":["../../src/controller/task.controller copy.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEd,4CAA2C;AAC3C,4CAA8E;AAC9E,kDAAgD;AAEhD,8BAA4C;AAC5C,kCAAqD;AACrD,sCAAqD;AAErD,IAAI;AACJ,+BAA+B;AAC/B,cAAc;AACd,+CAA+C;AAC/C,MAAM;AACN,IAAI;AACJ;IAAA;IAkEA,CAAC;IA9DO,0BAAW,GAAjB,UAAkB,OAAgB,EAAE,EAAuC,EAAE,EAA4B;YAAnE,QAAQ,cAAA,EAAE,OAAO,aAAA;YAAuB,WAAW,QAAA;;;gBACvF,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,WAAW,EAAE,UAAU,CAAC,CAAA;gBAE9C,sBAAO,kBAAY,CAAC,OA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QAAQ,UAAA;6BACT,CAAC,EAAA;;wBAJF,SAIE,CAAA;wBACF,sBAAO,kBAAY,CAAC,OAAO,CAAC,IAAI,CAAC,EAAA;;;wBAEjC,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,OAAK,CAAC,CAAA;wBAC3B,sBAAO,kBAAY,CAAC,KAAK,CAAC,sBAAU,CAAC,YAAY,CAAC,EAAA;;;;;KAErD;IA7DD;QAHC,mBAAW,CAAC,CAAC,YAAY,CAAC,CAAC;QAC3B,iBAAS,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;QAC9B,mBAAQ,CAAC,CAAC,qBAAW,CAAC,CAAC;;;;2CAKvB;IAQD;QAHC,mBAAW,CAAC,CAAC,YAAY,CAAC,CAAC;QAC3B,yBAAiB;QACjB,mBAAQ,CAAC,CAAC,qBAAW,EAAE,qBAAW,CAAC,CAAC;;;;4CAkDpC;IACH,WAAC;CAAA,AAlED,IAkEC;kBAlEoB,IAAI"}
\ No newline at end of file
/** @format */
import { TaskService, BaseService } from '../service';
import { ITaskInfo } from '../service/task.service';
export default class Task {
/**
* 任务列表
*/
getTaskList(context: IContext<{
activityId: string;
}>, { userInfo, vipInfo, activityInfo, session }: IControllerInfos, [taskService]: [TaskService]): Promise<IResult<ITaskInfo[]>>;
/**
* 完成关注店铺任务
*/
doFollowTask(context: IContext<{
activityId: string;
}>, { userInfo, activityInfo }: IControllerInfos, [TaskService]: [TaskService]): Promise<IResult<boolean>>;
/**
* 积分兑换次数
*/
doExchangeCreditsTask(context: IContext<IParams>, { userInfo, activityInfo, session }: IControllerInfos, [taskService]: [TaskService]): Promise<IResult<boolean>>;
/**
* 浏览商品
*/
doBrowseGoodsTask(context: IContext<IParams>, { userInfo, activityInfo }: IControllerInfos, [taskService]: [TaskService]): Promise<IResult<boolean>>;
/**
* 收藏商品
*/
doCollectGoodsTask(context: IContext<IParams>, { userInfo, activityInfo }: IControllerInfos, [taskService]: [TaskService]): Promise<IResult<boolean>>;
/**
* 浏览链接
*/
doJumpLinkTask(context: IContext<IParams>, { userInfo, activityInfo }: IControllerInfos, [taskService]: [TaskService]): Promise<IResult<boolean>>;
/**
* 领取任务奖励
*/
receiveTaskRewards(context: IContext<IParams>, { userInfo }: IControllerInfos, [taskService]: [TaskService]): Promise<IResult<boolean>>;
/**
* 获取收藏商品列表
*/
getCollectGoodsList(context: IContext<IParams>, { session, userInfo }: IControllerInfos, [baseService, taskService]: [BaseService, TaskService]): Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<{
collected: boolean;
itemId: string;
name: string;
price: string;
url: string;
image: string;
desc: string;
}[], true>>;
}
"use strict";
/** @format */
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
var constants_1 = require("./../constants");
var decorator_1 = require("../decorator");
var sdk_1 = require("../sdk");
var service_1 = require("../service");
var Task = /** @class */ (function () {
function Task() {
}
/**
* 任务列表
*/
Task.prototype.getTaskList = function (context, _a, _b) {
var userInfo = _a.userInfo, vipInfo = _a.vipInfo, activityInfo = _a.activityInfo, session = _a.session;
var taskService = _b[0];
return __awaiter(this, void 0, void 0, function () {
var tasks, startTime, updatedUserInfo, vipTask, followTask;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
tasks = activityInfo.tasks, startTime = activityInfo.startTime;
return [4 /*yield*/, taskService.updateTasks(userInfo._id,
// 需要查询更新的任务
[
taskService.updateVipTask(userInfo, vipInfo, tasks)
// taskService.updateSignTask(userInfo, tasks),
// await taskService.updateOrderGoodsTask(userInfo, tasks, startTime, session)
], userInfo)];
case 1:
updatedUserInfo = _c.sent();
if (!updatedUserInfo)
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.SYSTEM_ERROR, '更新任务列表失败')
// 会员任务
];
vipTask = taskService.initVipTask(updatedUserInfo, vipInfo, tasks);
followTask = taskService.initFollowTask(updatedUserInfo, tasks);
// 签到任务
// const signTask = taskService.initSignTask(updatedUserInfo, tasks)
// // 下单任务
// const orderGoodsTask = taskService.initOrderGoodsTask(updatedUserInfo, tasks)
// // 浏览商品任务
// const browseGoodsTask = taskService.initBrowseGoodsTask(updatedUserInfo, tasks)
// // 收藏商品任务
// const collectGoodsTask = taskService.initCollectGoodsTask(updatedUserInfo, tasks)
// // 跳转链接任务
// const jumpLinkTask = taskService.initJumpLinkTask(updatedUserInfo, tasks)
// // 邀请任务
// const invitesTask = taskService.initInvitesTask(updatedUserInfo, tasks)
// 积分兑换
//const exchangeCreditsTask = taskService.initExchangeCreditsTask(updatedUserInfo, tasks)
return [2 /*return*/, sdk_1.resultsModel.success([
//signTask,
vipTask,
followTask
// orderGoodsTask,
// browseGoodsTask,
// invitesTask,
// collectGoodsTask,
// jumpLinkTask
])];
}
});
});
};
/**
* 完成关注店铺任务
*/
Task.prototype.doFollowTask = function (context, _a, _b) {
var userInfo = _a.userInfo, activityInfo = _a.activityInfo;
var TaskService = _b[0];
return __awaiter(this, void 0, void 0, function () {
var follow, flag, newFollow, hasFollowed, result;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
follow = userInfo.follow;
flag = follow.flag, newFollow = follow.newFollow;
hasFollowed = flag || newFollow;
if (hasFollowed)
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.ERROR_TASK_COMPLETE)
// 更新状态
];
return [4 /*yield*/, TaskService.updateFollowTask(userInfo, activityInfo)];
case 1:
result = _c.sent();
return [2 /*return*/, result ? sdk_1.resultsModel.success(true) : sdk_1.resultsModel.error(constants_1.CODE_TYPES.SYSTEM_ERROR)];
}
});
});
};
/**
* 积分兑换次数
*/
Task.prototype.doExchangeCreditsTask = function (context, _a, _b) {
var userInfo = _a.userInfo, activityInfo = _a.activityInfo, session = _a.session;
var taskService = _b[0];
return __awaiter(this, void 0, void 0, function () {
var credits, taskType, _c, value, times, taskRateType, todayCompleteTimes, myCredits, result;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
credits = context.data.credits;
taskType = "exchangeCredits";
_c = activityInfo.tasks.exchangeCredits, value = _c.value, times = _c.times, taskRateType = _c.taskRateType;
todayCompleteTimes = taskService.getTodayCompleteTask(taskType, userInfo).todayCompleteTimes;
// 如果每日限制次数并到达了限制次数
if (times && times === todayCompleteTimes && taskRateType === constants_1.TASK_RATE_TYPE.EVERYDAY) {
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.ERROR_TASK_LIMIT)];
}
return [4 /*yield*/, sdk_1.TBAPIS.queryCredits(context, session)];
case 1:
myCredits = _d.sent();
console.log('myCredits', myCredits);
// 积分不足
if (myCredits < credits)
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.ERROR_NO_CREDITS)
// 扣积分
];
return [4 /*yield*/, sdk_1.TBAPIS.changeCredits(context, session, {
quantity: +credits,
change_type: 2,
opt_type: '1',
remark: "\u79EF\u5206\u5151\u6362\u4EFB\u52A1\u51CF\u79EF\u5206"
})];
case 2:
result = _d.sent();
if (!result)
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.SYSTEM_ERROR)
// 更新user表
];
// 更新user表
return [4 /*yield*/, taskService.updateUserTaskRecord(taskType, value, userInfo)];
case 3:
// 更新user表
_d.sent();
return [2 /*return*/, sdk_1.resultsModel.success(true)];
}
});
});
};
/**
* 浏览商品
*/
Task.prototype.doBrowseGoodsTask = function (context, _a, _b) {
var userInfo = _a.userInfo, activityInfo = _a.activityInfo;
var taskService = _b[0];
return __awaiter(this, void 0, void 0, function () {
var taskType, itemId, _c, taskRateType, times, itemIds, value, itemIdArray, _d, todayTaskInfo, todayCompleteTimes, hasCompleteToday;
return __generator(this, function (_e) {
switch (_e.label) {
case 0:
taskType = 'browseGoods';
itemId = context.data.itemId;
_c = activityInfo.tasks.browseGoods, taskRateType = _c.taskRateType, times = _c.times, itemIds = _c.itemIds, value = _c.value;
itemIdArray = Array.isArray(itemIds) ? itemIds : itemIds.split(',').map(function (v) { return +v; });
// B端配置商品ids不匹配正确
if (!itemIdArray.includes(+itemId))
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.PARAMS_ERROR, '商品id不匹配')];
_d = taskService.getTodayCompleteTask('browseGoods', userInfo), todayTaskInfo = _d.todayTaskInfo, todayCompleteTimes = _d.todayCompleteTimes;
hasCompleteToday = todayTaskInfo.filter(function (v) { return v.itemId === itemId; }).length &&
taskRateType === constants_1.TASK_RATE_TYPE.EVERYDAY;
// 今日任务已经完成
if (hasCompleteToday) {
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.PARAMS_ERROR, '今日该浏览商品任务已完成')];
}
// 次数超限
if (times && times === todayCompleteTimes && taskRateType === constants_1.TASK_RATE_TYPE.EVERYDAY) {
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.ERROR_TASK_LIMIT)];
}
// 更新user表
return [4 /*yield*/, taskService.updateUserTaskRecord(taskType, value, userInfo, {
itemId: itemId
})];
case 1:
// 更新user表
_e.sent();
return [2 /*return*/, sdk_1.resultsModel.success(true)];
}
});
});
};
/**
* 收藏商品
*/
Task.prototype.doCollectGoodsTask = function (context, _a, _b) {
var userInfo = _a.userInfo, activityInfo = _a.activityInfo;
var taskService = _b[0];
return __awaiter(this, void 0, void 0, function () {
var taskType, itemId, _c, taskRateType, times, itemIds, value, itemIdArray, _d, todayTaskInfo, todayCompleteTimes, hasCompleteToday;
return __generator(this, function (_e) {
switch (_e.label) {
case 0:
taskType = 'collectGoods';
itemId = context.data.itemId;
_c = activityInfo.tasks.collectGoods, taskRateType = _c.taskRateType, times = _c.times, itemIds = _c.itemIds, value = _c.value;
itemIdArray = Array.isArray(itemIds) ? itemIds : itemIds.split(',').map(function (v) { return +v; });
// B端配置商品ids不匹配正确
if (!itemIdArray.includes(+itemId))
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.PARAMS_ERROR, '商品id不匹配')];
_d = taskService.getTodayCompleteTask(taskType, userInfo), todayTaskInfo = _d.todayTaskInfo, todayCompleteTimes = _d.todayCompleteTimes;
hasCompleteToday = todayTaskInfo.filter(function (v) { return v.itemId === itemId; }).length &&
taskRateType === constants_1.TASK_RATE_TYPE.EVERYDAY;
// 今日任务已经完成
if (hasCompleteToday) {
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.PARAMS_ERROR, '今日该收藏商品任务已完成')];
}
// 次数超限
if (times && times === todayCompleteTimes && taskRateType === constants_1.TASK_RATE_TYPE.EVERYDAY) {
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.ERROR_TASK_LIMIT)];
}
// 更新user表
return [4 /*yield*/, taskService.updateUserTaskRecord(taskType, value, userInfo, {
itemId: itemId
})];
case 1:
// 更新user表
_e.sent();
return [2 /*return*/, sdk_1.resultsModel.success(true)];
}
});
});
};
/**
* 浏览链接
*/
Task.prototype.doJumpLinkTask = function (context, _a, _b) {
var userInfo = _a.userInfo, activityInfo = _a.activityInfo;
var taskService = _b[0];
return __awaiter(this, void 0, void 0, function () {
var taskType, _c, taskRateType, times, value, link, todayCompleteTimes, hasCompleteToday;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
taskType = 'jumpLink';
_c = activityInfo.tasks.jumpLink, taskRateType = _c.taskRateType, times = _c.times, value = _c.value, link = _c.link;
todayCompleteTimes = taskService.getTodayCompleteTask(taskType, userInfo).todayCompleteTimes;
hasCompleteToday = times && todayCompleteTimes === times && taskRateType === constants_1.TASK_RATE_TYPE.EVERYDAY;
// 今日任务已经完成
if (hasCompleteToday) {
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.PARAMS_ERROR, '今日跳转链接任务已完成')];
}
// 次数超限
if (times && times === todayCompleteTimes && taskRateType === constants_1.TASK_RATE_TYPE.EVERYDAY) {
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.ERROR_TASK_LIMIT)];
}
// 更新user表
return [4 /*yield*/, taskService.updateUserTaskRecord(taskType, value, userInfo)];
case 1:
// 更新user表
_d.sent();
return [2 /*return*/, sdk_1.resultsModel.success(true)];
}
});
});
};
/**
* 领取任务奖励
*/
Task.prototype.receiveTaskRewards = function (context, _a, _b) {
var userInfo = _a.userInfo;
var taskService = _b[0];
return __awaiter(this, void 0, void 0, function () {
var taskType, remainTimes, _id, waitReceiveTimes, awardsTargetKey;
var _c, _d;
return __generator(this, function (_e) {
switch (_e.label) {
case 0:
taskType = context.data.taskType;
remainTimes = userInfo.remainTimes, _id = userInfo._id;
// 暂无领取次数
if (!(remainTimes === null || remainTimes === void 0 ? void 0 : remainTimes[taskType]))
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.ERROR_TASK_NORECEIVE)];
waitReceiveTimes = remainTimes === null || remainTimes === void 0 ? void 0 : remainTimes[taskType];
awardsTargetKey = "gameTimes";
return [4 /*yield*/, taskService.updateUser(_id, {
$set: (_c = {},
_c["remainTimes." + taskType] = 0,
_c),
$inc: (_d = {},
_d[awardsTargetKey] = waitReceiveTimes,
_d)
})];
case 1:
_e.sent();
return [2 /*return*/, sdk_1.resultsModel.success(true)];
}
});
});
};
/**
* 获取收藏商品列表
*/
Task.prototype.getCollectGoodsList = function (context, _a, _b) {
var session = _a.session, userInfo = _a.userInfo;
var baseService = _b[0], taskService = _b[1];
return __awaiter(this, void 0, void 0, function () {
var itemIds, list, completeList, listWithCollectStatus;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
itemIds = context.data.itemIds;
return [4 /*yield*/, baseService.getItemListByIds(itemIds, session)];
case 1:
list = _c.sent();
completeList = taskService.getCompleteTaskByUserTaskInfo('collectGoods', userInfo);
listWithCollectStatus = list.map(function (v) {
return __assign(__assign({}, v), {
// 完成列表是否含有itemId
collected: completeList.some(function (completeItem) { return completeItem.itemId === v.itemId; }) });
});
return [2 /*return*/, sdk_1.resultsModel.success(listWithCollectStatus)];
}
});
});
};
__decorate([
decorator_1.paramsCheck(['activityId']),
decorator_1.userCheck({ intercept: true }),
decorator_1.activityTimeCheck,
decorator_1.services([service_1.TaskService]),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object, Array]),
__metadata("design:returntype", Promise)
], Task.prototype, "getTaskList", null);
__decorate([
decorator_1.paramsCheck(['activityId']),
decorator_1.activityTimeCheck,
decorator_1.services([service_1.TaskService]),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object, Array]),
__metadata("design:returntype", Promise)
], Task.prototype, "doFollowTask", null);
__decorate([
decorator_1.paramsCheck(['activityId', 'credits']),
decorator_1.userCheck({ intercept: true }),
decorator_1.activityTimeCheck,
decorator_1.services([service_1.TaskService]),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object, Array]),
__metadata("design:returntype", Promise)
], Task.prototype, "doExchangeCreditsTask", null);
__decorate([
decorator_1.paramsCheck(['activityId', 'itemId']),
decorator_1.userCheck({ intercept: true }),
decorator_1.activityTimeCheck,
decorator_1.services([service_1.TaskService]),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object, Array]),
__metadata("design:returntype", Promise)
], Task.prototype, "doBrowseGoodsTask", null);
__decorate([
decorator_1.paramsCheck(['activityId', 'itemId']),
decorator_1.userCheck({ intercept: true }),
decorator_1.activityTimeCheck,
decorator_1.services([service_1.TaskService]),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object, Array]),
__metadata("design:returntype", Promise)
], Task.prototype, "doCollectGoodsTask", null);
__decorate([
decorator_1.paramsCheck(['activityId']),
decorator_1.userCheck({ intercept: true }),
decorator_1.activityTimeCheck,
decorator_1.services([service_1.TaskService]),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object, Array]),
__metadata("design:returntype", Promise)
], Task.prototype, "doJumpLinkTask", null);
__decorate([
decorator_1.paramsCheck(['activityId', 'taskType']),
decorator_1.userCheck({ intercept: true }),
decorator_1.activityTimeCheck,
decorator_1.services([service_1.TaskService]),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object, Array]),
__metadata("design:returntype", Promise)
], Task.prototype, "receiveTaskRewards", null);
__decorate([
decorator_1.paramsCheck(['activityId', 'itemIds']),
decorator_1.services([service_1.BaseService, service_1.TaskService]),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object, Array]),
__metadata("design:returntype", Promise)
], Task.prototype, "getCollectGoodsList", null);
return Task;
}());
exports.default = Task;
//# sourceMappingURL=task.controller.js.map
\ No newline at end of file
{"version":3,"file":"task.controller.js","sourceRoot":"","sources":["../../src/controller/task.controller.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEd,4CAA2D;AAC3D,0CAA2F;AAE3F,8BAA6C;AAC7C,sCAAqD;AAIrD;IAAA;IA2UA,CAAC;IA1UC;;OAEG;IAKG,0BAAW,GAAjB,UACE,OAAyC,EACzC,EAA8D,EAC9D,EAA4B;YAD1B,QAAQ,cAAA,EAAE,OAAO,aAAA,EAAE,YAAY,kBAAA,EAAE,OAAO,aAAA;YACzC,WAAW,QAAA;;;;;;wBAEJ,KAAK,GAAgB,YAAY,MAA5B,EAAE,SAAS,GAAK,YAAY,UAAjB,CAAiB;wBAGnB,qBAAM,WAAW,CAAC,WAAW,CACjD,QAAQ,CAAC,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W,CAAC,CAAC;;;;mDAoBpC;IACH,WAAC;CAAA,AA3UD,IA2UC;kBA3UoB,IAAI"}
\ No newline at end of file
/** @format */
import { UserService } from '../service';
export default class Task {
getTaskList(context: Context, { userInfo }: {
userInfo: any;
}, [userService]: [UserService]): Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result>;
doFollowTask(context: Context, [userService]: [UserService]): Promise<void>;
}
"use strict";
/** @format */
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
var check_1 = require("../decorator/check");
var services_1 = require("../decorator/services");
var sdk_1 = require("../sdk");
var service_1 = require("../service");
// 5f213791964f9706aa59b192
var Task = /** @class */ (function () {
function Task() {
}
Task.prototype.getTaskList = function (context, _a, _b) {
var userInfo = _a.userInfo;
var userService = _b[0];
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_c) {
console.log(userInfo, userService, 'userInfo');
return [2 /*return*/, sdk_1.resultsModel.success([])];
});
});
};
Task.prototype.doFollowTask = function (context, _a) {
var userService = _a[0];
return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_b) {
return [2 /*return*/];
}); });
};
__decorate([
check_1.params(['activityId']),
check_1.userCheck({ intercept: true }),
services_1.services([service_1.UserService]),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object, Array]),
__metadata("design:returntype", Promise)
], Task.prototype, "getTaskList", null);
__decorate([
check_1.params(['activityId']),
check_1.activityTimeCheck,
services_1.services([service_1.UserService]),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Array]),
__metadata("design:returntype", Promise)
], Task.prototype, "doFollowTask", null);
return Task;
}());
exports.default = Task;
// console.log(exportHandlers(Task))
// export default exportHandlers(Task)
//# sourceMappingURL=tasktest.js.map
\ No newline at end of file
{"version":3,"file":"tasktest.js","sourceRoot":"","sources":["../../src/controller/tasktest.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGd,4CAAyE;AACzE,kDAAgD;AAEhD,8BAA4C;AAE5C,sCAAuD;AAWvD,2BAA2B;AAC3B;IAAA;IAaA,CAAC;IATO,0BAAW,GAAjB,UAAkB,OAAgB,EAAE,EAAY,EAAE,EAA4B;YAAxC,QAAQ,cAAA;YAAK,WAAW,QAAA;;;gBAC5D,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,WAAW,EAAE,UAAU,CAAC,CAAA;gBAC9C,sBAAO,kBAAY,CAAC,OAAO,CAAC,EAAE,CAAC,EAAA;;;KAChC;IAKK,2BAAY,GAAlB,UAAmB,OAAgB,EAAE,EAA4B;YAA3B,WAAW,QAAA;;;;KAAoB;IARrE;QAHC,cAAM,CAAC,CAAC,YAAY,CAAC,CAAC;QACtB,iBAAS,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;QAC9B,mBAAQ,CAAC,CAAC,qBAAW,CAAC,CAAC;;;;2CAIvB;IAKD;QAHC,cAAM,CAAC,CAAC,YAAY,CAAC,CAAC;QACtB,yBAAiB;QACjB,mBAAQ,CAAC,CAAC,qBAAW,CAAC,CAAC;;;;4CAC6C;IACvE,WAAC;CAAA,AAbD,IAaC;kBAboB,IAAI;AAezB,oCAAoC;AAEpC,sCAAsC"}
\ No newline at end of file
/** @format */
import { UserService, AccessService } from '../service';
export interface IVipParams {
activityId: string;
callbackUrl?: string;
}
export interface ILoginParams {
activityId: string;
userNick: string;
avatar: string;
isFollow: boolean;
inviteId?: string;
}
export default class User {
/**
* 登录接口, 初始化/更新用户信息
*/
login(context: IContext<ILoginParams>, { userInfo, vipInfo, activityInfo }: IControllerInfos, [userService, accessService]: [UserService, AccessService]): Promise<IResult<{
openId: string;
}>>;
/**
* 获取会员信息
*/
getVipInfo(context: IContext<IVipParams>, { session, activityUserNick }: IControllerInfos, [userService]: [UserService]): Promise<IResult<IVipInfo>>;
}
"use strict";
/** @format */
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
var decorator_1 = require("../decorator");
var sdk_1 = require("../sdk");
var service_1 = require("../service");
var config_1 = require("../config");
var User = /** @class */ (function () {
function User() {
}
/**
* 登录接口, 初始化/更新用户信息
*/
User.prototype.login = function (context, _a, _b) {
var userInfo = _a.userInfo, vipInfo = _a.vipInfo, activityInfo = _a.activityInfo;
var userService = _b[0], accessService = _b[1];
return __awaiter(this, void 0, void 0, function () {
var openId, isFollow;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
openId = context.openId;
isFollow = context.data.isFollow;
if (!!userInfo) return [3 /*break*/, 2];
return [4 /*yield*/, userService.initUserData(vipInfo, activityInfo)];
case 1:
_c.sent();
return [3 /*break*/, 4];
case 2: return [4 /*yield*/, userService.updateUserData(vipInfo, userInfo, activityInfo)];
case 3:
_c.sent();
_c.label = 4;
case 4:
// access表
return [4 /*yield*/, accessService.addAccess(isFollow, vipInfo.isVip)];
case 5:
// access表
_c.sent();
return [2 /*return*/, sdk_1.resultsModel.success({
openId: openId
})];
}
});
});
};
/**
* 获取会员信息
*/
User.prototype.getVipInfo = function (context, _a, _b) {
var session = _a.session, activityUserNick = _a.activityUserNick;
var userService = _b[0];
return __awaiter(this, void 0, void 0, function () {
var _c, callbackUrl, activityId, generateVipCallBackUrl, result;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
_c = context.data, callbackUrl = _c.callbackUrl, activityId = _c.activityId;
generateVipCallBackUrl = config_1.getConfig(context).generateVipCallBackUrl;
return [4 /*yield*/, userService.getShopVip(session, activityUserNick, callbackUrl || generateVipCallBackUrl(activityId))];
case 1:
result = _d.sent();
return [2 /*return*/, sdk_1.resultsModel.success(result)];
}
});
});
};
__decorate([
decorator_1.paramsCheck(['activityId', 'userNick', 'avatar', 'isFollow']),
decorator_1.activityTimeCheck,
decorator_1.services([service_1.UserService, service_1.AccessService]),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object, Array]),
__metadata("design:returntype", Promise)
], User.prototype, "login", null);
__decorate([
decorator_1.paramsCheck(['activityId']),
decorator_1.services([service_1.UserService]),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object, Array]),
__metadata("design:returntype", Promise)
], User.prototype, "getVipInfo", null);
return User;
}());
exports.default = User;
//# sourceMappingURL=user.controller.js.map
\ No newline at end of file
{"version":3,"file":"user.controller.js","sourceRoot":"","sources":["../../src/controller/user.controller.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEd,0CAAuE;AAEvE,8BAAqC;AACrC,sCAAuD;AACvD,oCAAqC;AAYrC;IAAA;IAiDA,CAAC;IAhDC;;OAEG;IAIG,oBAAK,GAAX,UACE,OAA+B,EAC/B,EAAqD,EACrD,EAA0D;YADxD,QAAQ,cAAA,EAAE,OAAO,aAAA,EAAE,YAAY,kBAAA;YAChC,WAAW,QAAA,EAAE,aAAa,QAAA;;;;;;wBAEnB,MAAM,GAAK,OAAO,OAAZ,CAAY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AAC,CAAC,qBAAW,CAAC,CAAC;;;;0CAevB;IACH,WAAC;CAAA,AAjDD,IAiDC;kBAjDoB,IAAI"}
\ No newline at end of file
/** @format */
export declare const ACCESS_DB_NAME: string;
export declare const USER_DB_NAME: string;
export declare const AWARDS_DB_NAME: string;
export declare const ERROR_LOG_DB_NAME: string;
export declare const SELLER_INFO_DB_NAME: string;
export declare const PRIZE_CONFIG_DB_NAME: string;
export declare const ACTIVITY_CONFIG_DB_NAME: string;
"use strict";
/** @format */
Object.defineProperty(exports, "__esModule", { value: true });
exports.ACTIVITY_CONFIG_DB_NAME = exports.PRIZE_CONFIG_DB_NAME = exports.SELLER_INFO_DB_NAME = exports.ERROR_LOG_DB_NAME = exports.AWARDS_DB_NAME = exports.USER_DB_NAME = exports.ACCESS_DB_NAME = void 0;
exports.ACCESS_DB_NAME = 'c_user_access';
exports.USER_DB_NAME = 'c_user';
exports.AWARDS_DB_NAME = 'c_awards_info';
exports.ERROR_LOG_DB_NAME = 'error_log';
exports.SELLER_INFO_DB_NAME = 'a_seller_info';
exports.PRIZE_CONFIG_DB_NAME = 'b_prize_config';
exports.ACTIVITY_CONFIG_DB_NAME = 'b_activity_config';
//# sourceMappingURL=db.js.map
\ No newline at end of file
{"version":3,"file":"db.js","sourceRoot":"","sources":["../src/db.ts"],"names":[],"mappings":";AAAA,cAAc;;;AAED,QAAA,cAAc,GAAW,eAAe,CAAA;AAExC,QAAA,YAAY,GAAW,QAAQ,CAAA;AAE/B,QAAA,cAAc,GAAW,eAAe,CAAA;AAExC,QAAA,iBAAiB,GAAW,WAAW,CAAA;AAEvC,QAAA,mBAAmB,GAAW,eAAe,CAAA;AAE7C,QAAA,oBAAoB,GAAW,gBAAgB,CAAA;AAE/C,QAAA,uBAAuB,GAAW,mBAAmB,CAAA"}
\ No newline at end of file
export declare const paramsCheck: (params: string[]) => (target: Object, name: string, descriptor: PropertyDescriptor) => void;
export declare const userCheck: ({ intercept }: {
intercept?: boolean;
}) => (target: any, name: string, descriptor: PropertyDescriptor) => void;
export declare const vipCheck: ({ intercept, callbackUrl }: {
intercept?: boolean;
callbackUrl?: string;
}) => (target: any, name: string, descriptor: PropertyDescriptor) => void;
export declare const activityTimeCheck: (target: any, name: string, descriptor: PropertyDescriptor) => void;
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.activityTimeCheck = exports.vipCheck = exports.userCheck = exports.paramsCheck = void 0;
/** @format */
var sdk_1 = require("../sdk");
var constants_1 = require("../constants");
var service_1 = require("../service");
var utils_1 = require("../utils");
var config_1 = require("../config");
// 检验参数是否存在
exports.paramsCheck = function (params) {
return function (target, name, descriptor) {
var method = descriptor.value;
descriptor.value = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var context = args[0], _a = args[1], otherArgs = _a === void 0 ? {} : _a;
var dataKeys = Object.keys(context.data);
for (var i = 0; i < params.length; i++) {
var param = params[i];
if (!dataKeys.includes(param))
return sdk_1.resultsModel.error(constants_1.CODE_TYPES.PARAMS_ERROR, "\u7F3A\u5C11" + param + "\u53C2\u6570");
}
return method.apply(target, [context, __assign({}, otherArgs)]);
};
};
};
// 检验用户是否存在
exports.userCheck = function (_a) {
var _b = _a.intercept, intercept = _b === void 0 ? true : _b;
return function (target, name, descriptor) {
var method = descriptor.value;
descriptor.value = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return __awaiter(this, void 0, void 0, function () {
var context, _a, otherArgs, userService, userInfo;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
context = args[0], _a = args[1], otherArgs = _a === void 0 ? {} : _a;
userService = new service_1.UserService(context);
return [4 /*yield*/, userService.getUserInfo()];
case 1:
userInfo = _b.sent();
if (!userInfo && intercept)
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.ERROR_NO_USER)];
return [2 /*return*/, method.apply(target, [context, __assign(__assign({}, otherArgs), { userInfo: userInfo })])];
}
});
});
};
};
};
// 是否是会员
exports.vipCheck = function (_a) {
var _b = _a.intercept, intercept = _b === void 0 ? true : _b, _c = _a.callbackUrl, callbackUrl = _c === void 0 ? '' : _c;
return function (target, name, descriptor) {
var method = descriptor.value;
descriptor.value = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return __awaiter(this, void 0, void 0, function () {
var context, _a, otherArgs, activityId, generateVipCallBackUrl, userService, session, vipInfo;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
context = args[0], _a = args[1], otherArgs = _a === void 0 ? {} : _a;
activityId = context.data.activityId;
generateVipCallBackUrl = config_1.getConfig(context).generateVipCallBackUrl;
userService = new service_1.UserService(context);
return [4 /*yield*/, utils_1.getSellerSession(context)];
case 1:
session = (_b.sent()).session;
return [4 /*yield*/, userService.getShopVip(session, callbackUrl || generateVipCallBackUrl(activityId))];
case 2:
vipInfo = _b.sent();
if (!vipInfo.isVip && intercept)
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.ERROR_NO_VIP, '非店铺会员', vipInfo)];
return [2 /*return*/, method.apply(target, [context, __assign(__assign({}, otherArgs), { vipInfo: vipInfo, session: session })])];
}
});
});
};
};
};
// 活动时间校验
exports.activityTimeCheck = function (target, name, descriptor) {
var method = descriptor.value;
descriptor.value = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return __awaiter(this, void 0, void 0, function () {
var context, _a, otherArgs, activityId, baseService, activityInfo, startTime, endTime, currentTime;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
context = args[0], _a = args[1], otherArgs = _a === void 0 ? {} : _a;
activityId = context.data.activityId;
if (!activityId)
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.PARAMS_ERROR, "\u7F3A\u5C11\u6D3B\u52A8id")];
baseService = new service_1.BaseService(context);
return [4 /*yield*/, baseService.getBaseInfo(activityId)
// 活动不存在
];
case 1:
activityInfo = _b.sent();
// 活动不存在
if (!activityInfo) {
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.ERROR_NO_ACTIVITY)];
}
startTime = activityInfo.startTime, endTime = activityInfo.endTime;
currentTime = Date.now();
if (currentTime < startTime) {
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.ERROR_ACTIVITY_NOSTART, "\u6D3B\u52A8\u672A\u5F00\u59CB")];
}
if (currentTime > endTime) {
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.ERROR_ACTIVITY_OVER, "\u6D3B\u52A8\u5DF2\u7ED3\u675F")];
}
return [2 /*return*/, method.apply(target, [context, __assign(__assign({}, otherArgs), { activityInfo: activityInfo })])];
}
});
});
};
};
//# sourceMappingURL=check.js.map
\ No newline at end of file
{"version":3,"file":"check.js","sourceRoot":"","sources":["../../src/decorator/check.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,cAAc;AACd,8BAAqC;AACrC,0CAAyC;AACzC,sCAAqD;AACrD,kCAA2C;AAC3C,oCAAqC;AACrC,WAAW;AACE,QAAA,WAAW,GAAG,UAAC,MAAgB;IAC1C,OAAO,UAAU,MAAc,EAAE,IAAY,EAAE,UAA8B;QAC3E,IAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAA;QAE/B,UAAU,CAAC,KAAK,GAAG;YAAU,cAAc;iBAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;gBAAd,yBAAc;;YAClC,IAAA,OAAO,GAAoB,IAAI,GAAxB,EAAE,KAAkB,IAAI,GAAR,EAAd,SAAS,mBAAG,EAAE,KAAA,CAAQ;YACtC,IAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,C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;KACvE,CAAA;AACH,CAAC,CAAA"}
\ No newline at end of file
/** @format */
export * from './check';
export * from './services';
export * from './noCatch';
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
/** @format */
__exportStar(require("./check"), exports);
__exportStar(require("./services"), exports);
__exportStar(require("./noCatch"), exports);
//# sourceMappingURL=index.js.map
\ No newline at end of file
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/decorator/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,cAAc;AACd,0CAAuB;AACvB,6CAA0B;AAC1B,4CAAyB"}
\ No newline at end of file
/** @format */
export declare const log: (target: Object, name: string, descriptor: PropertyDescriptor) => void;
"use strict";
/** @format */
Object.defineProperty(exports, "__esModule", { value: true });
exports.log = void 0;
exports.log = function (target, name, descriptor) {
var oldValue = descriptor.value;
descriptor.value = function () {
var context = arguments[0];
var data = JSON.stringify(context.data);
console.log("---------\u51FD\u6570: " + context.fcName + "." + context.cloud.dataspace.context.handler + "------------");
console.log("---------\u8BF7\u6C42\u53C2\u6570: " + data + "------------");
return oldValue.apply(this, arguments);
};
};
//# sourceMappingURL=log.js.map
\ No newline at end of file
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../src/decorator/log.ts"],"names":[],"mappings":";AAAA,cAAc;;;AAED,QAAA,GAAG,GAAG,UAAC,MAAc,EAAE,IAAY,EAAE,UAA8B;IAC9E,IAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAA;IACjC,UAAU,CAAC,KAAK,GAAG;QACjB,IAAM,OAAO,GAAY,SAAS,CAAC,CAAC,CAAC,CAAA;QACrC,IAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;QACzC,OAAO,CAAC,GAAG,CAAC,4BAAgB,OAAO,CAAC,MAAM,SAAI,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,iBAAc,CAAC,CAAA;QACpG,OAAO,CAAC,GAAG,CAAC,wCAAkB,IAAI,iBAAc,CAAC,CAAA;QAEjD,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAA;IACxC,CAAC,CAAA;AACH,CAAC,CAAA"}
\ No newline at end of file
/** @format */
export declare const noCatch: (target: any, name: string, descriptor: PropertyDescriptor) => void;
"use strict";
/** @format */
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.noCatch = void 0;
exports.noCatch = function (target, name, descriptor) {
var method = descriptor.value;
descriptor.value = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return __awaiter(this, void 0, void 0, function () {
var context, _a, otherArgs;
return __generator(this, function (_b) {
context = args[0], _a = args[1], otherArgs = _a === void 0 ? {} : _a;
return [2 /*return*/, method.apply(this, [context, __assign(__assign({}, otherArgs), { noCatch: true })])];
});
});
};
};
//# sourceMappingURL=noCatch.js.map
\ No newline at end of file
{"version":3,"file":"noCatch.js","sourceRoot":"","sources":["../../src/decorator/noCatch.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAED,QAAA,OAAO,GAAG,UAAC,MAAW,EAAE,IAAY,EAAE,UAA8B;IAC/E,IAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAA;IAC/B,UAAU,CAAC,KAAK,GAAG;QAAgB,cAAc;aAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;YAAd,yBAAc;;;;;gBACxC,OAAO,GAAoB,IAAI,GAAxB,EAAE,KAAkB,IAAI,GAAR,EAAd,SAAS,mBAAG,EAAE,KAAA,CAAQ;gBACtC,sBAAO,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,OAAO,wBAAO,SAAS,KAAE,OAAO,EAAE,IAAI,IAAG,CAAC,EAAA;;;KACtE,CAAA;AACH,CAAC,CAAA"}
\ No newline at end of file
export declare const services: (services: any[]) => (target: Object, name: string, descriptor: PropertyDescriptor) => void;
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.services = void 0;
/** @format */
var service_1 = require("../service");
var utils_1 = require("../utils");
var sdk_1 = require("../sdk");
var constants_1 = require("../constants");
function initBaseInfo(context, baseInfos) {
return __awaiter(this, void 0, void 0, function () {
var userService, userInfo, _a, session, userNick, vipInfo;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
userService = new service_1.UserService(context);
if (!!baseInfos.userInfo) return [3 /*break*/, 2];
return [4 /*yield*/, userService.getUserInfo()];
case 1:
userInfo = _b.sent();
baseInfos.userInfo = userInfo;
_b.label = 2;
case 2:
if (!!baseInfos.session) return [3 /*break*/, 4];
return [4 /*yield*/, utils_1.getSellerSession(context)];
case 3:
_a = _b.sent(), session = _a.session, userNick = _a.userNick;
baseInfos.session = session;
baseInfos.activityUserNick = userNick;
_b.label = 4;
case 4:
if (!!baseInfos.vipInfo) return [3 /*break*/, 6];
return [4 /*yield*/, userService.getShopVip(baseInfos.session)];
case 5:
vipInfo = _b.sent();
baseInfos.vipInfo = vipInfo;
_b.label = 6;
case 6: return [2 /*return*/, baseInfos];
}
});
});
}
// 注入服务
exports.services = function (services) {
return function (target, name, descriptor) {
var method = descriptor.value;
descriptor.value = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return __awaiter(this, void 0, void 0, function () {
var context, _a, otherArgs, servicesInstance, baseInfos, ret, error_1;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
context = args[0], _a = args[1], otherArgs = _a === void 0 ? {} : _a;
servicesInstance = services.map(function (v) { return new v(context); });
return [4 /*yield*/, initBaseInfo(context, otherArgs)
// 默认全局try catch 如果有noCatch参数则直接执行
];
case 1:
baseInfos = _b.sent();
// 默认全局try catch 如果有noCatch参数则直接执行
if (baseInfos.noCatch) {
delete baseInfos.noCatch;
return [2 /*return*/, method.apply(target, [context, baseInfos, servicesInstance])];
}
_b.label = 2;
case 2:
_b.trys.push([2, 4, , 6]);
utils_1.logFn(context);
return [4 /*yield*/, method.apply(target, [context, baseInfos, servicesInstance])];
case 3:
ret = _b.sent();
return [3 /*break*/, 6];
case 4:
error_1 = _b.sent();
console.log('error', error_1);
return [4 /*yield*/, utils_1.recordErrorLog(context, baseInfos, error_1.toString(), error_1.stack)];
case 5:
_b.sent();
ret = sdk_1.resultsModel.error(constants_1.CODE_TYPES.SYSTEM_ERROR);
return [3 /*break*/, 6];
case 6: return [2 /*return*/, ret];
}
});
});
};
};
};
//# sourceMappingURL=services.js.map
\ No newline at end of file
{"version":3,"file":"services.js","sourceRoot":"","sources":["../../src/decorator/services.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,cAAc;AACd,sCAAwC;AACxC,kCAAkE;AAClE,8BAAqC;AACrC,0CAAyC;AACzC,SAAe,YAAY,CAAC,OAA0B,EAAE,SAA2B;;;;;;oBAC3E,WAAW,GAAG,IAAI,qBAAW,CAAC,OAAO,CAAC,CAAA;yBAExC,CAAC,SAAS,CAAC,QAAQ,EAAnB,wBAAmB;oBACJ,qBAAM,WAAW,CAAC,WAAW,EAAE,EAAA;;oBAA1C,QAAQ,GAAG,SAA+B;oBAChD,SAAS,CAAC,QAAQ,GAAG,QAAQ,CAAA;;;yBAG3B,CAAC,SAAS,CAAC,OAAO,EAAlB,wBAAkB;oBACU,qBAAM,wBAAgB,CAAC,OAAO,CAAC,EAAA;;oBAAvD,KA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,MAAM,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,gBAAgB,CAAC,CAAC,EAAA;;4BAAxE,GAAG,GAAG,SAAkE,CAAA;;;;4BAExE,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,OAAK,CAAC,CAAA;4BAC3B,qBAAM,sBAAc,CAAC,OAAO,EAAE,SAAS,EAAE,OAAK,CAAC,QAAQ,EAAE,EAAE,OAAK,CAAC,KAAK,CAAC,EAAA;;4BAAvE,SAAuE,CAAA;4BACvE,GAAG,GAAG,kBAAY,CAAC,KAAK,CAAC,sBAAU,CAAC,YAAY,CAAC,CAAA;;gCAEnD,sBAAO,GAAG,EAAA;;;;SACX,CAAA;IACH,CAAC,CAAA;AACH,CAAC,CAAA"}
\ No newline at end of file
/** @format */
declare const _default: {
login: (context: IContext<import("./controller/user.controller").ILoginParams>, { userInfo, vipInfo, activityInfo }: IControllerInfos, [userService, accessService]: [import("./service/user.service").default, import("./service").AccessService]) => Promise<IResult<{
openId: string;
}>>;
getVipInfo: (context: IContext<import("./controller/user.controller").IVipParams>, { session, activityUserNick }: IControllerInfos, [userService]: [import("./service/user.service").default]) => Promise<IResult<IVipInfo>>;
getTaskList: (context: IContext<{
activityId: string;
}>, { userInfo, vipInfo, activityInfo, session }: IControllerInfos, [taskService]: [import("./service").TaskService]) => Promise<IResult<import("./service/task.service").ITaskInfo[]>>;
receiveTaskRewards: (context: IContext<IParams>, { userInfo }: IControllerInfos, [taskService]: [import("./service").TaskService]) => Promise<IResult<boolean>>;
getActivityBaseInfoById: (context: IContext<{
activityId: string;
}>, {}: {}, [baseService]: [import("./service").BaseService]) => Promise<IResult<IActivityInfo>>;
getMyPrizeList: (context: IContext<import("./controller/awards.controller").IPrizeListParams>, {}: {}, [awardSer]: [import("./service").AwardsService]) => Promise<IResult<IAwards[]>>;
receiveObjectPrize: (context: IContext<import("./controller/awards.controller").IReceiveOjectParams>, {}: {}, [awardSer]: [import("./service").AwardsService]) => Promise<IResult<boolean>>;
receiveEnamePrize: (context: IContext<import("./controller/awards.controller").IReceiveEnameParams>, {}: {}, [awardSer]: [import("./service").AwardsService]) => Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<string | boolean | object | object[] | number[] | string[], false> | import("taobao-mini-sdk/lib/utils/resultmodel").Result<{}, true>>;
doHelp: (context: IContext<IParams>, { userInfo, vipInfo, activityInfo }: IControllerInfos, [userService, taskService, accessService]: [import("./service/user.service").default, import("./service").TaskService, import("./service").AccessService]) => Promise<IResult<boolean>>;
getStats: (context: IContext<import("./controller/stat.controller").IStatsParams>) => Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<string | boolean | object | object[] | number[] | string[], false> | import("taobao-mini-sdk/lib/utils/resultmodel").Result<any[], true>>;
};
export default _default;
"use strict";
/** @format */
Object.defineProperty(exports, "__esModule", { value: true });
// import { exportHandlers } from './utils'
var user_controller_1 = require("./controller/user.controller");
var task_controller_1 = require("./controller/task.controller");
var base_controller_1 = require("./controller/base.controller");
var awards_controller_1 = require("./controller/awards.controller");
var share_controller_1 = require("./controller/share.controller");
var stat_controller_1 = require("./controller/stat.controller");
var _a = new user_controller_1.default(), login = _a.login, getVipInfo = _a.getVipInfo;
var _b = new task_controller_1.default(), getTaskList = _b.getTaskList, receiveTaskRewards = _b.receiveTaskRewards, getCollectGoodsList = _b.getCollectGoodsList, // 获取收藏商品列表,包含收藏状态
doFollowTask = _b.doFollowTask, doJumpLinkTask = _b.doJumpLinkTask, doBrowseGoodsTask = _b.doBrowseGoodsTask, doCollectGoodsTask = _b.doCollectGoodsTask, doExchangeCreditsTask = _b.doExchangeCreditsTask;
var _c = new base_controller_1.default(), getActivityBaseInfoById = _c.getActivityBaseInfoById, getItemListByItemIds = _c.getItemListByItemIds;
var _d = new awards_controller_1.default(), getMyPrizeList = _d.getMyPrizeList, receiveObjectPrize = _d.receiveObjectPrize, receiveEnamePrize = _d.receiveEnamePrize, drawLotteryPrize = _d.drawLotteryPrize;
var doHelp = new share_controller_1.default().doHelp;
var getStats = new stat_controller_1.default().getStats;
exports.default = {
login: login,
getVipInfo: getVipInfo,
getTaskList: getTaskList,
receiveTaskRewards: receiveTaskRewards,
getActivityBaseInfoById: getActivityBaseInfoById,
getMyPrizeList: getMyPrizeList,
receiveObjectPrize: receiveObjectPrize,
receiveEnamePrize: receiveEnamePrize,
doHelp: doHelp,
getStats: getStats
};
//# sourceMappingURL=index.js.map
\ No newline at end of file
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,cAAc;;AAEd,2CAA2C;AAC3C,gEAAyD;AACzD,gEAAyD;AACzD,gEAAyD;AACzD,oEAA6D;AAC7D,kEAA2D;AAC3D,gEAAyD;AAEnD,IAAA,KAAwB,IAAI,yBAAc,EAAE,EAA1C,KAAK,WAAA,EAAE,UAAU,gBAAyB,CAAA;AAC5C,IAAA,KASF,IAAI,yBAAc,EAAE,EARtB,WAAW,iBAAA,EACX,kBAAkB,wBAAA,EAClB,mBAAmB,yBAAA,EAAE,kBAAkB;AACvC,YAAY,kBAAA,EACZ,cAAc,oBAAA,EACd,iBAAiB,uBAAA,EACjB,kBAAkB,wBAAA,EAClB,qBAAqB,2BACC,CAAA;AAElB,IAAA,KAAoD,IAAI,yBAAc,EAAE,EAAtE,uBAAuB,6BAAA,EAAE,oBAAoB,0BAAyB,CAAA;AAExE,IAAA,KAA8E,IAAI,2BAAgB,EAAE,EAAlG,cAAc,oBAAA,EAAE,kBAAkB,wBAAA,EAAE,iBAAiB,uBAAA,EAAE,gBAAgB,sBAA2B,CAAA;AAElG,IAAA,MAAM,GAAK,IAAI,0BAAe,EAAE,OAA1B,CAA0B;AAEhC,IAAA,QAAQ,GAAK,IAAI,yBAAc,EAAE,SAAzB,CAAyB;AAEzC,kBAAe;IACb,KAAK,OAAA;IACL,UAAU,YAAA;IACV,WAAW,aAAA;IACX,kBAAkB,oBAAA;IAClB,uBAAuB,yBAAA;IACvB,cAAc,gBAAA;IACd,kBAAkB,oBAAA;IAClB,iBAAiB,mBAAA;IACjB,MAAM,QAAA;IACN,QAAQ,UAAA;CACT,CAAA"}
\ No newline at end of file
/** @format */
declare namespace AAA {
interface IContext extends Context {
data: {
activityId: string;
};
}
}
//# sourceMappingURL=base.controller.js.map
\ No newline at end of file
{"version":3,"file":"base.controller.js","sourceRoot":"","sources":["../../src/model/base.controller.ts"],"names":[],"mappings":""}
\ No newline at end of file
/** @format */
/** @format */
declare namespace getActivityBaseInfoById {
type Context = IContext<{
activityId: string;
}>;
interface Result extends IResult {
data: IActivityInfo;
}
}
/** @format */
//# sourceMappingURL=base.js.map
\ No newline at end of file
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/model/base.ts"],"names":[],"mappings":"AAAA,cAAc"}
\ No newline at end of file
/** @format */
import Utils from 'taobao-mini-sdk/lib/utils/index';
import TBAPI from 'taobao-mini-sdk/lib/service/TBAPI';
declare const DEFAULT_CODE_TYPES: {
PARAMS_ERROR: import("taobao-mini-sdk/lib/utils/codetypes").CodeType;
SYSTEM_ERROR: import("taobao-mini-sdk/lib/utils/codetypes").CodeType;
SUCCESS: import("taobao-mini-sdk/lib/utils/codetypes").CodeType;
}, getStartTimestamp: (day: string) => number, getEndTimestamp: (day: string) => number;
declare const resultsModel: import("taobao-mini-sdk/lib/utils/resultmodel").ResultsModel;
export declare const TBAPIS: typeof TBAPI;
export declare const BaseDao: any;
export declare const transformBeijingDate: typeof Utils.transformBeijingDate;
export declare const dateFormatter: typeof Utils.dateFormatter;
export { DEFAULT_CODE_TYPES, resultsModel, getStartTimestamp, getEndTimestamp };
"use strict";
/** @format */
Object.defineProperty(exports, "__esModule", { value: true });
exports.getEndTimestamp = exports.getStartTimestamp = exports.resultsModel = exports.DEFAULT_CODE_TYPES = exports.dateFormatter = exports.transformBeijingDate = exports.BaseDao = exports.TBAPIS = void 0;
var index_1 = require("taobao-mini-sdk/lib/utils/index");
var base_dao_1 = require("taobao-mini-sdk/lib/dao/base.dao");
var TBAPI_1 = require("taobao-mini-sdk/lib/service/TBAPI");
var MockConfig = require('../mockServer/sdk');
var DEFAULT_CODE_TYPES = index_1.default.DEFAULT_CODE_TYPES, cloudDateFormatter = index_1.default.dateFormatter, cloudTransformBeijingDate = index_1.default.transformBeijingDate, getStartTimestamp = index_1.default.getStartTimestamp, getEndTimestamp = index_1.default.getEndTimestamp, ResultsModel = index_1.default.ResultsModel;
exports.DEFAULT_CODE_TYPES = DEFAULT_CODE_TYPES;
exports.getStartTimestamp = getStartTimestamp;
exports.getEndTimestamp = getEndTimestamp;
var resultsModel = new ResultsModel();
exports.resultsModel = resultsModel;
var env = process.argv[2];
console.log("env", env);
exports.TBAPIS = env === 'mock' ? MockConfig.TBAPIS : TBAPI_1.default;
exports.BaseDao = env === 'mock' ? MockConfig.BaseDao : base_dao_1.BaseDao;
exports.transformBeijingDate = env === 'mock' ? MockConfig.transformBeijingDate : cloudTransformBeijingDate;
exports.dateFormatter = env === 'mock' ? MockConfig.dateFormatter : cloudDateFormatter;
//# sourceMappingURL=sdk.js.map
\ No newline at end of file
{"version":3,"file":"sdk.js","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":";AAAA,cAAc;;;AAEd,yDAAmD;AACnD,6DAA0E;AAC1E,2DAAqD;AACrD,IAAI,UAAU,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAA;AAG3C,IAAA,kBAAkB,GAMhB,eAAK,mBANW,EACH,kBAAkB,GAK/B,eAAK,cAL0B,EACX,yBAAyB,GAI7C,eAAK,qBAJwC,EAC/C,iBAAiB,GAGf,eAAK,kBAHU,EACjB,eAAe,GAEb,eAAK,gBAFQ,EACf,YAAY,GACV,eAAK,aADK,CACL;AAgBA,gDAAkB;AAAgB,8CAAiB;AAAE,0CAAe;AAd7E,IAAM,YAAY,GAAG,IAAI,YAAY,EAAE,CAAA;AAcV,oCAAY;AAZzC,IAAI,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACzB,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;AAEV,QAAA,MAAM,GAAiB,GAAG,KAAK,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,eAAK,CAAA;AAEjE,QAAA,OAAO,GAAG,GAAG,KAAK,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,kBAAY,CAAA;AAE5D,QAAA,oBAAoB,GAC/B,GAAG,KAAK,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC,CAAC,yBAAyB,CAAA;AAEjE,QAAA,aAAa,GAA+B,GAAG,KAAK,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,kBAAkB,CAAA"}
\ No newline at end of file
/** @format */
declare const TBAPIS: any, DEFAULT_CODE_TYPES: any, resultsModel: any, dateFormatter: any, getStartTimestamp: any, getEndTimestamp: any, transformBeijingDate: any, BaseDao: any;
export { TBAPIS, DEFAULT_CODE_TYPES, resultsModel, dateFormatter, getStartTimestamp, getEndTimestamp, transformBeijingDate, BaseDao };
"use strict";
/** @format */
Object.defineProperty(exports, "__esModule", { value: true });
exports.BaseDao = exports.transformBeijingDate = exports.getEndTimestamp = exports.getStartTimestamp = exports.dateFormatter = exports.resultsModel = exports.DEFAULT_CODE_TYPES = exports.TBAPIS = void 0;
var _a = require('./sdk'), TBAPIS = _a.TBAPIS, DEFAULT_CODE_TYPES = _a.DEFAULT_CODE_TYPES, resultsModel = _a.resultsModel, dateFormatter = _a.dateFormatter, getStartTimestamp = _a.getStartTimestamp, getEndTimestamp = _a.getEndTimestamp, transformBeijingDate = _a.transformBeijingDate, BaseDao = _a.BaseDao;
exports.TBAPIS = TBAPIS;
exports.DEFAULT_CODE_TYPES = DEFAULT_CODE_TYPES;
exports.resultsModel = resultsModel;
exports.dateFormatter = dateFormatter;
exports.getStartTimestamp = getStartTimestamp;
exports.getEndTimestamp = getEndTimestamp;
exports.transformBeijingDate = transformBeijingDate;
exports.BaseDao = BaseDao;
//# sourceMappingURL=index.js.map
\ No newline at end of file
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sdk/index.ts"],"names":[],"mappings":";AAAA,cAAc;;;AAER,IAAA,KASF,OAAO,CAAC,OAAO,CAAC,EARlB,MAAM,YAAA,EACN,kBAAkB,wBAAA,EAClB,YAAY,kBAAA,EACZ,aAAa,mBAAA,EACb,iBAAiB,uBAAA,EACjB,eAAe,qBAAA,EACf,oBAAoB,0BAAA,EACpB,OAAO,aACW,CAAA;AAGlB,wBAAM;AACN,gDAAkB;AAClB,oCAAY;AACZ,sCAAa;AACb,8CAAiB;AACjB,0CAAe;AACf,oDAAoB;AACpB,0BAAO"}
\ No newline at end of file
/** @format */
import { BaseDao } from 'taobao-mini-sdk/lib/dao/base.dao';
import TBAPIS from 'taobao-mini-sdk/lib/service/TBAPI';
declare const DEFAULT_CODE_TYPES: {
PARAMS_ERROR: import("taobao-mini-sdk/lib/utils/codetypes").CodeType;
SYSTEM_ERROR: import("taobao-mini-sdk/lib/utils/codetypes").CodeType;
SUCCESS: import("taobao-mini-sdk/lib/utils/codetypes").CodeType;
}, dateFormatter: (thisDate: Date, fmt?: string) => string, transformBeijingDate: (day: string | number) => Date, getStartTimestamp: (day: string) => number, getEndTimestamp: (day: string) => number;
declare const resultsModel: import("taobao-mini-sdk/lib/utils/resultmodel").ResultsModel;
export { DEFAULT_CODE_TYPES, resultsModel, BaseDao, TBAPIS, dateFormatter, transformBeijingDate, getStartTimestamp, getEndTimestamp };
"use strict";
/** @format */
Object.defineProperty(exports, "__esModule", { value: true });
exports.getEndTimestamp = exports.getStartTimestamp = exports.transformBeijingDate = exports.dateFormatter = exports.TBAPIS = exports.BaseDao = exports.resultsModel = exports.DEFAULT_CODE_TYPES = void 0;
var index_1 = require("taobao-mini-sdk/lib/utils/index");
var base_dao_1 = require("taobao-mini-sdk/lib/dao/base.dao");
Object.defineProperty(exports, "BaseDao", { enumerable: true, get: function () { return base_dao_1.BaseDao; } });
var TBAPI_1 = require("taobao-mini-sdk/lib/service/TBAPI");
exports.TBAPIS = TBAPI_1.default;
var MockConfig = require('./mockServer/sdk');
var DEFAULT_CODE_TYPES = index_1.default.DEFAULT_CODE_TYPES, dateFormatter = index_1.default.dateFormatter, transformBeijingDate = index_1.default.transformBeijingDate, getStartTimestamp = index_1.default.getStartTimestamp, getEndTimestamp = index_1.default.getEndTimestamp, ResultsModel = index_1.default.ResultsModel;
exports.DEFAULT_CODE_TYPES = DEFAULT_CODE_TYPES;
exports.dateFormatter = dateFormatter;
exports.transformBeijingDate = transformBeijingDate;
exports.getStartTimestamp = getStartTimestamp;
exports.getEndTimestamp = getEndTimestamp;
var resultsModel = new ResultsModel();
exports.resultsModel = resultsModel;
var mock = process.argv[2];
console.log("mock", mock);
//# sourceMappingURL=sdk.cloud.js.map
\ No newline at end of file
{"version":3,"file":"sdk.cloud.js","sourceRoot":"","sources":["../../src/sdk/sdk.cloud.ts"],"names":[],"mappings":";AAAA,cAAc;;;AAEd,yDAAmD;AACnD,6DAA0D;AAqBxD,wFArBO,kBAAO,OAqBP;AApBT,2DAAsD;AAqBpD,iBArBK,eAAM,CAqBL;AApBR,IAAI,UAAU,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAA;AAG1C,IAAA,kBAAkB,GAMhB,eAAK,mBANW,EAClB,aAAa,GAKX,eAAK,cALM,EACb,oBAAoB,GAIlB,eAAK,qBAJa,EACpB,iBAAiB,GAGf,eAAK,kBAHU,EACjB,eAAe,GAEb,eAAK,gBAFQ,EACf,YAAY,GACV,eAAK,aADK,CACL;AAQP,gDAAkB;AAIlB,sCAAa;AACb,oDAAoB;AACpB,8CAAiB;AACjB,0CAAe;AAbjB,IAAM,YAAY,GAAG,IAAI,YAAY,EAAE,CAAA;AAOrC,oCAAY;AALd,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AAC1B,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA"}
\ No newline at end of file
/** @format */
declare const BaseDao: any, TBAPI: any, Utils: any;
declare const DEFAULT_CODE_TYPES: any, dateFormatter: any, transformBeijingDate: any, getStartTimestamp: any, getEndTimestamp: any, ResultsModel: any;
declare const resultsModel: any;
declare const TBAPIS: any;
declare let default_sdk: {
DEFAULT_CODE_TYPES: any;
resultsModel: any;
dateFormatter: any;
getStartTimestamp: any;
getEndTimestamp: any;
};
declare let Config: {
DEFAULT_CODE_TYPES: any;
resultsModel: any;
dateFormatter: any;
getStartTimestamp: any;
getEndTimestamp: any;
};
declare let mock: string;
/** @format */
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
// 特别注意以下的引用方式,需要.default
var _a = require('taobao-mini-sdk/lib/index').default, BaseDao = _a.BaseDao, TBAPI = _a.TBAPI, Utils = _a.Utils;
var _b = Utils.default, DEFAULT_CODE_TYPES = _b.DEFAULT_CODE_TYPES, dateFormatter = _b.dateFormatter, transformBeijingDate = _b.transformBeijingDate, getStartTimestamp = _b.getStartTimestamp, getEndTimestamp = _b.getEndTimestamp, ResultsModel = _b.ResultsModel;
var resultsModel = new ResultsModel();
var TBAPIS = TBAPI.default;
var default_sdk = {
DEFAULT_CODE_TYPES: DEFAULT_CODE_TYPES,
resultsModel: resultsModel,
dateFormatter: dateFormatter,
getStartTimestamp: getStartTimestamp,
getEndTimestamp: getEndTimestamp
};
var Config = __assign({}, default_sdk);
var mock = process.argv[2];
console.log("mock", mock, Config);
// 云函数环境
if (mock !== 'mock') {
Config = Object.assign({}, default_sdk, {
BaseDao: BaseDao,
TBAPIS: TBAPIS,
transformBeijingDate: transformBeijingDate,
resultsModel: resultsModel
});
}
// 本地环境
else {
var MockConfig = require('./mockServer/sdk');
Config = Object.assign({}, default_sdk, MockConfig);
console.log(Config);
}
console.log(Config);
module.exports = Config;
//# sourceMappingURL=sdk.js.map
\ No newline at end of file
{"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../src/sdk/sdk.ts"],"names":[],"mappings":"AAAA,cAAc;;;;;;;;;;;;AAEd,yBAAyB;AACnB,IAAA,KAA4B,OAAO,CAAC,2BAA2B,CAAC,CAAC,OAAO,EAAtE,OAAO,aAAA,EAAE,KAAK,WAAA,EAAE,KAAK,WAAiD,CAAA;AAExE,IAAA,KAOF,KAAK,CAAC,OAAO,EANf,kBAAkB,wBAAA,EAClB,aAAa,mBAAA,EACb,oBAAoB,0BAAA,EACpB,iBAAiB,uBAAA,EACjB,eAAe,qBAAA,EACf,YAAY,kBACG,CAAA;AAEjB,IAAM,YAAY,GAAG,IAAI,YAAY,EAAE,CAAA;AAEvC,IAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAA;AAE5B,IAAI,WAAW,GAAG;IAChB,kBAAkB,oBAAA;IAClB,YAAY,cAAA;IACZ,aAAa,eAAA;IACb,iBAAiB,mBAAA;IACjB,eAAe,iBAAA;CAChB,CAAA;AAED,IAAI,MAAM,gBACL,WAAW,CACf,CAAA;AAED,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AAC1B,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAA;AACjC,QAAQ;AACR,IAAI,IAAI,KAAK,MAAM,EAAE;IACnB,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,WAAW,EAAE;QACtC,OAAO,SAAA;QACP,MAAM,QAAA;QACN,oBAAoB,sBAAA;QACpB,YAAY,cAAA;KACb,CAAC,CAAA;CACH;AACD,OAAO;KACF;IACH,IAAI,UAAU,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAA;IAC5C,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,WAAW,EAAE,UAAU,CAAC,CAAA;IACnD,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;CACpB;AACD,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;AACnB,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA"}
\ No newline at end of file
//# sourceMappingURL=sdk.local.js.map
\ No newline at end of file
{"version":3,"file":"sdk.local.js","sourceRoot":"","sources":["../../src/sdk/sdk.local.ts"],"names":[],"mappings":""}
\ No newline at end of file
/** @format */
import { BaseDao } from 'taobao-mini-sdk/lib/dao/base.dao';
import TBAPI from 'taobao-mini-sdk/lib/service/TBAPI';
declare const DEFAULT_CODE_TYPES: {
PARAMS_ERROR: import("taobao-mini-sdk/lib/utils/codetypes").CodeType;
SYSTEM_ERROR: import("taobao-mini-sdk/lib/utils/codetypes").CodeType;
SUCCESS: import("taobao-mini-sdk/lib/utils/codetypes").CodeType;
}, dateFormatter: (thisDate: Date, fmt?: string) => string, transformBeijingDate: (day: string | number) => Date, getStartTimestamp: (day: string) => number, getEndTimestamp: (day: string) => number;
declare const resultsModel: import("taobao-mini-sdk/lib/utils/resultmodel").ResultsModel;
export { DEFAULT_CODE_TYPES, resultsModel, BaseDao, TBAPI, dateFormatter, transformBeijingDate, getStartTimestamp, getEndTimestamp };
"use strict";
/** @format */
Object.defineProperty(exports, "__esModule", { value: true });
exports.getEndTimestamp = exports.getStartTimestamp = exports.transformBeijingDate = exports.dateFormatter = exports.TBAPI = exports.BaseDao = exports.resultsModel = exports.DEFAULT_CODE_TYPES = void 0;
// 特别注意以下的引用方式,需要.default
var index_1 = require("taobao-mini-sdk/lib/utils/index");
var base_dao_1 = require("taobao-mini-sdk/lib/dao/base.dao");
Object.defineProperty(exports, "BaseDao", { enumerable: true, get: function () { return base_dao_1.BaseDao; } });
var TBAPI_1 = require("taobao-mini-sdk/lib/service/TBAPI");
exports.TBAPI = TBAPI_1.default;
var DEFAULT_CODE_TYPES = index_1.default.DEFAULT_CODE_TYPES, dateFormatter = index_1.default.dateFormatter, transformBeijingDate = index_1.default.transformBeijingDate, getStartTimestamp = index_1.default.getStartTimestamp, getEndTimestamp = index_1.default.getEndTimestamp, ResultsModel = index_1.default.ResultsModel;
exports.DEFAULT_CODE_TYPES = DEFAULT_CODE_TYPES;
exports.dateFormatter = dateFormatter;
exports.transformBeijingDate = transformBeijingDate;
exports.getStartTimestamp = getStartTimestamp;
exports.getEndTimestamp = getEndTimestamp;
var resultsModel = new ResultsModel();
exports.resultsModel = resultsModel;
//# sourceMappingURL=sdk1.js.map
\ No newline at end of file
{"version":3,"file":"sdk1.js","sourceRoot":"","sources":["../src/sdk1.ts"],"names":[],"mappings":";AAAA,cAAc;;;AAEd,yBAAyB;AACzB,yDAAmD;AACnD,6DAA0D;AAiBxD,wFAjBO,kBAAO,OAiBP;AAhBT,2DAAqD;AAiBnD,gBAjBK,eAAK,CAiBL;AAdL,IAAA,kBAAkB,GAMhB,eAAK,mBANW,EAClB,aAAa,GAKX,eAAK,cALM,EACb,oBAAoB,GAIlB,eAAK,qBAJa,EACpB,iBAAiB,GAGf,eAAK,kBAHU,EACjB,eAAe,GAEb,eAAK,gBAFQ,EACf,YAAY,GACV,eAAK,aADK,CACL;AAKP,gDAAkB;AAIlB,sCAAa;AACb,oDAAoB;AACpB,8CAAiB;AACjB,0CAAe;AAVjB,IAAM,YAAY,GAAG,IAAI,YAAY,EAAE,CAAA;AAIrC,oCAAY"}
\ No newline at end of file
/** @format */
declare const BaseDao: any, TBAPI: any, Utils: any;
declare const DEFAULT_CODE_TYPES: any, dateFormatter: any, transformBeijingDate: any, getStartTimestamp: any, getEndTimestamp: any, ResultsModel: any;
declare const TBAPIS: any;
declare let default_sdk: {
DEFAULT_CODE_TYPES: any;
ResultsModel: any;
dateFormatter: any;
getStartTimestamp: any;
getEndTimestamp: any;
};
declare let Config: any;
declare let mock: string;
/** @format */
// 特别注意以下的引用方式,需要.default
var _a = require('taobao-mini-sdk/lib/index').default, BaseDao = _a.BaseDao, TBAPI = _a.TBAPI, Utils = _a.Utils;
var _b = Utils.default, DEFAULT_CODE_TYPES = _b.DEFAULT_CODE_TYPES, dateFormatter = _b.dateFormatter, transformBeijingDate = _b.transformBeijingDate, getStartTimestamp = _b.getStartTimestamp, getEndTimestamp = _b.getEndTimestamp, ResultsModel = _b.ResultsModel;
var TBAPIS = TBAPI.default;
var default_sdk = {
DEFAULT_CODE_TYPES: DEFAULT_CODE_TYPES,
ResultsModel: ResultsModel,
dateFormatter: dateFormatter,
getStartTimestamp: getStartTimestamp,
getEndTimestamp: getEndTimestamp
};
var Config;
var mock = process.argv[2];
console.log("mock", mock);
// 云函数环境
if (mock !== 'mock') {
Config = Object.assign({}, default_sdk, {
BaseDao: BaseDao,
TBAPIS: TBAPIS,
transformBeijingDate: transformBeijingDate
});
}
// 本地环境
else {
var MockConfig = require('./mockServer/sdk');
Config = Object.assign({}, default_sdk, MockConfig);
console.log(Config);
}
module.exports = Config;
//# sourceMappingURL=sdkqq.js.map
\ No newline at end of file
{"version":3,"file":"sdkqq.js","sourceRoot":"","sources":["../src/sdkqq.ts"],"names":[],"mappings":"AAAA,cAAc;AAEd,yBAAyB;AACnB,IAAA,KAA4B,OAAO,CAAC,2BAA2B,CAAC,CAAC,OAAO,EAAtE,OAAO,aAAA,EAAE,KAAK,WAAA,EAAE,KAAK,WAAiD,CAAA;AACxE,IAAA,KAOF,KAAK,CAAC,OAAO,EANf,kBAAkB,wBAAA,EAClB,aAAa,mBAAA,EACb,oBAAoB,0BAAA,EACpB,iBAAiB,uBAAA,EACjB,eAAe,qBAAA,EACf,YAAY,kBACG,CAAA;AACjB,IAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAA;AAE5B,IAAI,WAAW,GAAG;IAChB,kBAAkB,oBAAA;IAClB,YAAY,cAAA;IACZ,aAAa,eAAA;IACb,iBAAiB,mBAAA;IACjB,eAAe,iBAAA;CAChB,CAAA;AAED,IAAI,MAAM,CAAA;AAEV,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AAC1B,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;AACzB,QAAQ;AACR,IAAI,IAAI,KAAK,MAAM,EAAE;IACnB,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,WAAW,EAAE;QACtC,OAAO,SAAA;QACP,MAAM,QAAA;QACN,oBAAoB,sBAAA;KACrB,CAAC,CAAA;CACH;AACD,OAAO;KACF;IACH,IAAI,UAAU,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAA;IAC5C,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,WAAW,EAAE,UAAU,CAAC,CAAA;IACnD,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;CACpB;AACD,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA"}
\ No newline at end of file
/**
* 访问明细
*
* @format
*/
export default class UserAccessService {
context: IContext<IParams>;
accessdao: IBaseDao;
constructor(context: IContext<IParams>);
/**
* 增加访问记录
* @param {是否关注店铺} isFollow
*/
addAccess(isFollow: boolean, isVip: boolean): Promise<any>;
getAccessCount(): Promise<any>;
}
"use strict";
/**
* 访问明细
*
* @format
*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
var sdk_1 = require("../sdk");
var utils_1 = require("../utils");
var db_1 = require("../db");
var UserAccessService = /** @class */ (function () {
function UserAccessService(context) {
this.context = context;
this.accessdao = new sdk_1.BaseDao(context, db_1.ACCESS_DB_NAME);
}
/**
* 增加访问记录
* @param {是否关注店铺} isFollow
*/
UserAccessService.prototype.addAccess = function (isFollow, isVip) {
return __awaiter(this, void 0, void 0, function () {
var _a, openId, data, activityId, userNick, avatar, inviteId;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
_a = this.context, openId = _a.openId, data = _a.data;
activityId = data.activityId, userNick = data.userNick, avatar = data.avatar, inviteId = data.inviteId;
return [4 /*yield*/, this.accessdao.insertOne({
openId: openId,
activityId: activityId,
userNick: userNick,
avatar: avatar,
isReceiveShare: !!inviteId,
inviteId: inviteId,
isFollow: isFollow,
isVip: isVip,
accessTime: Date.now(),
createTime: Date.now(),
updateTime: Date.now(),
createDay: utils_1.getToday()
})];
case 1: return [2 /*return*/, _b.sent()];
}
});
});
};
UserAccessService.prototype.getAccessCount = function () {
return __awaiter(this, void 0, void 0, function () {
var _a, openId, data, activityId;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
_a = this.context, openId = _a.openId, data = _a.data;
activityId = data.activityId;
return [4 /*yield*/, this.accessdao.count({
openId: openId,
activityId: activityId
})];
case 1: return [2 /*return*/, _b.sent()];
}
});
});
};
return UserAccessService;
}());
exports.default = UserAccessService;
//# sourceMappingURL=access.service.js.map
\ No newline at end of file
{"version":3,"file":"access.service.js","sourceRoot":"","sources":["../../src/service/access.service.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,8BAAgC;AAChC,kCAAmC;AACnC,4BAAsC;AAEtC;IAGE,2BAAY,OAA0B;QACpC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,SAAS,GAAG,IAAI,aAAO,CAAC,OAAO,EAAE,mBAAc,CAAC,CAAA;IACvD,CAAC;IACD;;;OAGG;IACG,qCAAS,GAAf,UAAgB,QAAiB,EAAE,KAAc;;;;;;wBAC3C,KAAmB,IAAI,CAAC,OAAO,EAA7B,MAAM,YAAA,EAAE,IAAI,UAAA,CAAiB;wBAC7B,UAAU,GAAiC,IAAI,WAArC,EAAE,QAAQ,GAAuB,IAAI,SAA3B,EAAE,MAAM,GAAe,IAAI,OAAnB,EAAE,QAAQ,GAAK,IAAI,SAAT,CAAS;wBAE9C,qBAAM,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC;gCACpC,MAAM,QAAA;gCACN,UAAU,YAAA;gCACV,QAAQ,UAAA;gCACR,MAAM,QAAA;gCACN,cAAc,EAAE,CAAC,CAAC,QAAQ;gCAC1B,QAAQ,UAAA;gCACR,QAAQ,UAAA;gCACR,KAAK,OAAA;gCACL,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE;gCACtB,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE;gCACtB,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE;gCACtB,SAAS,EAAE,gBAAQ,EAAE;6BACtB,CAAC,EAAA;4BAbF,sBAAO,SAaL,EAAA;;;;KACH;IAEK,0CAAc,GAApB;;;;;;wBACM,KAAmB,IAAI,CAAC,OAAO,EAA7B,MAAM,YAAA,EAAE,IAAI,UAAA,CAAiB;wBAC7B,UAAU,GAAK,IAAI,WAAT,CAAS;wBAClB,qBAAM,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;gCAChC,MAAM,QAAA;gCACN,UAAU,YAAA;6BACX,CAAC,EAAA;4BAHF,sBAAO,SAGL,EAAA;;;;KACH;IACH,wBAAC;AAAD,CAAC,AAvCD,IAuCC"}
\ No newline at end of file
/**
* 奖励
*
* @format
*/
import UserService from './user.service';
export default class AwardsService extends UserService {
awardsdao: IBaseDao;
activityprizedao: IBaseDao;
constructor(context: IContext<IParams>);
reduceStock(_id: string): Promise<any>;
/**
* 插入奖品记录
* @param {*} award
*/
addAward(award: IAwards): Promise<any>;
/**
* 发放奖品
* @param {*} document
*/
sendAward(document: IAwards): Promise<import("taobao-mini-sdk/lib/utils/codetypes").CodeType | IAwards>;
/**
* 我的奖品
* @param {*} param0
*/
getMyPrizeList({ openId, activityId }: {
openId: string;
activityId: string;
}): Promise<Array<IAwards>>;
recieveObjectPrize(_id: string, { activityId, province, city, area, addressdetail, name, phone }: {
activityId: string;
province: string;
city: string;
area: string;
addressdetail: string;
name: string;
phone: string | number;
}): Promise<true | import("taobao-mini-sdk/lib/utils/codetypes").CodeType>;
recieveEnamePrize(_id: string, activityId: string): Promise<{}>;
getPrizeConfig(query: {
activityId: string;
[queryParam: string]: any;
}): Promise<Array<IActivityPrize>>;
getPrizeByProbability(prizes: Array<IActivityPrize>): Promise<IActivityPrize>;
/**
* 获取活动配置项奖品
* @param {string} _id
*/
getActivityPrizeById(_id: string): Promise<any>;
}
"use strict";
/**
* 奖励
*
* @format
*/
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
var sdk_1 = require("../sdk");
var user_service_1 = require("./user.service");
var constants_1 = require("../constants");
var db_1 = require("../db");
var utils_1 = require("../utils");
var AwardsService = /** @class */ (function (_super) {
__extends(AwardsService, _super);
function AwardsService(context) {
var _this = _super.call(this, context) || this;
_this.awardsdao = new sdk_1.BaseDao(context, db_1.AWARDS_DB_NAME);
_this.activityprizedao = new sdk_1.BaseDao(context, db_1.PRIZE_CONFIG_DB_NAME);
return _this;
}
// 根据奖品Id扣库存, 扣库存成功返回为1
AwardsService.prototype.reduceStock = function (_id) {
return __awaiter(this, void 0, void 0, function () {
var result, switchStock, stock, useStock, e_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.activityprizedao.findOne({ _id: _id, deleteStatus: 1 /* NORMAL */ })
// 奖品不存在
];
case 1:
result = _a.sent();
// 奖品不存在
if (!result) {
return [2 /*return*/, constants_1.CODE_TYPES.ERROR_NO_PRIZE];
}
switchStock = result.switchStock, stock = result.stock, useStock = result.useStock;
// 若不限制库存
if (switchStock === constants_1.SWICH_TOCK.NO_LIMIT) {
return [2 /*return*/, 1];
}
// 若库存不足
if (useStock >= stock) {
return [2 /*return*/, constants_1.CODE_TYPES.ERROR_NO_STOCK];
}
_a.label = 2;
case 2:
_a.trys.push([2, 4, , 5]);
return [4 /*yield*/, this.activityprizedao.update({
_id: _id,
$where: 'this.useStock < this.stock'
}, {
$inc: {
useStock: +1
}
})];
case 3: return [2 /*return*/, _a.sent()];
case 4:
e_1 = _a.sent();
console.log("\u6263\u5E93\u5B58\u5931\u8D25\uFF1A", e_1);
return [2 /*return*/, constants_1.CODE_TYPES.SYSTEM_ERROR];
case 5: return [2 /*return*/];
}
});
});
};
/**
* 插入奖品记录
* @param {*} award
*/
AwardsService.prototype.addAward = function (award) {
return __awaiter(this, void 0, void 0, function () {
var e_2;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, 2, , 3]);
return [4 /*yield*/, this.awardsdao.insertOne(__assign(__assign({}, award), { createTime: Date.now(), updateTime: Date.now() }))];
case 1: return [2 /*return*/, _a.sent()];
case 2:
e_2 = _a.sent();
console.log("\u63D2\u5165\u4E2D\u5956\u8BB0\u5F55\u9519\u8BEF:", e_2);
return [2 /*return*/, constants_1.CODE_TYPES.SYSTEM_ERROR];
case 3: return [2 /*return*/];
}
});
});
};
/**
* 发放奖品
* @param {*} document
*/
AwardsService.prototype.sendAward = function (document) {
return __awaiter(this, void 0, void 0, function () {
var session, result, _id, update;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, utils_1.getSellerSession(this.context)
// 发放淘宝权益
];
case 1:
session = (_a.sent()).session;
return [4 /*yield*/, utils_1.sendTBAward(this.context, session, document)
//@ts-ignore
];
case 2:
result = _a.sent();
//@ts-ignore
if (result.code) {
return [2 /*return*/, result];
}
_id = document._id;
return [4 /*yield*/, this.awardsdao.update({ _id: _id }, {
$set: {
drawStatus: document.drawStatus,
remark: document.remark,
updateTime: Date.now()
}
})];
case 3:
update = _a.sent();
console.log("\u66F4\u65B0\u5956\u54C1\u72B6\u6001", update, document);
return [2 /*return*/, document];
}
});
});
};
/**
* 我的奖品
* @param {*} param0
*/
AwardsService.prototype.getMyPrizeList = function (_a) {
var openId = _a.openId, activityId = _a.activityId;
return __awaiter(this, void 0, void 0, function () {
var awardReceiveExpiredTime, myprizeList, currentTime_1;
return __generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, this.getBaseInfo(activityId)];
case 1:
awardReceiveExpiredTime = (_b.sent()).awardReceiveExpiredTime;
return [4 /*yield*/, this.awardsdao.find({ openId: openId, activityId: activityId }, {
sort: {
createTime: -1
}
})
// 若有过期时间,且已过期
];
case 2:
myprizeList = _b.sent();
// 若有过期时间,且已过期
if (awardReceiveExpiredTime) {
currentTime_1 = Date.now();
myprizeList = myprizeList.map(function (v) {
if (currentTime_1 > awardReceiveExpiredTime) {
if ([constants_1.DRAW_STATUS.WAITAWARD, constants_1.DRAW_STATUS.RETRY].includes(v.drawStatus)) {
v.drawStatus = constants_1.DRAW_STATUS.EXPIRED;
v.remark = "\u5956\u54C1\u5DF2\u8FC7\u671F";
}
}
v.expiredTime = awardReceiveExpiredTime;
});
}
return [2 /*return*/, myprizeList];
}
});
});
};
// 领取实物
AwardsService.prototype.recieveObjectPrize = function (_id, _a) {
var activityId = _a.activityId, province = _a.province, city = _a.city, area = _a.area, addressdetail = _a.addressdetail, name = _a.name, phone = _a.phone;
return __awaiter(this, void 0, void 0, function () {
var awardReceiveExpiredTime, award, result, e_3;
return __generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, this.getBaseInfo(activityId)];
case 1:
awardReceiveExpiredTime = (_b.sent()).awardReceiveExpiredTime;
if (awardReceiveExpiredTime && Date.now() > awardReceiveExpiredTime) {
return [2 /*return*/, constants_1.CODE_TYPES.ERROR_PRIZE_EXPIRED];
}
return [4 /*yield*/, this.awardsdao.findOne({ _id: _id })];
case 2:
award = _b.sent();
console.log("receiveObject-award", award);
// 奖品不存在
if (!award) {
return [2 /*return*/, constants_1.CODE_TYPES.ERROR_NO_PRIZE];
}
// 已领取
if (award.drawStatus === constants_1.DRAW_STATUS.SUCCESS) {
return [2 /*return*/, constants_1.CODE_TYPES.ERROR_RECEIVE_PRIZE];
}
// 不是实物,非法操作
if (award.type !== constants_1.PRIZE_TYPE.OBJECT) {
return [2 /*return*/, constants_1.CODE_TYPES.ERROR_FORBIDDEN_OPE];
}
_b.label = 3;
case 3:
_b.trys.push([3, 5, , 6]);
return [4 /*yield*/, this.awardsdao.update({ _id: _id }, {
$set: {
receiveName: name,
phone: phone,
drawStatus: constants_1.DRAW_STATUS.SUCCESS,
province: province,
city: city,
area: area,
addressdetail: addressdetail,
receiveTime: Date.now(),
updateTime: Date.now()
}
})];
case 4:
result = _b.sent();
return [2 /*return*/, true];
case 5:
e_3 = _b.sent();
console.log("\u9886\u53D6\u5B9E\u7269\u9519\u8BEF\uFF1A", e_3);
return [2 /*return*/, constants_1.CODE_TYPES.SYSTEM_ERROR];
case 6: return [2 /*return*/];
}
});
});
};
// 发放淘宝权益(奖品数据已插入到awards_info表,且状态drawStatus 为1或者6)
AwardsService.prototype.recieveEnamePrize = function (_id, activityId) {
return __awaiter(this, void 0, void 0, function () {
var awardReceiveExpiredTime, result, award, session;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.getBaseInfo(activityId)];
case 1:
awardReceiveExpiredTime = (_a.sent()).awardReceiveExpiredTime;
if (awardReceiveExpiredTime && Date.now() > awardReceiveExpiredTime) {
return [2 /*return*/, constants_1.CODE_TYPES.ERROR_PRIZE_EXPIRED];
}
result = {};
return [4 /*yield*/, this.awardsdao.findOne({ _id: _id })
// 奖品不存在
];
case 2:
award = _a.sent();
// 奖品不存在
if (!award) {
return [2 /*return*/, constants_1.CODE_TYPES.ERROR_NO_PRIZE];
}
// 已领取
if (award.drawStatus === constants_1.DRAW_STATUS.SUCCESS) {
return [2 /*return*/, constants_1.CODE_TYPES.ERROR_RECEIVE_PRIZE];
}
console.log("award.drawStatus", award.drawStatus);
// 状态不是1,6
if (![constants_1.DRAW_STATUS.WAITAWARD, constants_1.DRAW_STATUS.RETRY].includes(award.drawStatus)) {
return [2 /*return*/, constants_1.CODE_TYPES.ERROR_FORBIDDEN_OPE];
}
return [4 /*yield*/, utils_1.getSellerSession(this.context)
// 发放淘宝权益
];
case 3:
session = (_a.sent()).session;
return [4 /*yield*/, utils_1.sendTBAward(this.context, session, award)
// 更新
];
case 4:
// 发放淘宝权益
result = _a.sent();
// 更新
return [4 /*yield*/, this.awardsdao.update({ _id: _id }, {
$set: {
// @ts-ignore
drawStatus: result.drawStatus,
// @ts-ignore
remark: result.remark,
updateTime: Date.now()
}
})];
case 5:
// 更新
_a.sent();
return [2 /*return*/, result];
}
});
});
};
// 根据查询条件获取奖品配置
AwardsService.prototype.getPrizeConfig = function (query) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this.activityprizedao.find(__assign({ deleteStatus: 1 /* NORMAL */ }, query))];
});
});
};
// 根据概率抽取奖品
AwardsService.prototype.getPrizeByProbability = function (prizes) {
return __awaiter(this, void 0, void 0, function () {
var probability;
return __generator(this, function (_a) {
probability = utils_1.rand(10000);
return [2 /*return*/, prizes.find(function (v) { return probability <= v.properiodto && probability >= v.properiodfrom; })];
});
});
};
/**
* 获取活动配置项奖品
* @param {string} _id
*/
AwardsService.prototype.getActivityPrizeById = function (_id) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.activityprizedao.findOne({ _id: _id, deleteStatus: 1 /* NORMAL */ }, {
sort: {
index: 1
}
})];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
return AwardsService;
}(user_service_1.default));
exports.default = AwardsService;
//# sourceMappingURL=awards.service.js.map
\ No newline at end of file
{"version":3,"file":"awards.service.js","sourceRoot":"","sources":["../../src/service/awards.service.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,8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U;oCAC7B,aAAa;oCACb,MAAM,EAAE,MAAM,CAAC,MAAM;oCACrB,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE;iCACvB;6BACF,CACF,EAAA;;wBAZD,KAAK;wBACL,SAWC,CAAA;wBACD,sBAAO,MAAM,EAAA;;;;KACd;IAED,eAAe;IACT,sCAAc,GAApB,UAAqB,KAAwD;;;gBAC3E,sBAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,YAC/B,YAAY,oBACT,KAAK,EACR,EAAA;;;KACH;IAED,WAAW;IACL,6CAAqB,GAA3B,UAA4B,MAA6B;;;;gBAEjD,WAAW,GAAG,YAAI,CAAC,KAAK,CAAC,CAAA;gBAE/B,sBAAO,MAAM,CAAC,IAAI,CAAC,UAAA,CAAC,IAAI,OAAA,WAAW,IAAI,CAAC,CAAC,WAAW,IAAI,WAAW,IAAI,CAAC,CAAC,aAAa,EAA9D,CAA8D,CAAC,EAAA;;;KACxF;IAED;;;OAGG;IACG,4CAAoB,GAA1B,UAA2B,GAAW;;;;4BAC7B,qBAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,CACxC,EAAE,GAAG,KAAA,EAAE,YAAY,gBAAwB,EAAE,EAC7C;4BACE,IAAI,EAAE;gCACJ,KAAK,EAAE,CAAC;6BACT;yBACF,CACF,EAAA;4BAPD,sBAAO,SAON,EAAA;;;;KACF;IACH,oBAAC;AAAD,CAAC,AA/PD,CAA2C,sBAAW,GA+PrD"}
\ No newline at end of file
/**
* 基本信息
*
* @format
*/
export default class BaseService {
context: IContext<any>;
activitydao: IBaseDao;
constructor(context: IContext<any>);
/**
* @desc 活动基本信息
* @param {活动id} activityId
* @returns 返回活动详情,若不存在活动,返回为null
*/
getBaseInfo(activityId: string): Promise<IActivityInfo>;
/**
*
* 根据itemIds获取商品列表
*
* @param {string} itemIds
* @param {string} session
* @return {Array}
* @memberof BaseService
*/
getItemListByIds(itemIds: string, session: string): Promise<Array<ITaoBaoItems>>;
}
"use strict";
/**
* 基本信息
*
* @format
*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
var sdk_1 = require("../sdk");
var db_1 = require("../db");
var BaseService = /** @class */ (function () {
function BaseService(context) {
this.context = context;
this.activitydao = new sdk_1.BaseDao(context, db_1.ACTIVITY_CONFIG_DB_NAME);
}
/**
* @desc 活动基本信息
* @param {活动id} activityId
* @returns 返回活动详情,若不存在活动,返回为null
*/
BaseService.prototype.getBaseInfo = function (activityId) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.activitydao.findOne({ _id: activityId, deleteStatus: 1 /* NORMAL */ })];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
/**
*
* 根据itemIds获取商品列表
*
* @param {string} itemIds
* @param {string} session
* @return {Array}
* @memberof BaseService
*/
BaseService.prototype.getItemListByIds = function (itemIds, session) {
var _a;
return __awaiter(this, void 0, void 0, function () {
var GOODSINFO, result, items, list;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
GOODSINFO = 'detail_url,approve_status,num_iid,title,nick,type,cid,pic_url,num,props,valid_thru,list_time,desc,price,has_discount,has_invoice,has_warranty,has_showcase,modified,delist_time,postage_id,seller_cids,outer_id,sold_quantity';
return [4 /*yield*/, sdk_1.TBAPIS.getItemListByItemIds(this.context, session, itemIds, { fields: GOODSINFO })];
case 1:
result = _b.sent();
items = ((_a = result === null || result === void 0 ? void 0 : result.items) === null || _a === void 0 ? void 0 : _a.item) || [];
list = items.map(function (v) {
return {
itemId: v.num_iid,
name: v.title,
price: v.price,
url: v.detail_url,
image: v.pic_url,
desc: v.desc
};
});
return [2 /*return*/, list];
}
});
});
};
return BaseService;
}());
exports.default = BaseService;
//# sourceMappingURL=base.service.js.map
\ No newline at end of file
{"version":3,"file":"base.service.js","sourceRoot":"","sources":["../../src/service/base.service.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,8BAAwC;AACxC,4BAA+C;AAG/C;IAGE,qBAAY,OAAsB;QAChC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,WAAW,GAAG,IAAI,aAAO,CAAC,OAAO,EAAE,4BAAuB,CAAC,CAAA;IAClE,CAAC;IACD;;;;OAIG;IACG,iCAAW,GAAjB,UAAkB,UAAkB;;;;4BAC3B,qBAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,UAAU,EAAE,YAAY,gBAAwB,EAAE,CAAC,EAAA;4BAAhG,sBAAO,SAAyF,EAAA;;;;KACjG;IAED;;;;;;;;OAQG;IACG,sCAAgB,GAAtB,UAAuB,OAAe,EAAE,OAAe;;;;;;;wBAC/C,SAAS,GACb,+NAA+N,CAAA;wBAClN,qBAAM,YAAM,CAAC,oBAAoB,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,EAAA;;wBAAjG,MAAM,GAAG,SAAwF;wBACjG,KAAK,GAAG,OAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,0CAAE,IAAI,KAAI,EAAE,CAAA;wBACjC,IAAI,GAAG,KAAK,CAAC,GAAG,CACpB,UAAC,CAAuG;4BACtG,OAAO;gCACL,MAAM,EAAE,CAAC,CAAC,OAAO;gCACjB,IAAI,EAAE,CAAC,CAAC,KAAK;gCACb,KAAK,EAAE,CAAC,CAAC,KAAK;gCACd,GAAG,EAAE,CAAC,CAAC,UAAU;gCACjB,KAAK,EAAE,CAAC,CAAC,OAAO;gCAChB,IAAI,EAAE,CAAC,CAAC,IAAI;6BACb,CAAA;wBACH,CAAC,CACF,CAAA;wBACD,sBAAO,IAAI,EAAA;;;;KACZ;IACH,kBAAC;AAAD,CAAC,AA5CD,IA4CC"}
\ No newline at end of file
/** @format */
export { default as AccessService } from './access.service';
export { default as BaseService } from './base.service';
export { default as UserService } from './user.service';
export { default as AwardsService } from './awards.service';
export { default as TaskService } from './task.service';
"use strict";
/** @format */
Object.defineProperty(exports, "__esModule", { value: true });
var access_service_1 = require("./access.service");
Object.defineProperty(exports, "AccessService", { enumerable: true, get: function () { return access_service_1.default; } });
var base_service_1 = require("./base.service");
Object.defineProperty(exports, "BaseService", { enumerable: true, get: function () { return base_service_1.default; } });
var user_service_1 = require("./user.service");
Object.defineProperty(exports, "UserService", { enumerable: true, get: function () { return user_service_1.default; } });
var awards_service_1 = require("./awards.service");
Object.defineProperty(exports, "AwardsService", { enumerable: true, get: function () { return awards_service_1.default; } });
var task_service_1 = require("./task.service");
Object.defineProperty(exports, "TaskService", { enumerable: true, get: function () { return task_service_1.default; } });
//# sourceMappingURL=index.js.map
\ No newline at end of file
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/service/index.ts"],"names":[],"mappings":";AAAA,cAAc;;AAEd,mDAA2D;AAAlD,+GAAA,OAAO,OAAiB;AACjC,+CAAuD;AAA9C,2GAAA,OAAO,OAAe;AAC/B,+CAAuD;AAA9C,2GAAA,OAAO,OAAe;AAC/B,mDAA2D;AAAlD,+GAAA,OAAO,OAAiB;AACjC,+CAAuD;AAA9C,2GAAA,OAAO,OAAe"}
\ No newline at end of file
import UserService from './user.service';
import { BaseDao } from '../sdk';
export default class RecordService extends UserService {
recorddao: BaseDao;
constructor(context: Context);
addReceiveShareRecord(): Promise<any>;
getGamePrizeRecordDetail(): Promise<any>;
addDoLikeRecord(): Promise<any>;
addRecord(recordType: any, customData?: any): Promise<any>;
getLikeTotal(): Promise<any>;
getLikeByDay(createDay: string): Promise<any>;
getRecordCountByType(recordType: any, openId: string, customData?: {}): Promise<any>;
initRecordData({ recordType }: {
recordType: any;
}, customData?: {}): Promise<{
openId: string;
activityId: any;
userNick: any;
recordType: any;
recordName: any;
createTime: number;
createDay: string;
}>;
}
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
var constants_1 = require("./../constants");
var utils_1 = require("../utils");
var user_service_1 = require("./user.service");
var sdk_1 = require("../sdk");
var db_1 = require("../db");
var RecordService = /** @class */ (function (_super) {
__extends(RecordService, _super);
function RecordService(context) {
var _this = _super.call(this, context) || this;
_this.recorddao = new sdk_1.BaseDao(context, db_1.RECORD_DB_NAME);
return _this;
}
// 添加受邀记录
RecordService.prototype.addReceiveShareRecord = function () {
return __awaiter(this, void 0, void 0, function () {
var inviteId, record;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
inviteId = this.context.data.inviteId;
return [4 /*yield*/, this.initRecordData({
recordType: constants_1.RECORD_TYPE.RECIEVE_SHARE
}, {
inviteId: inviteId
})];
case 1:
record = _a.sent();
return [4 /*yield*/, this.recorddao.insertOne(record)];
case 2: return [2 /*return*/, _a.sent()];
}
});
});
};
RecordService.prototype.getGamePrizeRecordDetail = function () {
return __awaiter(this, void 0, void 0, function () {
var openId, activityId;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
openId = this.context.openId;
activityId = this.context.data.activityId;
return [4 /*yield*/, this.recorddao.find({
recordType: constants_1.RECORD_TYPE.GAME_PRIZE.type,
activityId: activityId,
openId: openId
})];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
RecordService.prototype.addDoLikeRecord = function () {
return __awaiter(this, void 0, void 0, function () {
var inviteId, record;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
inviteId = this.context.data.inviteId;
return [4 /*yield*/, this.initRecordData({
recordType: constants_1.RECORD_TYPE.DO_LIKE
}, {
inviteId: inviteId
})];
case 1:
record = _a.sent();
return [4 /*yield*/, this.recorddao.insertOne(record)];
case 2: return [2 /*return*/, _a.sent()];
}
});
});
};
RecordService.prototype.addRecord = function (recordType, customData) {
return __awaiter(this, void 0, void 0, function () {
var record;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.initRecordData({
recordType: recordType
}, __assign({}, customData))];
case 1:
record = _a.sent();
return [4 /*yield*/, this.recorddao.insertOne(record)];
case 2: return [2 /*return*/, _a.sent()];
}
});
});
};
RecordService.prototype.getLikeTotal = function () {
return __awaiter(this, void 0, void 0, function () {
var activityId;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
activityId = this.context.data.activityId;
return [4 /*yield*/, this.recorddao.count({
recordType: constants_1.RECORD_TYPE.DO_LIKE.type,
activityId: activityId
})];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
RecordService.prototype.getLikeByDay = function (createDay) {
return __awaiter(this, void 0, void 0, function () {
var activityId;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
activityId = this.context.data.activityId;
return [4 /*yield*/, this.recorddao.count({
recordType: constants_1.RECORD_TYPE.DO_LIKE.type,
createDay: createDay,
activityId: activityId
})];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
RecordService.prototype.getRecordCountByType = function (recordType, openId, customData) {
if (customData === void 0) { customData = {}; }
return __awaiter(this, void 0, void 0, function () {
var activityId;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
activityId = this.context.data.activityId;
return [4 /*yield*/, this.recorddao.count(__assign({ recordType: recordType,
openId: openId,
activityId: activityId }, customData))];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
RecordService.prototype.initRecordData = function (_a, customData) {
var recordType = _a.recordType;
if (customData === void 0) { customData = {}; }
return __awaiter(this, void 0, void 0, function () {
var _b, openId, data, activityId, userNick, userInfo, record;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
_b = this.context, openId = _b.openId, data = _b.data;
activityId = data.activityId, userNick = data.userNick;
if (!!userNick) return [3 /*break*/, 2];
return [4 /*yield*/, this.getUserInfo()];
case 1:
userInfo = _c.sent();
if (userInfo) {
userNick = userInfo.userNick;
}
_c.label = 2;
case 2:
record = __assign({ openId: openId,
activityId: activityId,
userNick: userNick, recordType: recordType.type, recordName: recordType.name, createTime: Date.now(), createDay: utils_1.getToday() }, customData);
return [2 /*return*/, record];
}
});
});
};
return RecordService;
}(user_service_1.default));
exports.default = RecordService;
//# sourceMappingURL=record.service.js.map
\ No newline at end of file
{"version":3,"file":"record.service.js","sourceRoot":"","sources":["../../src/service/record.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAA6C;AAC7C,kCAAmC;AACnC,+CAAyC;AACzC,8BAAiC;AACjC,4BAAuC;AAGvC;IAA2C,iCAAW;IAEpD,uBAAY,OAAgB;QAA5B,YACE,kBAAM,OAAO,CAAC,SAEf;QADC,KAAI,CAAC,SAAS,GAAG,IAAI,aAAO,CAAC,OAAO,EAAE,mBAAc,CAAC,CAAC;;IACxD,CAAC;IAED,SAAS;IACH,6CAAqB,GAA3B;;;;;;wBACU,QAAQ,GAAK,IAAI,CAAC,OAAO,CAAC,IAAI,SAAtB,CAAuB;wBACxB,qBAAM,IAAI,CAAC,cAAc,CAAC;gCACvC,UAAU,EAAE,uBAAW,CAAC,aAAa;6BACtC,EAAE;gCACD,QAAQ,UAAA;6BACT,CAAC,EAAA;;wBAJI,MAAM,GAAG,SAIb;wBACK,qBAAM,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,EAAA;4BAA7C,sBAAO,SAAsC,EAAA;;;;KAC9C;IAEK,gDAAwB,GAA9B;;;;;;wBACU,MAAM,GAAK,IAAI,CAAC,OAAO,OAAjB,CAAkB;wBACxB,UAAU,GAAK,IAAI,CAAC,OAAO,CAAC,IAAI,WAAtB,CAAuB;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相关方法
*
* @format
*/
import UserService from './user.service';
export interface ITaskInfo {
taskType?: string;
url?: string;
rewards: number;
itemIds?: string;
todayCompleteTimes?: number;
completeTimes?: number;
taskRateType: number;
times?: number;
waitReceive?: number;
title: string;
status: number;
}
export default class TaskService extends UserService {
constructor(context: IContext<IParams>);
initVipTask(userInfo: IUserInfo, vipInfo: IVipInfo, tasks: ITasks): ITaskInfo;
initOrderGoodsTask(userInfo: IUserInfo, tasks: ITasks): ITaskInfo;
initBrowseGoodsTask(userInfo: IUserInfo, tasks: ITasks): ITaskInfo;
initCollectGoodsTask(userInfo: IUserInfo, tasks: ITasks): ITaskInfo;
initJumpLinkTask(userInfo: IUserInfo, tasks: ITasks): ITaskInfo;
initInvitesTask(userInfo: IUserInfo, tasks: ITasks): ITaskInfo;
initFollowTask(userInfo: IUserInfo, tasks: ITasks): ITaskInfo;
initSignTask(userInfo: IUserInfo, tasks: ITasks): ITaskInfo;
initExchangeCreditsTask(userInfo: IUserInfo, tasks: ITasks): ITaskInfo;
updateVipTask(userInfo: IUserInfo, vipInfo: IVipInfo, tasks: ITasks): {
$set: {};
$inc: {};
$push: {};
};
updateOrderGoodsTask(userInfo: IUserInfo, tasks: ITasks, activityStartTime: number, session?: string): Promise<{}>;
updateSignTask(userInfo: IUserInfo, tasks: ITasks): {
$inc: {
'remainTimes.sign': number;
};
$push: {
[x: string]: {
createTime: number;
};
};
} | {
$inc?: undefined;
$push?: undefined;
};
/**
*更新关注店铺任务状态
*
* @param {IUserInfo} userInfo
* @param {IActivityInfo} activityInfo
* @returns
* @memberof TaskService
*/
updateFollowTask(userInfo: IUserInfo, activityInfo: IActivityInfo): Promise<any>;
/**
*
* 根据用户和任务完成情况,设置任务状态
*
* @param {IUserInfo} useInfo
* @param {string} taskType
* @param {number} taskRateType
* @param {number} [limitTimesEverday] 每天限制次数 任务频率为每天的时候必填
* @return {taskTatus} 1未完成 2 待领取 3 已完成
* @memberof TaskService
*/
setTaskStatus(useInfo: IUserInfo, taskType: string, taskRateType: number, limitTimesEveryday?: number): number;
/**
*
* 获取任务今天完成的次数
*
* @param {string} taskType 任务类型
* @param {IUserInfo} userInfo 用户信息
* @returns {number} todayTimes 今日任务完成次数 todayTaskInfo 今日对应任务完成详情
* @memberof TaskService
*/
getTodayCompleteTask(taskType: string, userInfo: IUserInfo): {
todayCompleteTimes: any;
todayTaskInfo: any;
};
/**
* 根据任务类型获取任务完成情况
*
* @param {IUserInfo} userInfo
* @param {string} taskType
* @returns {array}
* @memberof TaskService
*/
getCompleteTaskByUserTaskInfo(taskType: string, userInfo: IUserInfo): any[];
/**
*根据任务类型更新任务待领取次数和任务记录
*
* @param {string} taskType
* @param {number} rewards
* @param {IUserInfo} userInfo
* @param {object} [customRecord]
* @returns {boolean}
* @memberof TaskService
*/
updateUserTaskRecord(taskType: string, rewards: number, userInfo: IUserInfo, customRecord?: object): Promise<boolean>;
/**
*
* 更新user表中,任务相关字段
*
* @param {string} id
* @param {object[]} needUpdateKeysArray
* @param {IUserInfo} userInfo
* @returns {IUserInfo | boolean} userInfo
* @memberof TaskService
*/
updateTasks(id: string, needUpdateKeysArray: object[], userInfo: IUserInfo): Promise<false | IUserInfo>;
}
"use strict";
/**
* 任务相关方法
*
* @format
*/
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var __spreadArrays = (this && this.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var lodash_1 = require("lodash");
var user_service_1 = require("./user.service");
var utils_1 = require("../utils");
var constants_1 = require("../constants");
var TaskService = /** @class */ (function (_super) {
__extends(TaskService, _super);
function TaskService(context) {
return _super.call(this, context) || this;
}
TaskService.prototype.initVipTask = function (userInfo, vipInfo, tasks) {
var remainTimes = userInfo.remainTimes;
// 后台配置奖励
var value = tasks.beMembership.value;
return {
taskType: "member",
title: "\u52A0\u5165\u4F1A\u5458",
url: vipInfo.url,
rewards: value,
taskRateType: constants_1.TASK_RATE_TYPE.FOREVER,
waitReceive: remainTimes.member,
status: this.setTaskStatus(userInfo, 'member', constants_1.TASK_RATE_TYPE.FOREVER)
};
};
// 初始化下单任务
TaskService.prototype.initOrderGoodsTask = function (userInfo, tasks) {
var _a = tasks.orderGoods, value = _a.value, itemIds = _a.itemIds, taskRateType = _a.taskRateType, times = _a.times;
var remainTimes = userInfo.remainTimes;
var todayCompleteTimes = this.getTodayCompleteTask('orderGoods', userInfo).todayCompleteTimes;
var orderGoodsCompleteList = this.getCompleteTaskByUserTaskInfo('orderGoods', userInfo);
var orderTask = {
taskType: "orderGoods",
title: "\u4E0B\u5355\u5546\u54C1",
itemIds: itemIds,
rewards: value,
taskRateType: taskRateType,
times: times,
todayCompleteTimes: todayCompleteTimes,
completeTimes: orderGoodsCompleteList.length,
status: this.setTaskStatus(userInfo, 'orderGoods', taskRateType, times),
waitReceive: remainTimes.orderGoods
};
return orderTask;
};
// 初始化浏览商品任务
TaskService.prototype.initBrowseGoodsTask = function (userInfo, tasks) {
var _a = tasks.browseGoods, value = _a.value, itemIds = _a.itemIds, taskRateType = _a.taskRateType, times = _a.times;
var remainTimes = userInfo.remainTimes;
var todayCompleteTimes = this.getTodayCompleteTask('browseGoods', userInfo).todayCompleteTimes;
var browseGoodsCompleteList = this.getCompleteTaskByUserTaskInfo('browseGoods', userInfo);
var orderTask = {
taskType: "browseGoods",
title: "\u6D4F\u89C8\u5546\u54C1",
itemIds: itemIds,
times: times,
rewards: value,
waitReceive: remainTimes.browseGoods,
todayCompleteTimes: todayCompleteTimes,
completeTimes: browseGoodsCompleteList.length,
status: this.setTaskStatus(userInfo, 'browseGoods', taskRateType, times),
taskRateType: taskRateType
};
return orderTask;
};
// 初始化收藏商品任务
TaskService.prototype.initCollectGoodsTask = function (userInfo, tasks) {
var _a = tasks.collectGoods, value = _a.value, itemIds = _a.itemIds, taskRateType = _a.taskRateType, times = _a.times;
var remainTimes = userInfo.remainTimes;
var todayCompleteTimes = this.getTodayCompleteTask('collectGoods', userInfo).todayCompleteTimes;
var completeList = this.getCompleteTaskByUserTaskInfo('collectGoods', userInfo);
var orderTask = {
taskType: "collectGoods",
title: "\u6536\u85CF\u5546\u54C1",
itemIds: itemIds,
times: times,
rewards: value,
waitReceive: remainTimes.collectGoods,
todayCompleteTimes: todayCompleteTimes,
completeTimes: completeList.length,
taskRateType: taskRateType,
status: this.setTaskStatus(userInfo, 'collectGoods', taskRateType, times)
};
return orderTask;
};
// 初始化跳转任务
TaskService.prototype.initJumpLinkTask = function (userInfo, tasks) {
var _a = tasks.jumpLink, value = _a.value, link = _a.link, taskRateType = _a.taskRateType, times = _a.times;
var remainTimes = userInfo.remainTimes;
var todayCompleteTimes = this.getTodayCompleteTask('jumpLink', userInfo).todayCompleteTimes;
var completeList = this.getCompleteTaskByUserTaskInfo('jumpLink', userInfo);
var orderTask = {
taskType: "jumpLink",
title: "\u8DF3\u8F6C\u94FE\u63A5",
url: link,
times: times,
rewards: value,
waitReceive: remainTimes.jumpLink,
todayCompleteTimes: todayCompleteTimes,
completeTimes: completeList.length,
taskRateType: taskRateType,
status: this.setTaskStatus(userInfo, 'jumpLink', taskRateType, times)
};
return orderTask;
};
// 初始化邀请任务
TaskService.prototype.initInvitesTask = function (userInfo, tasks) {
var _a = tasks.inviteFriends, value = _a.value, taskRateType = _a.taskRateType, times = _a.times;
var remainTimes = userInfo.remainTimes;
var todayCompleteTimes = this.getTodayCompleteTask('invites', userInfo).todayCompleteTimes;
var invitesCompleteList = this.getCompleteTaskByUserTaskInfo('invites', userInfo);
var orderTask = {
taskType: "invites",
title: "\u9080\u8BF7",
rewards: value,
taskRateType: taskRateType,
times: times,
todayCompleteTimes: todayCompleteTimes,
completeTimes: invitesCompleteList.length,
waitReceive: remainTimes.invites,
status: this.setTaskStatus(userInfo, 'invites', taskRateType, times)
};
return orderTask;
};
// 关注店铺
TaskService.prototype.initFollowTask = function (userInfo, tasks) {
var value = tasks.attentionStore.value;
var remainTimes = userInfo.remainTimes;
var followCompleteList = this.getCompleteTaskByUserTaskInfo('follow', userInfo);
return {
taskType: "follow",
title: "\u5173\u6CE8\u5E97\u94FA",
rewards: value,
taskRateType: constants_1.TASK_RATE_TYPE.FOREVER,
waitReceive: remainTimes.follow,
completeTimes: followCompleteList.length,
status: this.setTaskStatus(userInfo, 'follow', constants_1.TASK_RATE_TYPE.FOREVER)
};
};
// 初始化签到任务
TaskService.prototype.initSignTask = function (userInfo, tasks) {
var value = tasks.sign.value;
var remainTimes = userInfo.remainTimes;
var completeList = this.getCompleteTaskByUserTaskInfo('sign', userInfo);
var todayCompleteTimes = this.getTodayCompleteTask('sign', userInfo).todayCompleteTimes;
return {
taskType: "sign",
title: "\u6BCF\u65E5\u7B7E\u5230",
rewards: value,
times: 1,
taskRateType: constants_1.TASK_RATE_TYPE.EVERYDAY,
waitReceive: remainTimes.sign,
completeTimes: completeList.length,
todayCompleteTimes: todayCompleteTimes,
status: this.setTaskStatus(userInfo, 'sign', constants_1.TASK_RATE_TYPE.EVERYDAY)
};
};
// 积分兑换 /固定为每日限制
TaskService.prototype.initExchangeCreditsTask = function (userInfo, tasks) {
var _a = tasks.exchangeCredits, value = _a.value, times = _a.times;
var remainTimes = userInfo.remainTimes, taskInfo = userInfo.taskInfo;
var todayCompleteTimes = this.getTodayCompleteTask('exchangeCredits', userInfo).todayCompleteTimes;
return {
taskType: "exchangeCredits",
title: "\u79EF\u5206\u5151\u6362",
rewards: value,
times: times,
taskRateType: constants_1.TASK_RATE_TYPE.EVERYDAY,
todayCompleteTimes: todayCompleteTimes,
waitReceive: remainTimes.exchangeCredits,
status: this.setTaskStatus(userInfo, 'exchangeCredits', constants_1.TASK_RATE_TYPE.EVERYDAY)
};
};
// 根据会员状态更新
TaskService.prototype.updateVipTask = function (userInfo, vipInfo, tasks) {
var member = userInfo.member, remainTimes = userInfo.remainTimes, taskInfo = userInfo.taskInfo;
var newMember = member.newMember;
var today = utils_1.getToday();
var isNewVip = this.checkNewVipStatus(userInfo, vipInfo);
var value = tasks.beMembership.value;
var projection = {
$set: {},
$inc: {},
$push: {}
};
if (isNewVip && !newMember) {
member = this.setNewVipUserData(member);
// @ts-ignore
projection.$set.member = member;
projection.$inc['remainTimes.member'] = +value;
projection.$push["taskInfo." + today + ".member"] = {
creatTime: Date.now()
};
}
return projection;
};
// 根据下单下单记录,更新状态
TaskService.prototype.updateOrderGoodsTask = function (userInfo, tasks, activityStartTime, session) {
return __awaiter(this, void 0, void 0, function () {
var _a, value, itemIds, taskRateType, times, orderGoodsCompleteList, todayCompleteTimes, today, orderResult, itemIdsArr, projection, targetOrders;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
_a = tasks.orderGoods, value = _a.value, itemIds = _a.itemIds, taskRateType = _a.taskRateType, times = _a.times;
orderGoodsCompleteList = this.getCompleteTaskByUserTaskInfo('orderGoods', userInfo);
todayCompleteTimes = this.getTodayCompleteTask('orderGoods', userInfo).todayCompleteTimes;
// 永久任务且已完成
if (taskRateType === constants_1.TASK_RATE_TYPE.FOREVER && orderGoodsCompleteList.length) {
return [2 /*return*/, {}];
}
today = utils_1.getToday();
if (taskRateType === constants_1.TASK_RATE_TYPE.EVERYDAY && todayCompleteTimes >= times) {
return [2 /*return*/, {}];
}
return [4 /*yield*/, utils_1.getUserOrderlist(this.context,
//@ts-ignore
activityStartTime || Date.now(), Date.now(), session)];
case 1:
orderResult = _b.sent();
itemIdsArr = itemIds.split(',').map(function (v) { return +v; });
projection = {
$inc: {
'remainTimes.orderGoods': 0
},
$pushAll: {}
};
targetOrders = [];
orderResult.forEach(function (v) {
// @ts-ignore
// 商品订单包含目标商品 且orderId为新订单
if (itemIdsArr.includes(v.itemId) && !orderGoodsCompleteList.some(function (order) { return order.orderId === v.orderId; })) {
projection.$inc['remainTimes.orderGoods'] += +value;
targetOrders.push({
itemId: v.itemId,
orderId: v.orderId,
payTime: v.payTime,
createTime: Date.now()
});
}
if (targetOrders.length) {
projection.$pushAll["taskInfo." + today + ".orderGoods"] = targetOrders;
}
});
return [2 /*return*/, projection];
}
});
});
};
// 更新签到任务数据
TaskService.prototype.updateSignTask = function (userInfo, tasks) {
var _a;
// 获取签到奖励
var value = (tasks || {}).sign.value;
var todayCompleteTimes = this.getTodayCompleteTask('sign', userInfo).todayCompleteTimes;
var today = utils_1.getToday();
utils_1.logger(todayCompleteTimes);
// 今天没有有完成记录
return todayCompleteTimes === 0
? {
$inc: {
'remainTimes.sign': value
},
$push: (_a = {},
_a["taskInfo." + today + ".sign"] = { createTime: Date.now() },
_a)
}
: {};
};
/**
*更新关注店铺任务状态
*
* @param {IUserInfo} userInfo
* @param {IActivityInfo} activityInfo
* @returns
* @memberof TaskService
*/
TaskService.prototype.updateFollowTask = function (userInfo, activityInfo) {
return __awaiter(this, void 0, void 0, function () {
var today, _id, _a, taskInfo, follow, tasks, value, followInfo;
var _b;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
today = utils_1.getToday();
_id = userInfo._id, _a = userInfo.taskInfo, taskInfo = _a === void 0 ? {} : _a, follow = userInfo.follow;
tasks = activityInfo.tasks;
value = (tasks || {}).attentionStore.value;
followInfo = this.setNewFollowUserData(follow);
return [4 /*yield*/, this.updateUser(_id, {
$set: {
follow: followInfo,
taskInfo: taskInfo
},
$inc: {
'remainTimes.follow': value
},
$push: (_b = {},
_b["taskInfo." + today + ".follow"] = {
creatTime: Date.now()
},
_b)
})];
case 1:
// 增加待领取次数
return [2 /*return*/, _c.sent()];
}
});
});
};
/**
*
* 根据用户和任务完成情况,设置任务状态
*
* @param {IUserInfo} useInfo
* @param {string} taskType
* @param {number} taskRateType
* @param {number} [limitTimesEverday] 每天限制次数 任务频率为每天的时候必填
* @return {taskTatus} 1未完成 2 待领取 3 已完成
* @memberof TaskService
*/
TaskService.prototype.setTaskStatus = function (useInfo, taskType, taskRateType, limitTimesEveryday) {
var _a;
var waitReceive = ((_a = useInfo === null || useInfo === void 0 ? void 0 : useInfo.remainTimes) === null || _a === void 0 ? void 0 : _a[taskType]) || 0;
if (waitReceive)
return constants_1.TASK_STATUS.WAIT_RECEIVE;
// 当天的完成次数
var todayCompleteTimes = this.getTodayCompleteTask(taskType, useInfo).todayCompleteTimes;
// 总共的完成次数
var completeTimes = this.getCompleteTaskByUserTaskInfo(taskType, useInfo).length;
switch (taskRateType) {
case constants_1.TASK_RATE_TYPE.FOREVER:
return completeTimes > 0 ? constants_1.TASK_STATUS.DONE : constants_1.TASK_STATUS.WAIT_DO;
break;
case constants_1.TASK_RATE_TYPE.EVERYDAY:
return todayCompleteTimes >= limitTimesEveryday ? constants_1.TASK_STATUS.DONE : constants_1.TASK_STATUS.WAIT_DO;
break;
case constants_1.TASK_RATE_TYPE.NOLIMIT:
return constants_1.TASK_STATUS.WAIT_DO;
break;
}
};
/**
*
* 获取任务今天完成的次数
*
* @param {string} taskType 任务类型
* @param {IUserInfo} userInfo 用户信息
* @returns {number} todayTimes 今日任务完成次数 todayTaskInfo 今日对应任务完成详情
* @memberof TaskService
*/
TaskService.prototype.getTodayCompleteTask = function (taskType, userInfo) {
var _a, _b, _c, _d, _e;
var today = utils_1.getToday();
return {
todayCompleteTimes: ((_c = (_b = (_a = userInfo === null || userInfo === void 0 ? void 0 : userInfo.taskInfo) === null || _a === void 0 ? void 0 : _a[today]) === null || _b === void 0 ? void 0 : _b[taskType]) === null || _c === void 0 ? void 0 : _c.length) || 0,
todayTaskInfo: ((_e = (_d = userInfo === null || userInfo === void 0 ? void 0 : userInfo.taskInfo) === null || _d === void 0 ? void 0 : _d[today]) === null || _e === void 0 ? void 0 : _e[taskType]) || []
};
};
/**
* 根据任务类型获取任务完成情况
*
* @param {IUserInfo} userInfo
* @param {string} taskType
* @returns {array}
* @memberof TaskService
*/
TaskService.prototype.getCompleteTaskByUserTaskInfo = function (taskType, userInfo) {
var _a = userInfo.taskInfo, taskInfo = _a === void 0 ? {} : _a;
var targetTaskList = [];
Object.keys(taskInfo).forEach(function (day) {
var _a, _b, _c, _d;
if ((_a = taskInfo[day]) === null || _a === void 0 ? void 0 : _a[taskType]) {
var dayTaskInfo = Array.isArray((_b = taskInfo[day]) === null || _b === void 0 ? void 0 : _b[taskType])
? (_c = taskInfo[day]) === null || _c === void 0 ? void 0 : _c[taskType] : [(_d = taskInfo[day]) === null || _d === void 0 ? void 0 : _d[taskType]];
targetTaskList = __spreadArrays(targetTaskList, dayTaskInfo);
}
});
return targetTaskList;
};
/**
*根据任务类型更新任务待领取次数和任务记录
*
* @param {string} taskType
* @param {number} rewards
* @param {IUserInfo} userInfo
* @param {object} [customRecord]
* @returns {boolean}
* @memberof TaskService
*/
TaskService.prototype.updateUserTaskRecord = function (taskType, rewards, userInfo, customRecord) {
return __awaiter(this, void 0, void 0, function () {
var _id, today, result;
var _a, _b;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
_id = userInfo._id;
today = utils_1.getToday();
return [4 /*yield*/, this.updateUser(_id, {
$inc: (_a = {},
_a["remainTimes." + taskType] = rewards,
_a),
$push: (_b = {},
_b["taskInfo." + today + "." + taskType] = __assign({ createTime: Date.now() }, customRecord),
_b)
})];
case 1:
result = _c.sent();
return [2 /*return*/, result === 1];
}
});
});
};
/**
*
* 更新user表中,任务相关字段
*
* @param {string} id
* @param {object[]} needUpdateKeysArray
* @param {IUserInfo} userInfo
* @returns {IUserInfo | boolean} userInfo
* @memberof TaskService
*/
TaskService.prototype.updateTasks = function (id, needUpdateKeysArray, userInfo) {
return __awaiter(this, void 0, void 0, function () {
var updateKeys;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
utils_1.logger(needUpdateKeysArray);
updateKeys = lodash_1.merge.apply(void 0, __spreadArrays([{}], needUpdateKeysArray));
utils_1.logger(updateKeys);
return [4 /*yield*/, this.updateUser(id, updateKeys)];
case 1:
_a.sent();
return [4 /*yield*/, this.getUserInfo()];
case 2: return [2 /*return*/, _a.sent()];
}
});
});
};
return TaskService;
}(user_service_1.default));
exports.default = TaskService;
//# sourceMappingURL=task.service.js.map
\ No newline at end of file
{"version":3,"file":"task.service.js","sourceRoot":"","sources":["../../src/service/task.service.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iCAA8B;AAC9B,+CAAwC;AACxC,kCAA6D;AAC7D,0CAA0D;AAe1D;IAAyC,+BAAW;IAClD,qBAAY,OAA0B;eACpC,kBAAM,OAAO,CAAC;IAChB,CAAC;IAED,iCAAW,GAAX,UAAY,QAAmB,EAAE,OAAiB,EAAE,KAAa;QACvD,IAAA,WAAW,GAAK,QAAQ,YAAb,CAAa;QAEhC,SAAS;QAES,IAAA,KAAK,GACnB,KAAK,mBADc,CACd;QAET,OAAO;YACL,QAAQ,EAAE,QAAQ;YAClB,KAAK,EAAE,0BAAM;YACb,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,OAAO,EAAE,KAAK;YACd,YAAY,EAAE,0BAAc,CAAC,OAAO;YACpC,WAAW,EAAE,WAAW,CAAC,MAAM;YAC/B,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,QAAQ,EAAE,0BAAc,CAAC,OAAO,CAAC;SACvE,CAAA;IACH,CAAC;IAED,UAAU;IACV,wCAAkB,GAAlB,UAAmB,QAAmB,EAAE,K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AAmB,EAAC,CAAA;wBAE5D,cAAM,CAAC,UAAU,CAAC,CAAA;wBAClB,qBAAM,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE,UAAU,CAAC,EAAA;;wBAArC,SAAqC,CAAA;wBAC9B,qBAAM,IAAI,CAAC,WAAW,EAAE,EAAA;4BAA/B,sBAAO,SAAwB,EAAA;;;;KAChC;IACH,kBAAC;AAAD,CAAC,AAjeD,CAAyC,sBAAW,GAienD"}
\ No newline at end of file
/**
* 用户相关方法
*
* @format
*/
import BaseService from './base.service';
declare class UserService extends BaseService {
userdao: IBaseDao;
constructor(context: IContext<IParams>);
/**
* @desc 获取当前打开活动的用户详情
* @returns 若用户不存在,返回null; 用户存在,返回用户信息(object对象)
*/
getUserInfo(): Promise<any>;
/**
* @desc 根据inviteId获取用户详情
* @desc 常用于助力分享码为用户openId, 被邀请人打开活动助力时需要获取邀请人的用户详情
* @param {邀请人的openId} inviteId
* @returns 若用户不存在,返回null; 用户存在,返回用户信息(object对象)
*/
getUserInfoByOpenId(inviteId: string): Promise<any>;
/**
* @desc 获取是否是会员
* @param {调用淘宝接口的session} session
* @returns {isVip: boolean(是否是会员), url: string(入会链接) }
*/
getShopVip(session: string, activityUserNick?: string, callbackUrl?: string): Promise<IVipInfo>;
/**
* 初始化用户数据
*
* @param {IVipInfo} vipInfo
* @param {IActivityInfo} activityInfo
* @returns
* @memberof UserService
*/
initUserData(vipInfo: IVipInfo, activityInfo: IActivityInfo): Promise<any>;
updateUserData(vipInfo: IVipInfo, userInfo: IUserInfo, activityInfo: IActivityInfo): Promise<void>;
/**
* @desc 更新用户表
* @param {用户的主键id} _id
* @param {更新的对象} document
* @returns 若更新成功,返回为1; 若更新失败,返回为 0 或系统直接报错
*/
updateUser(_id: string, projection: object): Promise<any>;
/**
* @desc 根据用户主键id查找用户详情
* @param {用户的主键id} _id
* @returns 若用户不存在,返回null; 用户存在,返回用户信息(object对象)
*/
getUserInfoById(_id: string): Promise<any>;
/**
*判断是否新会员
*
* @param {IUserInfo} userInfo
* @param {IVipInfo} vipInfo
* @returns {boolean}
* @memberof UserService
*/
checkNewVipStatus(userInfo: IUserInfo, vipInfo: IVipInfo): boolean;
setNewVipUserData(member: IMemberInfo): IMemberInfo;
setNewFollowUserData(follow: IFollowInfo): IFollowInfo;
}
export default UserService;
"use strict";
/**
* 用户相关方法
*
* @format
*/
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
var sdk_1 = require("../sdk");
var base_service_1 = require("./base.service");
var db_1 = require("../db");
var utils_1 = require("../utils");
var vipMock_1 = require("../vipMock");
var UserService = /** @class */ (function (_super) {
__extends(UserService, _super);
function UserService(context) {
var _this = _super.call(this, context) || this;
_this.userdao = new sdk_1.BaseDao(context, db_1.USER_DB_NAME);
return _this;
}
/**
* @desc 获取当前打开活动的用户详情
* @returns 若用户不存在,返回null; 用户存在,返回用户信息(object对象)
*/
UserService.prototype.getUserInfo = function () {
return __awaiter(this, void 0, void 0, function () {
var _a, openId, data, activityId, record;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
_a = this.context, openId = _a.openId, data = _a.data;
activityId = data.activityId;
return [4 /*yield*/, this.userdao.findOne({ openId: openId, activityId: activityId })];
case 1:
record = _b.sent();
return [2 /*return*/, record];
}
});
});
};
/**
* @desc 根据inviteId获取用户详情
* @desc 常用于助力分享码为用户openId, 被邀请人打开活动助力时需要获取邀请人的用户详情
* @param {邀请人的openId} inviteId
* @returns 若用户不存在,返回null; 用户存在,返回用户信息(object对象)
*/
UserService.prototype.getUserInfoByOpenId = function (inviteId) {
return __awaiter(this, void 0, void 0, function () {
var activityId, record;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
activityId = this.context.data.activityId;
return [4 /*yield*/, this.userdao.findOne({ openId: inviteId, activityId: activityId })];
case 1:
record = _a.sent();
return [2 /*return*/, record];
}
});
});
};
/**
* @desc 获取是否是会员
* @param {调用淘宝接口的session} session
* @returns {isVip: boolean(是否是会员), url: string(入会链接) }
*/
UserService.prototype.getShopVip = function (session, activityUserNick, callbackUrl) {
if (activityUserNick === void 0) { activityUserNick = ''; }
if (callbackUrl === void 0) { callbackUrl = ''; }
return __awaiter(this, void 0, void 0, function () {
var activityId, result, shopUrl, cbUrl, e_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
console.log(activityUserNick, 'activityUserNick');
if (utils_1.isUseVipMock(this.context, activityUserNick)) {
return [2 /*return*/, vipMock_1.VIP_MOCK];
}
activityId = this.context.data.activityId;
result = {
result: {
member_info: ''
}
};
shopUrl = {
result: {
result: ''
}
};
cbUrl = callbackUrl + "&query=activityId%3D" + activityId;
_a.label = 1;
case 1:
_a.trys.push([1, 4, , 5]);
return [4 /*yield*/, sdk_1.TBAPIS.queryVipinfo(this.context, session)];
case 2:
result = _a.sent();
return [4 /*yield*/, sdk_1.TBAPIS.getShopVipUrl(this.context, session, {
source: 'isvapp',
entrance: 'duiba'
}, cbUrl)];
case 3:
shopUrl = _a.sent();
return [3 /*break*/, 5];
case 4:
e_1 = _a.sent();
console.log(e_1);
return [3 /*break*/, 5];
case 5:
console.log("result, shopUrl", result, shopUrl);
return [2 /*return*/, {
isVip: !!(result.result && result.result.member_info),
url: shopUrl.result && shopUrl.result.result
}];
}
});
});
};
/**
* 初始化用户数据
*
* @param {IVipInfo} vipInfo
* @param {IActivityInfo} activityInfo
* @returns
* @memberof UserService
*/
UserService.prototype.initUserData = function (vipInfo, activityInfo) {
return __awaiter(this, void 0, void 0, function () {
var _a, openId, data, activityId, isFollow, avatar, inviteId, userNick, today, tasks, attentionStore, beMembership, user;
var _b, _c;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
_a = this.context, openId = _a.openId, data = _a.data;
activityId = data.activityId, isFollow = data.isFollow, avatar = data.avatar, inviteId = data.inviteId, userNick = data.userNick;
today = utils_1.getToday();
console.log("----------" + today + "----------", today);
tasks = activityInfo.tasks;
attentionStore = tasks.attentionStore, beMembership = tasks.beMembership;
user = {
activityId: activityId,
avatar: avatar,
inviteId: inviteId,
userNick: userNick,
openId: openId,
// 待领取次数初始化, 根据需自定义添加
remainTimes: {
follow: isFollow ? attentionStore.value : 0,
member: vipInfo.isVip ? beMembership.value : 0
},
member: {
flag: !!vipInfo.isVip
},
follow: {
flag: !!isFollow
},
login: (_b = {},
_b[today] = 1,
_b),
taskInfo: (_c = {},
_c[today] = {},
_c),
createTime: Date.now(),
createDay: today,
updateTime: Date.now()
};
return [4 /*yield*/, this.userdao.insertOne(user)];
case 1: return [2 /*return*/, _d.sent()];
}
});
});
};
UserService.prototype.updateUserData = function (vipInfo, userInfo, activityInfo) {
return __awaiter(this, void 0, void 0, function () {
var data, isFollow, today, projection, tasks, attentionStore, beMembership, followBefore, followNow, isNewVip;
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
data = this.context.data;
isFollow = data.isFollow;
today = utils_1.getToday();
projection = {
$set: {
updateTime: Date.now()
},
$push: {},
$inc: (_a = {},
_a["login." + today] = 1,
_a)
};
tasks = activityInfo.tasks;
attentionStore = tasks.attentionStore, beMembership = tasks.beMembership;
followBefore = userInfo.follow.flag;
followNow = isFollow;
if (!followBefore && followNow && !userInfo.follow.newFollow) {
// @ts-ignore
projection.$set.follow = this.setNewFollowUserData(userInfo.follow);
projection.$push["taskInfo." + today + ".follow"] = { createTime: Date.now() };
projection.$inc["remainTimes.follow"] = attentionStore.value;
}
isNewVip = this.checkNewVipStatus(userInfo, vipInfo);
if (isNewVip && !userInfo.member.newMember) {
// @ts-ignore
projection.$set.member = this.setNewVipUserData(userInfo.member);
projection.$push["taskInfo." + today + ".member"] = { createTime: Date.now() };
projection.$inc["remainTimes.member"] = beMembership.value;
}
return [4 /*yield*/, this.updateUser(userInfo._id, projection)];
case 1:
_b.sent();
return [2 /*return*/];
}
});
});
};
/**
* @desc 更新用户表
* @param {用户的主键id} _id
* @param {更新的对象} document
* @returns 若更新成功,返回为1; 若更新失败,返回为 0 或系统直接报错
*/
UserService.prototype.updateUser = function (_id, projection) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
projection['$set'] = projection['$set'] || {};
projection['$set'].updateTime = Date.now();
console.log(projection);
return [4 /*yield*/, this.userdao.update({ _id: _id }, projection)];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
/**
* @desc 根据用户主键id查找用户详情
* @param {用户的主键id} _id
* @returns 若用户不存在,返回null; 用户存在,返回用户信息(object对象)
*/
UserService.prototype.getUserInfoById = function (_id) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.userdao.findOne({ _id: _id })];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
/**
*判断是否新会员
*
* @param {IUserInfo} userInfo
* @param {IVipInfo} vipInfo
* @returns {boolean}
* @memberof UserService
*/
UserService.prototype.checkNewVipStatus = function (userInfo, vipInfo) {
var flag = userInfo.member.flag;
var isVip = vipInfo.isVip;
return !flag && isVip;
};
UserService.prototype.setNewVipUserData = function (member) {
var today = utils_1.getToday();
return __assign(__assign({}, member), { newMember: true, bememberTime: Date.now(), bememberDay: today });
};
UserService.prototype.setNewFollowUserData = function (follow) {
var today = utils_1.getToday();
return __assign(__assign({}, follow), { newFollow: true, followTime: Date.now(), followDay: today });
};
return UserService;
}(base_service_1.default));
exports.default = UserService;
//# sourceMappingURL=user.service.js.map
\ No newline at end of file
{"version":3,"file":"user.service.js","sourceRoot":"","sources":["../../src/service/user.service.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,8BAAwC;AACxC,+CAAwC;AACxC,4BAAoC;AACpC,kCAAiD;AACjD,sCAAqC;AAErC;IAA0B,+BAAW;IAEnC,qBAAY,OAA0B;QAAtC,YACE,kBAAM,OAAO,CAAC,SAEf;QADC,KAAI,CAAC,OAAO,GAAG,IAAI,aAAO,CAAC,OAAO,EAAE,iBAAY,CAAC,CAAA;;IACnD,CAAC;IACD;;;OAGG;IACG,iCAAW,GAAjB;;;;;;wBACM,KAAmB,IAAI,CAAC,OAAO,EAA7B,MAAM,YAAA,EAAE,IAAI,UAAA,CAAiB;wBAC7B,UAAU,GAAK,IAAI,WAAT,CAAS;wBACZ,qBAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,MAAM,QAAA,EAAE,UAAU,YAAA,EAAE,CAAC,EAAA;;wBAA3D,MAAM,GAAG,SAAkD;wBAC/D,sBAAO,MAAM,EAAA;;;;KACd;IAED;;;;;OAKG;IACG,yCAAmB,GAAzB,UAA0B,QAAgB;;;;;;wBAClC,UAAU,GAAK,IAAI,CAAC,OAAO,CAAC,IAAI,WAAtB,CAAsB;wBACzB,qBAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,YAAA,EAAE,CAAC,EAAA;;wBAArE,MAAM,GAAG,SAA4D;wBACzE,sBAAO,MAAM,EAAA;;;;KACd;IAED;;;;OAIG;IACG,gCAAU,GAAhB,UAAiB,OAAe,EAAE,gBAA6B,EAAE,WAAwB;QAAvD,iCAAA,EAAA,qBAA6B;QAAE,4BAAA,EAAA,gBAAwB;;;;;;wBACvF,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,CAAA;wBACjD,I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0CAAoB,GAApB,UAAqB,MAAmB;QACtC,IAAM,KAAK,GAAG,gBAAQ,EAAE,CAAA;QACxB,6BACK,MAAM,KACT,SAAS,EAAE,IAAI,EACf,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,EACtB,SAAS,EAAE,KAAK,IACjB;IACH,CAAC;IACH,kBAAC;AAAD,CAAC,AA3ND,CAA0B,sBAAW,GA2NpC;AAED,kBAAe,WAAW,CAAA"}
\ No newline at end of file
/** @format */
//# sourceMappingURL=handler.js.map
\ No newline at end of file
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../../src/typings/handler.ts"],"names":[],"mappings":"AAAA,cAAc"}
\ No newline at end of file
/** @format */
export * from './package/getSession';
export * from './package/getToday';
export * from './package/sendTBAward';
export * from './package/lockUpdate';
export * from './package/logger';
export * from './package/rand';
export * from './package/getUserOrderlist';
export * from './package/isUseVipMock';
export * from './package/exportHandlers';
"use strict";
/** @format */
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
// 获取商家session
__exportStar(require("./package/getSession"), exports);
// 获取当天时间进行format
__exportStar(require("./package/getToday"), exports);
// 发放淘宝奖品(权益/积分)
__exportStar(require("./package/sendTBAward"), exports);
// 通用并发接口
__exportStar(require("./package/lockUpdate"), exports);
__exportStar(require("./package/logger"), exports);
__exportStar(require("./package/rand"), exports);
__exportStar(require("./package/getUserOrderlist"), exports);
__exportStar(require("./package/isUseVipMock"), exports);
__exportStar(require("./package/exportHandlers"), exports);
//# sourceMappingURL=index.js.map
\ No newline at end of file
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;AAEd,cAAc;AACd,uDAAoC;AAEpC,iBAAiB;AACjB,qDAAkC;AAElC,gBAAgB;AAChB,wDAAqC;AAErC,SAAS;AACT,uDAAoC;AAEpC,mDAAgC;AAEhC,iDAA8B;AAE9B,6DAA0C;AAE1C,yDAAsC;AAEtC,2DAAwC"}
\ No newline at end of file
/** @format */
export declare const exportHandlers: (controllers: any[]) => {};
"use strict";
/** @format */
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.exportHandlers = void 0;
// 遍历Controller中的方法, 暴露出来
exports.exportHandlers = function (controllers) {
var handlersMapper = controllers
.map(function (controller) {
var controllerInstance = new controller();
var handlersKeys = Object.getOwnPropertyNames(Object.getPrototypeOf(controllerInstance)).filter(function (v) { return v !== 'constructor'; });
return handlersKeys.reduce(function (prev, current) {
var _a;
return __assign(__assign({}, prev), (_a = {}, _a[current] = controllerInstance[current], _a));
}, {});
})
.reduce(function (prev, current) {
return __assign(__assign({}, current), prev);
}, {});
return handlersMapper;
};
//# sourceMappingURL=exportHandlers.js.map
\ No newline at end of file
{"version":3,"file":"exportHandlers.js","sourceRoot":"","sources":["../../../src/utils/package/exportHandlers.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;;AAEd,yBAAyB;AACZ,QAAA,cAAc,GAAG,UAAC,WAAkB;IAC/C,IAAM,cAAc,GAAG,WAAW;SAC/B,GAAG,CAAC,UAAA,UAAU;QACb,IAAM,kBAAkB,GAAG,IAAI,UAAU,EAAE,CAAA;QAC3C,IAAM,YAAY,GAAG,MAAM,CAAC,mBAAmB,CAAC,MAAM,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAC,CAAC,MAAM,CAC/F,UAAA,CAAC,IAAI,OAAA,CAAC,KAAK,aAAa,EAAnB,CAAmB,CACzB,CAAA;QACD,OAAO,YAAY,CAAC,MAAM,CAAC,UAAC,IAAI,EAAE,OAAO;;YACvC,6BACK,IAAI,gBACN,OAAO,IAAG,kBAAkB,CAAC,OAAO,CAAC,OACvC;QACH,CAAC,EAAE,EAAE,CAAC,CAAA;IACR,CAAC,CAAC;SACD,MAAM,CAAC,UAAC,IAAI,EAAE,OAAO;QACpB,6BACK,OAAO,GACP,IAAI,EACR;IACH,CAAC,EAAE,EAAE,CAAC,CAAA;IACR,OAAO,cAAc,CAAA;AACvB,CAAC,CAAA"}
\ No newline at end of file
/**
* 获取商家session
*
* @format
*/
export declare const getSellerSession: (context: IContext<IParams>, activityId?: string) => Promise<{
session?: undefined;
userNick?: undefined;
} | {
session: any;
userNick: any;
}>;
"use strict";
/**
* 获取商家session
*
* @format
*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSellerSession = void 0;
var db_1 = require("../../db");
var sdk_1 = require("../../sdk");
exports.getSellerSession = function (context, activityId) { return __awaiter(void 0, void 0, void 0, function () {
var activitydao, sellerdao, activityConfigResult, result;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!activityId) {
activityId = context.data.activityId;
}
activitydao = new sdk_1.BaseDao(context, db_1.ACTIVITY_CONFIG_DB_NAME);
sellerdao = new sdk_1.BaseDao(context, db_1.SELLER_INFO_DB_NAME);
return [4 /*yield*/, activitydao.findOne({ _id: activityId })];
case 1:
activityConfigResult = _a.sent();
if (!activityConfigResult)
return [2 /*return*/, {}];
return [4 /*yield*/, sellerdao.findOne({
openId: activityConfigResult.openId
})
// console.log(`getSellerSession`, result)
];
case 2:
result = _a.sent();
// console.log(`getSellerSession`, result)
if (!result)
return [2 /*return*/, {}];
return [2 /*return*/, {
session: result.accessToken,
userNick: result.userNick
}];
}
});
}); };
//# sourceMappingURL=getSession.js.map
\ No newline at end of file
{"version":3,"file":"getSession.js","sourceRoot":"","sources":["../../../src/utils/package/getSession.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,+BAAuE;AAEvE,iCAAmC;AAEtB,QAAA,gBAAgB,GAAG,UAAO,OAA0B,EAAE,UAAmB;;;;;gBACpF,IAAI,CAAC,UAAU,EAAE;oBACf,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,UAAU,CAAA;iBACrC;gBACG,WAAW,GAAa,IAAI,aAAO,CAAC,OAAO,EAAE,4BAAuB,CAAC,CAAA;gBACrE,SAAS,GAAa,IAAI,aAAO,CAAC,OAAO,EAAE,wBAAmB,CAAC,CAAA;gBACxC,qBAAM,WAAW,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC,EAAA;;gBAArE,oBAAoB,GAAG,SAA8C;gBACzE,IAAI,CAAC,oBAAoB;oBAAE,sBAAO,EAAE,EAAA;gBAEvB,qBAAM,SAAS,CAAC,OAAO,CAAC;wBACnC,MAAM,EAAE,oBAAoB,CAAC,MAAM;qBACpC,CAAC;oBACF,2CAA2C;kBADzC;;gBAFE,MAAM,GAAG,SAEX;gBACF,2CAA2C;gBAC3C,IAAI,CAAC,MAAM;oBAAE,sBAAO,EAAE,EAAA;gBACtB,sBAAO;wBACL,OAAO,EAAE,MAAM,CAAC,WAAW;wBAC3B,QAAQ,EAAE,MAAM,CAAC,QAAQ;qBAC1B,EAAA;;;KACF,CAAA"}
\ No newline at end of file
/** @format */
export declare const getToday: () => string;
"use strict";
/** @format */
Object.defineProperty(exports, "__esModule", { value: true });
exports.getToday = void 0;
var sdk_1 = require("../../sdk");
// 获取今天的时间
exports.getToday = function () {
console.log(sdk_1.transformBeijingDate(Date.now()));
return sdk_1.dateFormatter(sdk_1.transformBeijingDate(Date.now()), 'yyyy/MM/dd');
};
//# sourceMappingURL=getToday.js.map
\ No newline at end of file
{"version":3,"file":"getToday.js","sourceRoot":"","sources":["../../../src/utils/package/getToday.ts"],"names":[],"mappings":";AAAA,cAAc;;;AAEd,iCAA+D;AAE/D,UAAU;AACG,QAAA,QAAQ,GAAG;IACtB,OAAO,CAAC,GAAG,CAAC,0BAAoB,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;IAC7C,OAAO,mBAAa,CAAC,0BAAoB,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,EAAE,YAAY,CAAC,CAAA;AACtE,CAAC,CAAA"}
\ No newline at end of file
/**
* 用户购买记录查询
*
* @format
*/
export declare const getUserOrderlist: (context: any, queryStartTime: any, queryEndTime?: any, session?: string) => Promise<any[]>;
"use strict";
/**
* 用户购买记录查询
*
* @format
*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getUserOrderlist = void 0;
var dayjs = require("dayjs");
var sdk_1 = require("../../sdk");
var getSession_1 = require("./getSession");
var constants_1 = require("../../constants");
exports.getUserOrderlist = function (context, queryStartTime, queryEndTime, session) { return __awaiter(void 0, void 0, void 0, function () {
var results_1, currentTime, lastUpdateTime, params, orderResult, trade, e_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, 4, , 5]);
results_1 = [];
currentTime = Date.now();
lastUpdateTime = dayjs().add(-3, 'month').valueOf();
console.log("lastUpdateTime", lastUpdateTime);
// 若倒推的3个月时间小于传入的查询开始时间, 则以查询开始时间作为最后更新时间
if (lastUpdateTime < queryStartTime) {
lastUpdateTime = queryStartTime;
}
if (!!session) return [3 /*break*/, 2];
return [4 /*yield*/, getSession_1.getSellerSession(context)];
case 1:
session = (_a.sent()).session;
_a.label = 2;
case 2:
params = {
startTime: sdk_1.dateFormatter(sdk_1.transformBeijingDate(lastUpdateTime)),
endTime: sdk_1.dateFormatter(sdk_1.transformBeijingDate(queryEndTime || currentTime)),
openId: context.openId,
session: session
};
return [4 /*yield*/, sdk_1.TBAPIS.getBuyerOrderList(context, params)];
case 3:
orderResult = _a.sent();
if (orderResult.total_results > 0) {
trade = orderResult.trades.trade;
trade.forEach(function (i) {
if (constants_1.TAOBAO_SUCCESS_ORDER_STATUS.includes(i.status)) {
i.orders.order.forEach(function (s) {
results_1.push({
payTime: i.pay_time,
itemId: s.num_iid,
time: i.created,
price: s.price,
orderId: s.oid,
img: s.pic_path,
title: s.title,
tId: i.tid
});
});
}
});
}
console.log("\u5DF2\u652F\u4ED8\u7684\u8BA2\u5355\u5217\u8868", results_1);
return [2 /*return*/, results_1];
case 4:
e_1 = _a.sent();
console.log("\u9519\u8BEF", e_1);
return [2 /*return*/, []];
case 5: return [2 /*return*/];
}
});
}); };
//# sourceMappingURL=getUserOrderlist.js.map
\ No newline at end of file
{"version":3,"file":"getUserOrderlist.js","sourceRoot":"","sources":["../../../src/utils/package/getUserOrderlist.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6BAA8B;AAC9B,iCAAuE;AACvE,2CAA+C;AAC/C,6CAA6D;AAEhD,QAAA,gBAAgB,GAAG,UAAO,OAAO,EAAE,cAAc,EAAE,YAAa,EAAE,OAAgB;;;;;;gBAEvF,YAAU,EAAE,CAAA;gBACZ,WAAW,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;gBAExB,cAAc,GAAG,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,OAAO,EAAE,CAAA;gBACvD,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAA;gBAC7C,yCAAyC;gBACzC,IAAI,cAAc,GAAG,cAAc,EAAE;oBACnC,cAAc,GAAG,cAAc,CAAA;iBAChC;qBACG,CAAC,OAAO,EAAR,wBAAQ;gBACC,qBAAM,6BAAgB,CAAC,OAAO,CAAC,EAAA;;gBAA1C,OAAO,GAAG,CAAC,SAA+B,CAAC,CAAC,OAAO,CAAA;;;gBAGjD,MAAM,GAAG;oBACX,SAAS,EAAE,mBAAa,CAAC,0BAAoB,CAAC,cAAc,CAAC,CAAC;oBAC9D,OAAO,EAAE,mBAAa,CAAC,0BAAoB,CAAC,YAAY,IAAI,WAAW,CAAC,CAAC;oBACzE,MAAM,EAAE,OAAO,CAAC,MAAM;oBACtB,OAAO,SAAA;iBACR,CAAA;gBACiB,qBAAM,YAAM,CAAC,iBAAiB,CAAC,OAAO,EAAE,MAAM,CAAC,EAAA;;gBAA7D,WAAW,GAAG,SAA+C;gBACjE,IAAI,WAAW,CAAC,aAAa,GAAG,CAAC,EAAE;oBACzB,KAAK,GAAK,WAAW,CAAC,MAAM,MAAvB,CAAuB;oBACpC,KAAK,CAAC,OAAO,CAAC,UAAA,CAAC;wBACb,IAAI,uCAA2B,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE;4BAClD,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,UAAA,CAAC;gCACtB,SAAO,CAAC,IAAI,CAAC;oCACX,OAAO,EAAE,CAAC,CAAC,QAAQ;oCACnB,MAAM,EAAE,CAAC,CAAC,OAAO;oCACjB,IAAI,EAAE,CAAC,CAAC,OAAO;oCACf,KAAK,EAAE,CAAC,CAAC,KAAK;oCACd,OAAO,EAAE,CAAC,CAAC,GAAG;oCACd,GAAG,EAAE,CAAC,CAAC,QAAQ;oCACf,KAAK,EAAE,CAAC,CAAC,KAAK;oCACd,GAAG,EAAE,CAAC,CAAC,GAAG;iCACX,CAAC,CAAA;4BACJ,CAAC,CAAC,CAAA;yBACH;oBACH,CAAC,CAAC,CAAA;iBACH;gBACD,OAAO,CAAC,GAAG,CAAC,kDAAU,EAAE,SAAO,CAAC,CAAA;gBAChC,sBAAO,SAAO,EAAA;;;gBAEd,OAAO,CAAC,GAAG,CAAC,cAAI,EAAE,GAAC,CAAC,CAAA;gBACpB,sBAAO,EAAE,EAAA;;;;KAEZ,CAAA"}
\ No newline at end of file
/** @format */
export declare const isUseVipMock: (context: IContext<IParams>, userNick: string) => boolean;
"use strict";
/** @format */
Object.defineProperty(exports, "__esModule", { value: true });
exports.isUseVipMock = void 0;
// 测试环境 duib2账户mock数据
exports.isUseVipMock = function (context, userNick) {
var isTestEnv = context.env === 'test';
var isDuibaAccount = userNick.startsWith('duiba2');
return isTestEnv && isDuibaAccount;
};
//# sourceMappingURL=isUseVipMock.js.map
\ No newline at end of file
{"version":3,"file":"isUseVipMock.js","sourceRoot":"","sources":["../../../src/utils/package/isUseVipMock.ts"],"names":[],"mappings":";AAAA,cAAc;;;AAEd,qBAAqB;AACR,QAAA,YAAY,GAAG,UAAC,OAA0B,EAAE,QAAgB;IACvE,IAAM,SAAS,GAAG,OAAO,CAAC,GAAG,KAAK,MAAM,CAAA;IACxC,IAAM,cAAc,GAAG,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAA;IAEpD,OAAO,SAAS,IAAI,cAAc,CAAA;AACpC,CAAC,CAAA"}
\ No newline at end of file
/** @format */
/**
* 并发更新
* @param {接收数组或对象} daoqueryArr : [{dao: userdao, query:{id:_id}}, {dao: activityprizedao, query: {id:_id}}]
* @param {*} fn
* @param {*} times
*/
export declare const lockUpdate: (daoqueryArr: any, fn: any, times?: number) => Promise<any>;
/**
* 调用示例
*/
"use strict";
/** @format */
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.lockUpdate = void 0;
var constants_1 = require("../../constants");
/**
* 并发更新
* @param {接收数组或对象} daoqueryArr : [{dao: userdao, query:{id:_id}}, {dao: activityprizedao, query: {id:_id}}]
* @param {*} fn
* @param {*} times
*/
exports.lockUpdate = function (daoqueryArr, fn, times) {
if (times === void 0) { times = 5; }
return __awaiter(void 0, void 0, void 0, function () {
function waitFor(ms) {
return new Promise(function (resolve) {
setTimeout(resolve, ms);
});
}
var time, success, _loop_1, state_1, e_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (typeof daoqueryArr !== 'object' && !Array.isArray(daoqueryArr)) {
console.log("lockUpdate \u53C2\u6570\u9519\u8BEF");
return [2 /*return*/, false];
}
if (typeof daoqueryArr === 'object') {
daoqueryArr = [daoqueryArr];
}
time = 0;
console.log("\u8FDB\u5165update\u5E76\u53D1\u5904\u7406\u6B21\u6570", times);
success = false;
_a.label = 1;
case 1:
_a.trys.push([1, 5, , 6]);
_loop_1 = function () {
var updateRes, ret;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
updateRes = [];
daoqueryArr.forEach(function (daoquery) { return __awaiter(void 0, void 0, void 0, function () {
var canupdate;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, daoquery.dao.update(daoquery.query, { $set: { lockStatus: 2 } })];
case 1:
canupdate = _a.sent();
updateRes.push(canupdate);
return [2 /*return*/];
}
});
}); });
if (!!daoqueryArr.includes(0)) return [3 /*break*/, 2];
return [4 /*yield*/, fn()];
case 1:
ret = _a.sent();
daoqueryArr.forEach(function (daoquery) { return __awaiter(void 0, void 0, void 0, function () {
var ures;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, daoquery.dao.update(daoquery.query, { $set: { lockStatus: 1 } })];
case 1:
ures = _a.sent();
console.log("\u66F4\u65B0lockStatus\u4E3A0", ures);
return [2 /*return*/];
}
});
}); });
success = true;
return [2 /*return*/, { value: ret }];
case 2:
console.log("\u8FDB\u5165waitFor\u4E86\uFF0C\u9700\u7B49\u5F8530ms");
return [4 /*yield*/, waitFor(30)];
case 3:
_a.sent();
success = false;
_a.label = 4;
case 4: return [2 /*return*/];
}
});
};
_a.label = 2;
case 2:
if (!(time++ < times && !success)) return [3 /*break*/, 4];
return [5 /*yield**/, _loop_1()];
case 3:
state_1 = _a.sent();
if (typeof state_1 === "object")
return [2 /*return*/, state_1.value];
return [3 /*break*/, 2];
case 4: return [3 /*break*/, 6];
case 5:
e_1 = _a.sent();
console.log(e_1);
daoqueryArr.forEach(function (daoquery) { return __awaiter(void 0, void 0, void 0, function () {
var ures;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, daoquery.dao.update(daoquery.query, { $set: { lockStatus: 1 } })];
case 1:
ures = _a.sent();
console.log("\u66F4\u65B0lockStatus\u4E3A0", ures);
return [2 /*return*/];
}
});
}); });
success = false;
return [3 /*break*/, 6];
case 6:
// 稍后重试
if (!success) {
daoqueryArr.forEach(function (daoquery) { return __awaiter(void 0, void 0, void 0, function () {
var ures;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, daoquery.dao.update(daoquery.query, { $set: { lockStatus: 1 } })];
case 1:
ures = _a.sent();
console.log("\u64CD\u4F5C" + times + "\u6B21\u540E\u66F4\u65B0lockStatus\u4E3A0", ures);
return [2 /*return*/];
}
});
}); });
return [2 /*return*/, constants_1.CODE_TYPES.ERROR_UPDATE_RETRY];
}
return [2 /*return*/];
}
});
});
};
/**
* 调用示例
*/
// 扣库存
// let res = await lockUpdate({dao: this.activityprizedao, query: {_id}}, async ()=> {
// return await this.activityprizedao.update({_id}, {$set: {
// useStock: useStock + 1,
// updateTime: Date.now()
// }});
// });
// console.log(res);
// if (!res) {
// return CODE_TYPES.ERROR_UPDATE_RETRY;
// }
// return true;
//# sourceMappingURL=lockUpdate.js.map
\ No newline at end of file
{"version":3,"file":"lockUpdate.js","sourceRoot":"","sources":["../../../src/utils/package/lockUpdate.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEd,6CAA4C;AAE5C;;;;;GAKG;AACU,QAAA,UAAU,GAAG,UAAO,WAAW,EAAE,EAAE,EAAE,KAAS;IAAT,sBAAA,EAAA,SAAS;;QAoDzD,SAAS,OAAO,CAAC,EAAE;YACjB,OAAO,IAAI,OAAO,CAAC,UAAA,OAAO;gBACxB,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;YACzB,CAAC,CAAC,CAAA;QACJ,CAAC;;;;;oBAvDD,IAAI,OAAO,WAAW,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;wBAClE,OAAO,CAAC,GAAG,CAAC,qCAAiB,CAAC,CAAA;wBAC9B,sBAAO,KAAK,EAAA;qBACb;oBACD,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE;wBACn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AAC,GAAG,CAAC,GAAC,CAAC,CAAA;oBACd,WAAW,CAAC,OAAO,CAAC,UAAM,QAAQ;;;;wCACrB,qBAAM,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,EAAE,CAAC,EAAA;;oCAA7E,IAAI,GAAG,SAAsE;oCACjF,OAAO,CAAC,GAAG,CAAC,+BAAgB,EAAE,IAAI,CAAC,CAAA;;;;yBACpC,CAAC,CAAA;oBACF,OAAO,GAAG,KAAK,CAAA;;;oBAEjB,OAAO;oBACP,IAAI,CAAC,OAAO,EAAE;wBACZ,WAAW,CAAC,OAAO,CAAC,UAAM,QAAQ;;;;4CACrB,qBAAM,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,EAAE,CAAC,EAAA;;wCAA7E,IAAI,GAAG,SAAsE;wCACjF,OAAO,CAAC,GAAG,CAAC,iBAAK,KAAK,8CAAkB,EAAE,IAAI,CAAC,CAAA;;;;6BAChD,CAAC,CAAA;wBACF,sBAAO,sBAAU,CAAC,kBAAkB,EAAA;qBACrC;;;;;CAMF,CAAA;AAED;;GAEG;AACH,MAAM;AACN,sFAAsF;AACtF,8DAA8D;AAC9D,8BAA8B;AAC9B,6BAA6B;AAC7B,SAAS;AACT,MAAM;AACN,oBAAoB;AACpB,cAAc;AACd,0CAA0C;AAC1C,IAAI;AACJ,eAAe"}
\ No newline at end of file
export declare const logFn: (context: IContext<IParams>) => void;
export declare const recordErrorLog: (context: IContext<IParams>, baseInfos: IControllerInfos, errorMsg: string, stack: string) => Promise<any>;
export declare const logger: (message: any) => void;
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.logger = exports.recordErrorLog = exports.logFn = void 0;
/** @format */
var sdk_1 = require("../../sdk");
var db_1 = require("../../db");
var utils_1 = require("../../utils");
exports.logFn = function (context) {
var _a, _b, _c;
var data = JSON.stringify(context.data);
console.log(context);
console.log("---------\u51FD\u6570: " + (context.fcName || '') + "." + (((_c = (_b = (_a = context === null || context === void 0 ? void 0 : context.cloud) === null || _a === void 0 ? void 0 : _a.dataspace) === null || _b === void 0 ? void 0 : _b.context) === null || _c === void 0 ? void 0 : _c.handler) || context.handler) + "------------");
console.log("---------\u8BF7\u6C42\u53C2\u6570: " + data + "------------");
};
// 记录错误日志
exports.recordErrorLog = function (context, baseInfos, errorMsg, stack) { return __awaiter(void 0, void 0, void 0, function () {
var openId, activityId, userInfo, userNick, logdao, functionName;
var _a, _b, _c;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
openId = context.openId;
activityId = (context.data || {}).activityId;
userInfo = baseInfos.userInfo;
userNick = (userInfo || {}).userNick;
logdao = new sdk_1.BaseDao(context, db_1.ERROR_LOG_DB_NAME);
functionName = (context.fcName || '') + "." + (((_c = (_b = (_a = context === null || context === void 0 ? void 0 : context.cloud) === null || _a === void 0 ? void 0 : _a.dataspace) === null || _b === void 0 ? void 0 : _b.context) === null || _c === void 0 ? void 0 : _c.handler) || context.handler);
return [4 /*yield*/, logdao.insertOne({
openId: openId,
activityId: activityId,
errorMsg: errorMsg,
errorStack: stack,
functionName: functionName,
userNick: userNick,
fcInvokeId: context.fcInvokeId,
params: context.data,
createTime: Date.now(),
createDay: utils_1.getToday(),
catchType: 1
})];
case 1: return [2 /*return*/, _d.sent()];
}
});
}); };
// 本地mock 增加颜色辨识度
exports.logger = function (message) {
console.log('\x1b[36m%s\x1b[0m', "-------------------\u65E5\u5FD7----------------------------");
console.log('\x1b[36m%s\x1b[0m', JSON.stringify(message, null, 2));
console.log('\x1b[36m%s\x1b[0m', "-------------------\u65E5\u5FD7----------------------------");
// console.log(`\033[42;30m 日志 \033[40;32m ${message} \033[0m`)
};
//# sourceMappingURL=logger.js.map
\ No newline at end of file
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../src/utils/package/logger.ts"],"names":[],"mappings":";;;;;;;;;;;;;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K;wBACjB,YAAY,cAAA;wBACZ,QAAQ,UAAA;wBACR,UAAU,EAAE,OAAO,CAAC,UAAU;wBAC9B,MAAM,EAAE,OAAO,CAAC,IAAI;wBACpB,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE;wBACtB,SAAS,EAAE,gBAAQ,EAAE;wBACrB,SAAS,EAAE,CAAC;qBACb,CAAC,EAAA;oBAZF,sBAAO,SAYL,EAAA;;;KACH,CAAA;AAED,iBAAiB;AACJ,QAAA,MAAM,GAAG,UAAC,OAAY;IACjC,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,6DAAmD,CAAC,CAAA;IACrF,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;IAClE,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,6DAAmD,CAAC,CAAA;IAErF,+DAA+D;AACjE,CAAC,CAAA"}
\ No newline at end of file
/** @format */
export declare const rand: (number: number) => number;
export declare const signFigures: (num: number, rank?: number) => number;
"use strict";
/** @format */
Object.defineProperty(exports, "__esModule", { value: true });
exports.signFigures = exports.rand = void 0;
// 获取随机数
exports.rand = (function () {
var seed = new Date().getTime();
function r() {
seed = (seed * 9301 + 49297) % 233280;
return seed / 233280.0;
}
return function (number) {
return Math.ceil(r() * number);
};
})();
exports.signFigures = function (num, rank) {
if (rank === void 0) { rank = 6; }
if (!num)
return 0;
var sign = num / Math.abs(num);
var number = num * sign;
var temp = rank - 1 - Math.floor(Math.log10(number));
var ans;
if (temp > 0) {
ans = parseFloat(number.toFixed(temp));
}
else if (temp < 0) {
ans = Math.round(number / Math.pow(10, temp)) * temp;
}
else {
ans = Math.round(number);
}
return ans * sign;
};
//# sourceMappingURL=rand.js.map
\ No newline at end of file
{"version":3,"file":"rand.js","sourceRoot":"","sources":["../../../src/utils/package/rand.ts"],"names":[],"mappings":";AAAA,cAAc;;;AAEd,QAAQ;AACK,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ib/utils/codetypes';
/**
* 发奖,包含权益,实物,积分
* @param {*} document 必须要有{ type, ename, _id }
* @param {*} session
* @param {*} context
*/
export declare const sendTBAward: (context: IContext<IParams>, session: string, document: IAwards) => Promise<IAwards | CodeType>;
/**
* 发放积分
* @param {发放的积分数} credits
* @param {*} session
* @param {*} context
* @returns {drawStatus, remark}
*/
export declare const sendCredits: (credits: number, session: string, context: IContext<IParams>) => Promise<{
drawStatus: number;
remark: string;
}>;
/**
* @desc 发放权益
* @param {权益名称} ename
* @param {唯一key} uniqueId
* @param {*} session
* @param {*} context
* @returns { drawStatus, remark }
*/
export declare const sendEname: (ename: string, uniqueId: string, session: string, context: IContext<IParams>) => Promise<{
remark: string;
drawStatus: number;
}>;
"use strict";
/** @format */
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.sendEname = exports.sendCredits = exports.sendTBAward = void 0;
var constants_1 = require("../../constants");
var sdk_1 = require("../../sdk");
/**
* 发奖,包含权益,实物,积分
* @param {*} document 必须要有{ type, ename, _id }
* @param {*} session
* @param {*} context
*/
exports.sendTBAward = function (context, session, document) { return __awaiter(void 0, void 0, void 0, function () {
var type, ename, _id, credits, _a, drawStatus, remark, _b, drawStatus, remark, e_1;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
type = document.type, ename = document.ename, _id = document._id, credits = document.credits;
if (!type) {
return [2 /*return*/, constants_1.CODE_TYPES.PARAMS_ERROR];
}
if (type === constants_1.PRIZE_TYPE.OBJECT) {
return [2 /*return*/, document];
}
_c.label = 1;
case 1:
_c.trys.push([1, 6, , 7]);
console.log("type", type);
if (!(type === constants_1.PRIZE_TYPE.ENAME)) return [3 /*break*/, 3];
console.log("\u4E2D\u6743\u76CA");
return [4 /*yield*/, exports.sendEname(ename, _id, session, context)];
case 2:
_a = _c.sent(), drawStatus = _a.drawStatus, remark = _a.remark;
console.log("drawStatus, remark", drawStatus, remark);
document.drawStatus = drawStatus;
document.remark = remark;
return [3 /*break*/, 5];
case 3:
if (!(type === constants_1.PRIZE_TYPE.CREDITS)) return [3 /*break*/, 5];
return [4 /*yield*/, exports.sendCredits(credits, session, context)];
case 4:
_b = _c.sent(), drawStatus = _b.drawStatus, remark = _b.remark;
document.drawStatus = drawStatus;
document.remark = remark;
_c.label = 5;
case 5: return [2 /*return*/, document];
case 6:
e_1 = _c.sent();
console.log("\u53D1\u5956\u9519\u8BEF", e_1);
return [2 /*return*/, constants_1.CODE_TYPES.PARAMS_ERROR];
case 7: return [2 /*return*/];
}
});
}); };
/**
* 发放积分
* @param {发放的积分数} credits
* @param {*} session
* @param {*} context
* @returns {drawStatus, remark}
*/
exports.sendCredits = function (credits, session, context) { return __awaiter(void 0, void 0, void 0, function () {
var drawStatus, remark, result;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
drawStatus = 0;
remark = '';
return [4 /*yield*/, sdk_1.TBAPIS.changeCredits(context, session, {
quantity: credits,
change_type: 2,
opt_type: '0',
remark: "\u53C2\u4E0E\u6D3B\u52A8\u52A0\u79EF\u5206"
})];
case 1:
result = _a.sent();
if (result) {
drawStatus = constants_1.DRAW_STATUS.SUCCESS;
}
else {
drawStatus = constants_1.DRAW_STATUS.FAIL;
remark = result.result_msg;
}
return [2 /*return*/, { drawStatus: drawStatus, remark: remark }];
}
});
}); };
/**
* @desc 发放权益
* @param {权益名称} ename
* @param {唯一key} uniqueId
* @param {*} session
* @param {*} context
* @returns { drawStatus, remark }
*/
exports.sendEname = function (ename, uniqueId, session, context) { return __awaiter(void 0, void 0, void 0, function () {
var result, e_2, drawStatus, remark, result_code;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
result = {
result_success: '',
result_code: '',
msg: '',
result_msg: '',
sub_msg: ''
};
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
return [4 /*yield*/, sdk_1.TBAPIS.benefitSend(context, {
right_ename: ename,
receiver_id: context.openId,
unique_id: uniqueId,
app_name: constants_1.C_APP_NAME,
session: session
})];
case 2:
result = _a.sent();
return [3 /*break*/, 4];
case 3:
e_2 = _a.sent();
console.log("\u53D1\u653E\u6743\u76CA\u5931\u8D25", e_2);
result = e_2;
return [3 /*break*/, 4];
case 4:
drawStatus = 0;
remark = '';
if (result.result_success) {
drawStatus = constants_1.DRAW_STATUS.SUCCESS;
}
else {
result_code = result.result_code;
if ([
'APPLY_SINGLE_COUPON_COUNT_EXCEED_LIMIT',
'APPLY_ONE_SELLER_COUNT_EXCEED_LIMIT',
'USER_PERMISSION_EXCEED_MAX_RIGHT_COUNT_IN_DAY'
].includes(result_code)) {
drawStatus = constants_1.DRAW_STATUS.RETRY;
}
else {
drawStatus = constants_1.DRAW_STATUS.FAIL;
}
remark = constants_1.TBERROR[result_code || result.msg] || result.result_msg || result.sub_msg || "\u53D1\u653E\u5931\u8D25";
}
return [2 /*return*/, { remark: remark, drawStatus: drawStatus }];
}
});
}); };
//# sourceMappingURL=sendTBAward.js.map
\ No newline at end of file
{"version":3,"file":"sendTBAward.js","sourceRoot":"","sources":["../../../src/utils/package/sendTBAward.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEd,6CAA0F;AAC1F,iCAAgD;AAGhD;;;;;GAKG;AACU,QAAA,WAAW,GAAG,UACzB,OAA0B,EAC1B,OAAe,EACf,QAAiB;;;;;gBAEX,IAAI,GAA0B,QAAQ,KAAlC,EAAE,KAAK,GAAmB,QAAQ,MAA3B,EAAE,GAAG,GAAc,QAAQ,IAAtB,EAAE,OAAO,GAAK,QAAQ,QAAb,CAAa;gBAC5C,IAAI,CAAC,IAAI,EAAE;oBACT,sBAAO,sBAAU,CAAC,YAAY,EAAA;iBAC/B;gBACD,IAAI,IAAI,KAAK,sBAAU,CAAC,MAAM,EAAE;oBAC9B,sBAAO,QAAQ,EAAA;iBAChB;;;;gBAGC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;qBAErB,CAAA,IAAI,KAAK,sBAAU,CAAC,KAAK,CAAA,EAAzB,wBAAyB;gBAC3B,OAAO,CAAC,GAAG,CAAC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AU,IAAI,MAAM,CAAC,OAAO,IAAI,0BAAM,CAAA;iBAC7F;gBACD,sBAAO,EAAE,MAAM,QAAA,EAAE,UAAU,YAAA,EAAE,EAAA;;;KAC9B,CAAA"}
\ No newline at end of file
/** @format */
export declare const VIP_MOCK: {
isVip: boolean;
url: string;
};
"use strict";
/** @format */
Object.defineProperty(exports, "__esModule", { value: true });
exports.VIP_MOCK = void 0;
// 测试环境下 duiba2及其子账号自动开启VIP_MOCK, 返回数据可在此设置
exports.VIP_MOCK = {
isVip: false,
url: '//taobao.com'
};
//# sourceMappingURL=vipMock.js.map
\ No newline at end of file
{"version":3,"file":"vipMock.js","sourceRoot":"","sources":["../src/vipMock.ts"],"names":[],"mappings":";AAAA,cAAc;;;AAEd,2CAA2C;AAC9B,QAAA,QAAQ,GAAG;IACtB,KAAK,EAAE,KAAK;IACZ,GAAG,EAAE,cAAc;CACpB,CAAA"}
\ No newline at end of file
/** @format */
require('source-map-support').install()
const fns = require('./dist/index')
module.exports = fns.default
{
"name": "mockserver",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@sindresorhus/is": {
"version": "0.14.0",
"resolved": "https://registry.npm.taobao.org/@sindresorhus/is/download/@sindresorhus/is-0.14.0.tgz?cache=0&sync_timestamp=1597573685903&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40sindresorhus%2Fis%2Fdownload%2F%40sindresorhus%2Fis-0.14.0.tgz",
"integrity": "sha1-n7OjzzEyMoFR81PeRjLgHlIQK+o=",
"dev": true
},
"@szmarczak/http-timer": {
"version": "1.1.2",
"resolved": "https://registry.npm.taobao.org/@szmarczak/http-timer/download/@szmarczak/http-timer-1.1.2.tgz",
"integrity": "sha1-sWZeLEYaLNkvTBu/UNVFTeDUtCE=",
"dev": true,
"requires": {
"defer-to-connect": "^1.0.1"
}
},
"@types/color-name": {
"version": "1.1.1",
"resolved": "https://registry.npm.taobao.org/@types/color-name/download/@types/color-name-1.1.1.tgz?cache=0&sync_timestamp=1596837707987&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Fcolor-name%2Fdownload%2F%40types%2Fcolor-name-1.1.1.tgz",
"integrity": "sha1-HBJhu+qhCoBVu8XYq4S3sq/IRqA=",
"dev": true
},
"@types/http-proxy": {
"version": "1.17.4",
"resolved": "https://registry.npm.taobao.org/@types/http-proxy/download/@types/http-proxy-1.17.4.tgz?cache=0&sync_timestamp=1596840717330&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Fhttp-proxy%2Fdownload%2F%40types%2Fhttp-proxy-1.17.4.tgz",
"integrity": "sha1-58kuPb4+E6p5lED/QubToXqdBFs=",
"requires": {
"@types/node": "*"
}
},
"@types/node": {
"version": "14.0.27",
"resolved": "https://registry.npm.taobao.org/@types/node/download/@types/node-14.0.27.tgz?cache=0&sync_timestamp=1596839161536&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Fnode%2Fdownload%2F%40types%2Fnode-14.0.27.tgz",
"integrity": "sha1-oVGHOvWl6FG1GzsGXJ5jOQqeDrE="
},
"abbrev": {
"version": "1.1.1",
"resolved": "https://registry.npm.taobao.org/abbrev/download/abbrev-1.1.1.tgz",
"integrity": "sha1-+PLIh60Qv2f2NPAFtph/7TF5qsg=",
"dev": true
},
"accepts": {
"version": "1.3.7",
"resolved": "https://registry.npm.taobao.org/accepts/download/accepts-1.3.7.tgz",
"integrity": "sha1-UxvHJlF6OytB+FACHGzBXqq1B80=",
"requires": {
"mime-types": "~2.1.24",
"negotiator": "0.6.2"
}
},
"ansi-align": {
"version": "3.0.0",
"resolved": "https://registry.npm.taobao.org/ansi-align/download/ansi-align-3.0.0.tgz",
"integrity": "sha1-tTazcc9ofKrvI2wY0+If43l0Z8s=",
"dev": true,
"requires": {
"string-width": "^3.0.0"
},
"dependencies": {
"string-width": {
"version": "3.1.0",
"resolved": "https://registry.npm.taobao.org/string-width/download/string-width-3.1.0.tgz",
"integrity": "sha1-InZ74htirxCBV0MG9prFG2IgOWE=",
"dev": true,
"requires": {
"emoji-regex": "^7.0.1",
"is-fullwidth-code-point": "^2.0.0",
"strip-ansi": "^5.1.0"
}
}
}
},
"ansi-regex": {
"version": "4.1.0",
"resolved": "https://registry.npm.taobao.org/ansi-regex/download/ansi-regex-4.1.0.tgz?cache=0&sync_timestamp=1570188663907&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fansi-regex%2Fdownload%2Fansi-regex-4.1.0.tgz",
"integrity": "sha1-i5+PCM8ay4Q3Vqg5yox+MWjFGZc=",
"dev": true
},
"ansi-styles": {
"version": "4.2.1",
"resolved": "https://registry.npm.taobao.org/ansi-styles/download/ansi-styles-4.2.1.tgz",
"integrity": "sha1-kK51xCTQCNJiTFvynq0xd+v881k=",
"dev": true,
"requires": {
"@types/color-name": "^1.1.1",
"color-convert": "^2.0.1"
}
},
"anymatch": {
"version": "3.1.1",
"resolved": "https://registry.npm.taobao.org/anymatch/download/anymatch-3.1.1.tgz",
"integrity": "sha1-xV7PAhheJGklk5kxDBc84xIzsUI=",
"dev": true,
"requires": {
"normalize-path": "^3.0.0",
"picomatch": "^2.0.4"
}
},
"array-flatten": {
"version": "1.1.1",
"resolved": "https://registry.npm.taobao.org/array-flatten/download/array-flatten-1.1.1.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Farray-flatten%2Fdownload%2Farray-flatten-1.1.1.tgz",
"integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI="
},
"axios": {
"version": "0.19.2",
"resolved": "https://registry.npm.taobao.org/axios/download/axios-0.19.2.tgz",
"integrity": "sha1-PqNsXYgY0NX4qKl6bTa4bNwAyyc=",
"requires": {
"follow-redirects": "1.5.10"
}
},
"balanced-match": {
"version": "1.0.0",
"resolved": "https://registry.npm.taobao.org/balanced-match/download/balanced-match-1.0.0.tgz",
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
"dev": true
},
"binary-extensions": {
"version": "2.1.0",
"resolved": "https://registry.npm.taobao.org/binary-extensions/download/binary-extensions-2.1.0.tgz",
"integrity": "sha1-MPpAyef+B9vIlWeM0ocCTeokHdk=",
"dev": true
},
"body-parser": {
"version": "1.19.0",
"resolved": "https://registry.npm.taobao.org/body-parser/download/body-parser-1.19.0.tgz",
"integrity": "sha1-lrJwnlfJxOCab9Zqj9l5hE9p8Io=",
"requires": {
"bytes": "3.1.0",
"content-type": "~1.0.4",
"debug": "2.6.9",
"depd": "~1.1.2",
"http-errors": "1.7.2",
"iconv-lite": "0.4.24",
"on-finished": "~2.3.0",
"qs": "6.7.0",
"raw-body": "2.4.0",
"type-is": "~1.6.17"
},
"dependencies": {
"debug": {
"version": "2.6.9",
"resolved": "https://registry.npm.taobao.org/debug/download/debug-2.6.9.tgz",
"integrity": "sha1-XRKFFd8TT/Mn6QpMk/Tgd6U2NB8=",
"requires": {
"ms": "2.0.0"
}
}
}
},
"boxen": {
"version": "4.2.0",
"resolved": "https://registry.npm.taobao.org/boxen/download/boxen-4.2.0.tgz",
"integrity": "sha1-5BG2I1fW1tNlh8isPV2XTaoHDmQ=",
"dev": true,
"requires": {
"ansi-align": "^3.0.0",
"camelcase": "^5.3.1",
"chalk": "^3.0.0",
"cli-boxes": "^2.2.0",
"string-width": "^4.1.0",
"term-size": "^2.1.0",
"type-fest": "^0.8.1",
"widest-line": "^3.1.0"
}
},
"brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npm.taobao.org/brace-expansion/download/brace-expansion-1.1.11.tgz",
"integrity": "sha1-PH/L9SnYcibz0vUrlm/1Jx60Qd0=",
"dev": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
"braces": {
"version": "3.0.2",
"resolved": "https://registry.npm.taobao.org/braces/download/braces-3.0.2.tgz",
"integrity": "sha1-NFThpGLujVmeI23zNs2epPiv4Qc=",
"requires": {
"fill-range": "^7.0.1"
}
},
"bytes": {
"version": "3.1.0",
"resolved": "https://registry.npm.taobao.org/bytes/download/bytes-3.1.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fbytes%2Fdownload%2Fbytes-3.1.0.tgz",
"integrity": "sha1-9s95M6Ng4FiPqf3oVlHNx/gF0fY="
},
"cacheable-request": {
"version": "6.1.0",
"resolved": "https://registry.npm.taobao.org/cacheable-request/download/cacheable-request-6.1.0.tgz",
"integrity": "sha1-IP+4vRYrpL4R6VZ9gj22UQUsqRI=",
"dev": true,
"requires": {
"clone-response": "^1.0.2",
"get-stream": "^5.1.0",
"http-cache-semantics": "^4.0.0",
"keyv": "^3.0.0",
"lowercase-keys": "^2.0.0",
"normalize-url": "^4.1.0",
"responselike": "^1.0.2"
},
"dependencies": {
"get-stream": {
"version": "5.2.0",
"resolved": "https://registry.npm.taobao.org/get-stream/download/get-stream-5.2.0.tgz?cache=0&sync_timestamp=1597056455691&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fget-stream%2Fdownload%2Fget-stream-5.2.0.tgz",
"integrity": "sha1-SWaheV7lrOZecGxLe+txJX1uItM=",
"dev": true,
"requires": {
"pump": "^3.0.0"
}
},
"lowercase-keys": {
"version": "2.0.0",
"resolved": "https://registry.npm.taobao.org/lowercase-keys/download/lowercase-keys-2.0.0.tgz",
"integrity": "sha1-JgPni3tLAAbLyi+8yKMgJVislHk=",
"dev": true
}
}
},
"camelcase": {
"version": "5.3.1",
"resolved": "https://registry.npm.taobao.org/camelcase/download/camelcase-5.3.1.tgz",
"integrity": "sha1-48mzFWnhBoEd8kL3FXJaH0xJQyA=",
"dev": true
},
"chalk": {
"version": "3.0.0",
"resolved": "https://registry.npm.taobao.org/chalk/download/chalk-3.0.0.tgz?cache=0&sync_timestamp=1592843133653&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fchalk%2Fdownload%2Fchalk-3.0.0.tgz",
"integrity": "sha1-P3PCv1JlkfV0zEksUeJFY0n4ROQ=",
"dev": true,
"requires": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
},
"dependencies": {
"has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npm.taobao.org/has-flag/download/has-flag-4.0.0.tgz",
"integrity": "sha1-lEdx/ZyByBJlxNaUGGDaBrtZR5s=",
"dev": true
},
"supports-color": {
"version": "7.1.0",
"resolved": "https://registry.npm.taobao.org/supports-color/download/supports-color-7.1.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsupports-color%2Fdownload%2Fsupports-color-7.1.0.tgz",
"integrity": "sha1-aOMlkd9z4lrRxLSRCKLsUHliv9E=",
"dev": true,
"requires": {
"has-flag": "^4.0.0"
}
}
}
},
"chokidar": {
"version": "3.4.2",
"resolved": "https://registry.npm.taobao.org/chokidar/download/chokidar-3.4.2.tgz?cache=0&sync_timestamp=1596728921978&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fchokidar%2Fdownload%2Fchokidar-3.4.2.tgz",
"integrity": "sha1-ONyOZY3sOAl0HrPve7Ckf+QkIy0=",
"dev": true,
"requires": {
"anymatch": "~3.1.1",
"braces": "~3.0.2",
"fsevents": "~2.1.2",
"glob-parent": "~5.1.0",
"is-binary-path": "~2.1.0",
"is-glob": "~4.0.1",
"normalize-path": "~3.0.0",
"readdirp": "~3.4.0"
}
},
"ci-info": {
"version": "2.0.0",
"resolved": "https://registry.npm.taobao.org/ci-info/download/ci-info-2.0.0.tgz",
"integrity": "sha1-Z6npZL4xpR4V5QENWObxKDQAL0Y=",
"dev": true
},
"cli-boxes": {
"version": "2.2.0",
"resolved": "https://registry.npm.taobao.org/cli-boxes/download/cli-boxes-2.2.0.tgz",
"integrity": "sha1-U47K6PnGylCOPDyVtFP+k8tMFo0=",
"dev": true
},
"clone-response": {
"version": "1.0.2",
"resolved": "https://registry.npm.taobao.org/clone-response/download/clone-response-1.0.2.tgz",
"integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=",
"dev": true,
"requires": {
"mimic-response": "^1.0.0"
}
},
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npm.taobao.org/color-convert/download/color-convert-2.0.1.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcolor-convert%2Fdownload%2Fcolor-convert-2.0.1.tgz",
"integrity": "sha1-ctOmjVmMm9s68q0ehPIdiWq9TeM=",
"dev": true,
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.npm.taobao.org/color-name/download/color-name-1.1.4.tgz",
"integrity": "sha1-wqCah6y95pVD3m9j+jmVyCbFNqI=",
"dev": true
},
"concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npm.taobao.org/concat-map/download/concat-map-0.0.1.tgz",
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
"dev": true
},
"configstore": {
"version": "5.0.1",
"resolved": "https://registry.npm.taobao.org/configstore/download/configstore-5.0.1.tgz",
"integrity": "sha1-02UCG130uYzdGH1qOw4/anzF7ZY=",
"dev": true,
"requires": {
"dot-prop": "^5.2.0",
"graceful-fs": "^4.1.2",
"make-dir": "^3.0.0",
"unique-string": "^2.0.0",
"write-file-atomic": "^3.0.0",
"xdg-basedir": "^4.0.0"
}
},
"content-disposition": {
"version": "0.5.3",
"resolved": "https://registry.npm.taobao.org/content-disposition/download/content-disposition-0.5.3.tgz",
"integrity": "sha1-4TDK9+cnkIfFYWwgB9BIVpiYT70=",
"requires": {
"safe-buffer": "5.1.2"
}
},
"content-type": {
"version": "1.0.4",
"resolved": "https://registry.npm.taobao.org/content-type/download/content-type-1.0.4.tgz",
"integrity": "sha1-4TjMdeBAxyexlm/l5fjJruJW/js="
},
"cookie": {
"version": "0.4.0",
"resolved": "https://registry.npm.taobao.org/cookie/download/cookie-0.4.0.tgz?cache=0&sync_timestamp=1587525873712&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcookie%2Fdownload%2Fcookie-0.4.0.tgz",
"integrity": "sha1-vrQ35wIrO21JAZ0IhmUwPr6cFLo="
},
"cookie-parser": {
"version": "1.4.5",
"resolved": "https://registry.npm.taobao.org/cookie-parser/download/cookie-parser-1.4.5.tgz?cache=0&sync_timestamp=1584246006993&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcookie-parser%2Fdownload%2Fcookie-parser-1.4.5.tgz",
"integrity": "sha1-PlctS3wMgPnGHa9gTkM2gxtdHUk=",
"requires": {
"cookie": "0.4.0",
"cookie-signature": "1.0.6"
}
},
"cookie-signature": {
"version": "1.0.6",
"resolved": "https://registry.npm.taobao.org/cookie-signature/download/cookie-signature-1.0.6.tgz",
"integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw="
},
"crypto-random-string": {
"version": "2.0.0",
"resolved": "https://registry.npm.taobao.org/crypto-random-string/download/crypto-random-string-2.0.0.tgz",
"integrity": "sha1-7yp6lm7BEIM4g2m6oC6+rSKbMNU=",
"dev": true
},
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npm.taobao.org/debug/download/debug-3.1.0.tgz",
"integrity": "sha1-W7WgZyYotkFJVmuhaBnmFRjGcmE=",
"requires": {
"ms": "2.0.0"
}
},
"decompress-response": {
"version": "3.3.0",
"resolved": "https://registry.npm.taobao.org/decompress-response/download/decompress-response-3.3.0.tgz",
"integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=",
"dev": true,
"requires": {
"mimic-response": "^1.0.0"
}
},
"deep-extend": {
"version": "0.6.0",
"resolved": "https://registry.npm.taobao.org/deep-extend/download/deep-extend-0.6.0.tgz",
"integrity": "sha1-xPp8lUBKF6nD6Mp+FTcxK3NjMKw=",
"dev": true
},
"defer-to-connect": {
"version": "1.1.3",
"resolved": "https://registry.npm.taobao.org/defer-to-connect/download/defer-to-connect-1.1.3.tgz",
"integrity": "sha1-MxrgUMCNz3ifjIOnuB8O2U9KxZE=",
"dev": true
},
"depd": {
"version": "1.1.2",
"resolved": "https://registry.npm.taobao.org/depd/download/depd-1.1.2.tgz",
"integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak="
},
"destroy": {
"version": "1.0.4",
"resolved": "https://registry.npm.taobao.org/destroy/download/destroy-1.0.4.tgz",
"integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
},
"dot-prop": {
"version": "5.2.0",
"resolved": "https://registry.npm.taobao.org/dot-prop/download/dot-prop-5.2.0.tgz?cache=0&sync_timestamp=1597574926376&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fdot-prop%2Fdownload%2Fdot-prop-5.2.0.tgz",
"integrity": "sha1-w07MKVVtxF8fTCJpe29JBODMT8s=",
"dev": true,
"requires": {
"is-obj": "^2.0.0"
}
},
"duplexer3": {
"version": "0.1.4",
"resolved": "https://registry.npm.taobao.org/duplexer3/download/duplexer3-0.1.4.tgz",
"integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=",
"dev": true
},
"ee-first": {
"version": "1.1.1",
"resolved": "https://registry.npm.taobao.org/ee-first/download/ee-first-1.1.1.tgz",
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
},
"emoji-regex": {
"version": "7.0.3",
"resolved": "https://registry.npm.taobao.org/emoji-regex/download/emoji-regex-7.0.3.tgz",
"integrity": "sha1-kzoEBShgyF6DwSJHnEdIqOTHIVY=",
"dev": true
},
"encodeurl": {
"version": "1.0.2",
"resolved": "https://registry.npm.taobao.org/encodeurl/download/encodeurl-1.0.2.tgz",
"integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k="
},
"end-of-stream": {
"version": "1.4.4",
"resolved": "https://registry.npm.taobao.org/end-of-stream/download/end-of-stream-1.4.4.tgz",
"integrity": "sha1-WuZKX0UFe682JuwU2gyl5LJDHrA=",
"dev": true,
"requires": {
"once": "^1.4.0"
}
},
"escape-goat": {
"version": "2.1.1",
"resolved": "https://registry.npm.taobao.org/escape-goat/download/escape-goat-2.1.1.tgz",
"integrity": "sha1-Gy3HcANnbEV+x2Cy3GjttkgYhnU=",
"dev": true
},
"escape-html": {
"version": "1.0.3",
"resolved": "https://registry.npm.taobao.org/escape-html/download/escape-html-1.0.3.tgz",
"integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg="
},
"etag": {
"version": "1.8.1",
"resolved": "https://registry.npm.taobao.org/etag/download/etag-1.8.1.tgz",
"integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc="
},
"eventemitter3": {
"version": "4.0.4",
"resolved": "https://registry.npm.taobao.org/eventemitter3/download/eventemitter3-4.0.4.tgz?cache=0&sync_timestamp=1589283105849&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Feventemitter3%2Fdownload%2Feventemitter3-4.0.4.tgz",
"integrity": "sha1-tUY6zmNaCD0Bi9x8kXtMXxCoU4Q="
},
"express": {
"version": "4.17.1",
"resolved": "https://registry.npm.taobao.org/express/download/express-4.17.1.tgz?cache=0&sync_timestamp=1585184310145&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fexpress%2Fdownload%2Fexpress-4.17.1.tgz",
"integrity": "sha1-RJH8OGBc9R+GKdOcK10Cb5ikwTQ=",
"requires": {
"accepts": "~1.3.7",
"array-flatten": "1.1.1",
"body-parser": "1.19.0",
"content-disposition": "0.5.3",
"content-type": "~1.0.4",
"cookie": "0.4.0",
"cookie-signature": "1.0.6",
"debug": "2.6.9",
"depd": "~1.1.2",
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"etag": "~1.8.1",
"finalhandler": "~1.1.2",
"fresh": "0.5.2",
"merge-descriptors": "1.0.1",
"methods": "~1.1.2",
"on-finished": "~2.3.0",
"parseurl": "~1.3.3",
"path-to-regexp": "0.1.7",
"proxy-addr": "~2.0.5",
"qs": "6.7.0",
"range-parser": "~1.2.1",
"safe-buffer": "5.1.2",
"send": "0.17.1",
"serve-static": "1.14.1",
"setprototypeof": "1.1.1",
"statuses": "~1.5.0",
"type-is": "~1.6.18",
"utils-merge": "1.0.1",
"vary": "~1.1.2"
},
"dependencies": {
"debug": {
"version": "2.6.9",
"resolved": "https://registry.npm.taobao.org/debug/download/debug-2.6.9.tgz",
"integrity": "sha1-XRKFFd8TT/Mn6QpMk/Tgd6U2NB8=",
"requires": {
"ms": "2.0.0"
}
}
}
},
"fill-range": {
"version": "7.0.1",
"resolved": "https://registry.npm.taobao.org/fill-range/download/fill-range-7.0.1.tgz",
"integrity": "sha1-GRmmp8df44ssfHflGYU12prN2kA=",
"requires": {
"to-regex-range": "^5.0.1"
}
},
"finalhandler": {
"version": "1.1.2",
"resolved": "https://registry.npm.taobao.org/finalhandler/download/finalhandler-1.1.2.tgz",
"integrity": "sha1-t+fQAP/RGTjQ/bBTUG9uur6fWH0=",
"requires": {
"debug": "2.6.9",
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"on-finished": "~2.3.0",
"parseurl": "~1.3.3",
"statuses": "~1.5.0",
"unpipe": "~1.0.0"
},
"dependencies": {
"debug": {
"version": "2.6.9",
"resolved": "https://registry.npm.taobao.org/debug/download/debug-2.6.9.tgz",
"integrity": "sha1-XRKFFd8TT/Mn6QpMk/Tgd6U2NB8=",
"requires": {
"ms": "2.0.0"
}
}
}
},
"follow-redirects": {
"version": "1.5.10",
"resolved": "https://registry.npm.taobao.org/follow-redirects/download/follow-redirects-1.5.10.tgz?cache=0&sync_timestamp=1597057976909&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ffollow-redirects%2Fdownload%2Ffollow-redirects-1.5.10.tgz",
"integrity": "sha1-e3qfmuov3/NnhqlP9kPtB/T/Xio=",
"requires": {
"debug": "=3.1.0"
}
},
"forwarded": {
"version": "0.1.2",
"resolved": "https://registry.npm.taobao.org/forwarded/download/forwarded-0.1.2.tgz",
"integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ="
},
"fresh": {
"version": "0.5.2",
"resolved": "https://registry.npm.taobao.org/fresh/download/fresh-0.5.2.tgz",
"integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
},
"fsevents": {
"version": "2.1.3",
"resolved": "https://registry.npm.taobao.org/fsevents/download/fsevents-2.1.3.tgz",
"integrity": "sha1-+3OHA66NL5/pAMM4Nt3r7ouX8j4=",
"dev": true,
"optional": true
},
"get-stream": {
"version": "4.1.0",
"resolved": "https://registry.npm.taobao.org/get-stream/download/get-stream-4.1.0.tgz?cache=0&sync_timestamp=1597056455691&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fget-stream%2Fdownload%2Fget-stream-4.1.0.tgz",
"integrity": "sha1-wbJVV189wh1Zv8ec09K0axw6VLU=",
"dev": true,
"requires": {
"pump": "^3.0.0"
}
},
"glob-parent": {
"version": "5.1.1",
"resolved": "https://registry.npm.taobao.org/glob-parent/download/glob-parent-5.1.1.tgz?cache=0&sync_timestamp=1584836110944&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fglob-parent%2Fdownload%2Fglob-parent-5.1.1.tgz",
"integrity": "sha1-tsHvQXxOVmPqSY8cRa+saRa7wik=",
"dev": true,
"requires": {
"is-glob": "^4.0.1"
}
},
"global-dirs": {
"version": "2.0.1",
"resolved": "https://registry.npm.taobao.org/global-dirs/download/global-dirs-2.0.1.tgz?cache=0&sync_timestamp=1573231918216&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fglobal-dirs%2Fdownload%2Fglobal-dirs-2.0.1.tgz",
"integrity": "sha1-rN87tmhbzVXLNeigUiZlaelGkgE=",
"dev": true,
"requires": {
"ini": "^1.3.5"
}
},
"got": {
"version": "9.6.0",
"resolved": "https://registry.npm.taobao.org/got/download/got-9.6.0.tgz?cache=0&sync_timestamp=1596795791808&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fgot%2Fdownload%2Fgot-9.6.0.tgz",
"integrity": "sha1-7fRefWf5lUVwXeH3u+7rEhdl7YU=",
"dev": true,
"requires": {
"@sindresorhus/is": "^0.14.0",
"@szmarczak/http-timer": "^1.1.2",
"cacheable-request": "^6.0.0",
"decompress-response": "^3.3.0",
"duplexer3": "^0.1.4",
"get-stream": "^4.1.0",
"lowercase-keys": "^1.0.1",
"mimic-response": "^1.0.1",
"p-cancelable": "^1.0.0",
"to-readable-stream": "^1.0.0",
"url-parse-lax": "^3.0.0"
}
},
"graceful-fs": {
"version": "4.2.4",
"resolved": "https://registry.npm.taobao.org/graceful-fs/download/graceful-fs-4.2.4.tgz",
"integrity": "sha1-Ila94U02MpWMRl68ltxGfKB6Kfs=",
"dev": true
},
"has-flag": {
"version": "3.0.0",
"resolved": "https://registry.npm.taobao.org/has-flag/download/has-flag-3.0.0.tgz",
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
"dev": true
},
"has-yarn": {
"version": "2.1.0",
"resolved": "https://registry.npm.taobao.org/has-yarn/download/has-yarn-2.1.0.tgz",
"integrity": "sha1-E34RNUp7W/EapctknPDG8/8rLnc=",
"dev": true
},
"http-cache-semantics": {
"version": "4.1.0",
"resolved": "https://registry.npm.taobao.org/http-cache-semantics/download/http-cache-semantics-4.1.0.tgz",
"integrity": "sha1-SekcXL82yblLz81xwj1SSex045A=",
"dev": true
},
"http-errors": {
"version": "1.7.2",
"resolved": "https://registry.npm.taobao.org/http-errors/download/http-errors-1.7.2.tgz?cache=0&sync_timestamp=1593407676273&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fhttp-errors%2Fdownload%2Fhttp-errors-1.7.2.tgz",
"integrity": "sha1-T1ApzxMjnzEDblsuVSkrz7zIXI8=",
"requires": {
"depd": "~1.1.2",
"inherits": "2.0.3",
"setprototypeof": "1.1.1",
"statuses": ">= 1.5.0 < 2",
"toidentifier": "1.0.0"
}
},
"http-proxy": {
"version": "1.18.1",
"resolved": "https://registry.npm.taobao.org/http-proxy/download/http-proxy-1.18.1.tgz?cache=0&sync_timestamp=1589778321455&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fhttp-proxy%2Fdownload%2Fhttp-proxy-1.18.1.tgz",
"integrity": "sha1-QBVB8FNIhLv5UmAzTnL4juOXZUk=",
"requires": {
"eventemitter3": "^4.0.0",
"follow-redirects": "^1.0.0",
"requires-port": "^1.0.0"
}
},
"http-proxy-middleware": {
"version": "1.0.5",
"resolved": "https://registry.npm.taobao.org/http-proxy-middleware/download/http-proxy-middleware-1.0.5.tgz",
"integrity": "sha1-TG4l2VpBHj11C8ecz2YpBnUXbcI=",
"requires": {
"@types/http-proxy": "^1.17.4",
"http-proxy": "^1.18.1",
"is-glob": "^4.0.1",
"lodash": "^4.17.19",
"micromatch": "^4.0.2"
}
},
"iconv-lite": {
"version": "0.4.24",
"resolved": "https://registry.npm.taobao.org/iconv-lite/download/iconv-lite-0.4.24.tgz",
"integrity": "sha1-ICK0sl+93CHS9SSXSkdKr+czkIs=",
"requires": {
"safer-buffer": ">= 2.1.2 < 3"
}
},
"ignore-by-default": {
"version": "1.0.1",
"resolved": "https://registry.npm.taobao.org/ignore-by-default/download/ignore-by-default-1.0.1.tgz?cache=0&sync_timestamp=1592055969434&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fignore-by-default%2Fdownload%2Fignore-by-default-1.0.1.tgz",
"integrity": "sha1-SMptcvbGo68Aqa1K5odr44ieKwk=",
"dev": true
},
"import-lazy": {
"version": "2.1.0",
"resolved": "https://registry.npm.taobao.org/import-lazy/download/import-lazy-2.1.0.tgz",
"integrity": "sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=",
"dev": true
},
"imurmurhash": {
"version": "0.1.4",
"resolved": "https://registry.npm.taobao.org/imurmurhash/download/imurmurhash-0.1.4.tgz",
"integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=",
"dev": true
},
"inherits": {
"version": "2.0.3",
"resolved": "https://registry.npm.taobao.org/inherits/download/inherits-2.0.3.tgz",
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
},
"ini": {
"version": "1.3.5",
"resolved": "https://registry.npm.taobao.org/ini/download/ini-1.3.5.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fini%2Fdownload%2Fini-1.3.5.tgz",
"integrity": "sha1-7uJfVtscnsYIXgwid4CD9Zar+Sc=",
"dev": true
},
"ipaddr.js": {
"version": "1.9.1",
"resolved": "https://registry.npm.taobao.org/ipaddr.js/download/ipaddr.js-1.9.1.tgz",
"integrity": "sha1-v/OFQ+64mEglB5/zoqjmy9RngbM="
},
"is-binary-path": {
"version": "2.1.0",
"resolved": "https://registry.npm.taobao.org/is-binary-path/download/is-binary-path-2.1.0.tgz",
"integrity": "sha1-6h9/O4DwZCNug0cPhsCcJU+0Wwk=",
"dev": true,
"requires": {
"binary-extensions": "^2.0.0"
}
},
"is-ci": {
"version": "2.0.0",
"resolved": "https://registry.npm.taobao.org/is-ci/download/is-ci-2.0.0.tgz",
"integrity": "sha1-a8YzQYGBDgS1wis9WJ/cpVAmQEw=",
"dev": true,
"requires": {
"ci-info": "^2.0.0"
}
},
"is-extglob": {
"version": "2.1.1",
"resolved": "https://registry.npm.taobao.org/is-extglob/download/is-extglob-2.1.1.tgz",
"integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI="
},
"is-fullwidth-code-point": {
"version": "2.0.0",
"resolved": "https://registry.npm.taobao.org/is-fullwidth-code-point/download/is-fullwidth-code-point-2.0.0.tgz",
"integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
"dev": true
},
"is-glob": {
"version": "4.0.1",
"resolved": "https://registry.npm.taobao.org/is-glob/download/is-glob-4.0.1.tgz",
"integrity": "sha1-dWfb6fL14kZ7x3q4PEopSCQHpdw=",
"requires": {
"is-extglob": "^2.1.1"
}
},
"is-installed-globally": {
"version": "0.3.2",
"resolved": "https://registry.npm.taobao.org/is-installed-globally/download/is-installed-globally-0.3.2.tgz?cache=0&sync_timestamp=1586162509580&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fis-installed-globally%2Fdownload%2Fis-installed-globally-0.3.2.tgz",
"integrity": "sha1-/T76ee5nDRGHIzGC1bCh3QAxMUE=",
"dev": true,
"requires": {
"global-dirs": "^2.0.1",
"is-path-inside": "^3.0.1"
}
},
"is-npm": {
"version": "4.0.0",
"resolved": "https://registry.npm.taobao.org/is-npm/download/is-npm-4.0.0.tgz",
"integrity": "sha1-yQ3YOAaW34enptgjwg0LErvjyE0=",
"dev": true
},
"is-number": {
"version": "7.0.0",
"resolved": "https://registry.npm.taobao.org/is-number/download/is-number-7.0.0.tgz",
"integrity": "sha1-dTU0W4lnNNX4DE0GxQlVUnoU8Ss="
},
"is-obj": {
"version": "2.0.0",
"resolved": "https://registry.npm.taobao.org/is-obj/download/is-obj-2.0.0.tgz",
"integrity": "sha1-Rz+wXZc3BeP9liBUUBjKjiLvSYI=",
"dev": true
},
"is-path-inside": {
"version": "3.0.2",
"resolved": "https://registry.npm.taobao.org/is-path-inside/download/is-path-inside-3.0.2.tgz",
"integrity": "sha1-9SIPyCo+IzdXKR3dycWHfyofMBc=",
"dev": true
},
"is-typedarray": {
"version": "1.0.0",
"resolved": "https://registry.npm.taobao.org/is-typedarray/download/is-typedarray-1.0.0.tgz",
"integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=",
"dev": true
},
"is-yarn-global": {
"version": "0.3.0",
"resolved": "https://registry.npm.taobao.org/is-yarn-global/download/is-yarn-global-0.3.0.tgz",
"integrity": "sha1-1QLTOCWQ6jAEiTdGdUyJE5lz4jI=",
"dev": true
},
"json-buffer": {
"version": "3.0.0",
"resolved": "https://registry.npm.taobao.org/json-buffer/download/json-buffer-3.0.0.tgz",
"integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=",
"dev": true
},
"keyv": {
"version": "3.1.0",
"resolved": "https://registry.npm.taobao.org/keyv/download/keyv-3.1.0.tgz",
"integrity": "sha1-7MIoSG9pmR5J6UdkhaW+Ho/FxNk=",
"dev": true,
"requires": {
"json-buffer": "3.0.0"
}
},
"latest-version": {
"version": "5.1.0",
"resolved": "https://registry.npm.taobao.org/latest-version/download/latest-version-5.1.0.tgz",
"integrity": "sha1-EZ3+kI/jjRXfpD7NE/oS7Igy+s4=",
"dev": true,
"requires": {
"package-json": "^6.3.0"
}
},
"lodash": {
"version": "4.17.20",
"resolved": "https://registry.npm.taobao.org/lodash/download/lodash-4.17.20.tgz?cache=0&sync_timestamp=1597336053864&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Flodash%2Fdownload%2Flodash-4.17.20.tgz",
"integrity": "sha1-tEqbYpe8tpjxxRo1RaKzs2jVnFI="
},
"lowercase-keys": {
"version": "1.0.1",
"resolved": "https://registry.npm.taobao.org/lowercase-keys/download/lowercase-keys-1.0.1.tgz",
"integrity": "sha1-b54wtHCE2XGnyCD/FabFFnt0wm8=",
"dev": true
},
"make-dir": {
"version": "3.1.0",
"resolved": "https://registry.npm.taobao.org/make-dir/download/make-dir-3.1.0.tgz",
"integrity": "sha1-QV6WcEazp/HRhSd9hKpYIDcmoT8=",
"dev": true,
"requires": {
"semver": "^6.0.0"
},
"dependencies": {
"semver": {
"version": "6.3.0",
"resolved": "https://registry.npm.taobao.org/semver/download/semver-6.3.0.tgz?cache=0&sync_timestamp=1586886267748&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsemver%2Fdownload%2Fsemver-6.3.0.tgz",
"integrity": "sha1-7gpkyK9ejO6mdoexM3YeG+y9HT0=",
"dev": true
}
}
},
"media-typer": {
"version": "0.3.0",
"resolved": "https://registry.npm.taobao.org/media-typer/download/media-typer-0.3.0.tgz",
"integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g="
},
"merge-descriptors": {
"version": "1.0.1",
"resolved": "https://registry.npm.taobao.org/merge-descriptors/download/merge-descriptors-1.0.1.tgz",
"integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E="
},
"methods": {
"version": "1.1.2",
"resolved": "https://registry.npm.taobao.org/methods/download/methods-1.1.2.tgz",
"integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4="
},
"micromatch": {
"version": "4.0.2",
"resolved": "https://registry.npm.taobao.org/micromatch/download/micromatch-4.0.2.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fmicromatch%2Fdownload%2Fmicromatch-4.0.2.tgz",
"integrity": "sha1-T8sJmb+fvC/L3SEvbWKbmlbDklk=",
"requires": {
"braces": "^3.0.1",
"picomatch": "^2.0.5"
}
},
"mime": {
"version": "1.6.0",
"resolved": "https://registry.npm.taobao.org/mime/download/mime-1.6.0.tgz",
"integrity": "sha1-Ms2eXGRVO9WNGaVor0Uqz/BJgbE="
},
"mime-db": {
"version": "1.44.0",
"resolved": "https://registry.npm.taobao.org/mime-db/download/mime-db-1.44.0.tgz",
"integrity": "sha1-+hHF6wrKEzS0Izy01S8QxaYnL5I="
},
"mime-types": {
"version": "2.1.27",
"resolved": "https://registry.npm.taobao.org/mime-types/download/mime-types-2.1.27.tgz",
"integrity": "sha1-R5SfmOJ56lMRn1ci4PNOUpvsAJ8=",
"requires": {
"mime-db": "1.44.0"
}
},
"mimic-response": {
"version": "1.0.1",
"resolved": "https://registry.npm.taobao.org/mimic-response/download/mimic-response-1.0.1.tgz",
"integrity": "sha1-SSNTiHju9CBjy4o+OweYeBSHqxs=",
"dev": true
},
"minimatch": {
"version": "3.0.4",
"resolved": "https://registry.npm.taobao.org/minimatch/download/minimatch-3.0.4.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fminimatch%2Fdownload%2Fminimatch-3.0.4.tgz",
"integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=",
"dev": true,
"requires": {
"brace-expansion": "^1.1.7"
}
},
"minimist": {
"version": "1.2.5",
"resolved": "https://registry.npm.taobao.org/minimist/download/minimist-1.2.5.tgz",
"integrity": "sha1-Z9ZgFLZqaoqqDAg8X9WN9OTpdgI=",
"dev": true
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npm.taobao.org/ms/download/ms-2.0.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fms%2Fdownload%2Fms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
},
"negotiator": {
"version": "0.6.2",
"resolved": "https://registry.npm.taobao.org/negotiator/download/negotiator-0.6.2.tgz",
"integrity": "sha1-/qz3zPUlp3rpY0Q2pkiD/+yjRvs="
},
"nodemon": {
"version": "2.0.4",
"resolved": "https://registry.npm.taobao.org/nodemon/download/nodemon-2.0.4.tgz?cache=0&sync_timestamp=1589456003432&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnodemon%2Fdownload%2Fnodemon-2.0.4.tgz",
"integrity": "sha1-VbCTGetIjWOUqpgYFIwMLRwExBY=",
"dev": true,
"requires": {
"chokidar": "^3.2.2",
"debug": "^3.2.6",
"ignore-by-default": "^1.0.1",
"minimatch": "^3.0.4",
"pstree.remy": "^1.1.7",
"semver": "^5.7.1",
"supports-color": "^5.5.0",
"touch": "^3.1.0",
"undefsafe": "^2.0.2",
"update-notifier": "^4.0.0"
},
"dependencies": {
"debug": {
"version": "3.2.6",
"resolved": "https://registry.npm.taobao.org/debug/download/debug-3.2.6.tgz",
"integrity": "sha1-6D0X3hbYp++3cX7b5fsQE17uYps=",
"dev": true,
"requires": {
"ms": "^2.1.1"
}
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npm.taobao.org/ms/download/ms-2.1.2.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fms%2Fdownload%2Fms-2.1.2.tgz",
"integrity": "sha1-0J0fNXtEP0kzgqjrPM0YOHKuYAk=",
"dev": true
}
}
},
"nopt": {
"version": "1.0.10",
"resolved": "https://registry.npm.taobao.org/nopt/download/nopt-1.0.10.tgz?cache=0&sync_timestamp=1597649908392&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnopt%2Fdownload%2Fnopt-1.0.10.tgz",
"integrity": "sha1-bd0hvSoxQXuScn3Vhfim83YI6+4=",
"dev": true,
"requires": {
"abbrev": "1"
}
},
"normalize-path": {
"version": "3.0.0",
"resolved": "https://registry.npm.taobao.org/normalize-path/download/normalize-path-3.0.0.tgz",
"integrity": "sha1-Dc1p/yOhybEf0JeDFmRKA4ghamU=",
"dev": true
},
"normalize-url": {
"version": "4.5.0",
"resolved": "https://registry.npm.taobao.org/normalize-url/download/normalize-url-4.5.0.tgz?cache=0&sync_timestamp=1596373093290&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnormalize-url%2Fdownload%2Fnormalize-url-4.5.0.tgz",
"integrity": "sha1-RTNUCH5sqWlXvY9br3U/WYIUISk=",
"dev": true
},
"on-finished": {
"version": "2.3.0",
"resolved": "https://registry.npm.taobao.org/on-finished/download/on-finished-2.3.0.tgz",
"integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=",
"requires": {
"ee-first": "1.1.1"
}
},
"once": {
"version": "1.4.0",
"resolved": "https://registry.npm.taobao.org/once/download/once-1.4.0.tgz",
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
"dev": true,
"requires": {
"wrappy": "1"
}
},
"p-cancelable": {
"version": "1.1.0",
"resolved": "https://registry.npm.taobao.org/p-cancelable/download/p-cancelable-1.1.0.tgz",
"integrity": "sha1-0HjRWjr0CSIMiG8dmgyi5EGrJsw=",
"dev": true
},
"package-json": {
"version": "6.5.0",
"resolved": "https://registry.npm.taobao.org/package-json/download/package-json-6.5.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fpackage-json%2Fdownload%2Fpackage-json-6.5.0.tgz",
"integrity": "sha1-b+7ayjXnVyWHbQsOZJdGl/7RRbA=",
"dev": true,
"requires": {
"got": "^9.6.0",
"registry-auth-token": "^4.0.0",
"registry-url": "^5.0.0",
"semver": "^6.2.0"
},
"dependencies": {
"semver": {
"version": "6.3.0",
"resolved": "https://registry.npm.taobao.org/semver/download/semver-6.3.0.tgz?cache=0&sync_timestamp=1586886267748&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsemver%2Fdownload%2Fsemver-6.3.0.tgz",
"integrity": "sha1-7gpkyK9ejO6mdoexM3YeG+y9HT0=",
"dev": true
}
}
},
"parseurl": {
"version": "1.3.3",
"resolved": "https://registry.npm.taobao.org/parseurl/download/parseurl-1.3.3.tgz",
"integrity": "sha1-naGee+6NEt/wUT7Vt2lXeTvC6NQ="
},
"path-to-regexp": {
"version": "0.1.7",
"resolved": "https://registry.npm.taobao.org/path-to-regexp/download/path-to-regexp-0.1.7.tgz?cache=0&sync_timestamp=1574278831909&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fpath-to-regexp%2Fdownload%2Fpath-to-regexp-0.1.7.tgz",
"integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w="
},
"picomatch": {
"version": "2.2.2",
"resolved": "https://registry.npm.taobao.org/picomatch/download/picomatch-2.2.2.tgz",
"integrity": "sha1-IfMz6ba46v8CRo9RRupAbTRfTa0="
},
"prepend-http": {
"version": "2.0.0",
"resolved": "https://registry.npm.taobao.org/prepend-http/download/prepend-http-2.0.0.tgz",
"integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=",
"dev": true
},
"proxy-addr": {
"version": "2.0.6",
"resolved": "https://registry.npm.taobao.org/proxy-addr/download/proxy-addr-2.0.6.tgz?cache=0&sync_timestamp=1582556112011&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fproxy-addr%2Fdownload%2Fproxy-addr-2.0.6.tgz",
"integrity": "sha1-/cIzZQVEfT8vLGOO0nLK9hS7sr8=",
"requires": {
"forwarded": "~0.1.2",
"ipaddr.js": "1.9.1"
}
},
"pstree.remy": {
"version": "1.1.8",
"resolved": "https://registry.npm.taobao.org/pstree.remy/download/pstree.remy-1.1.8.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fpstree.remy%2Fdownload%2Fpstree.remy-1.1.8.tgz",
"integrity": "sha1-wkIiT0pnwh9oaDm720rCgrg3PTo=",
"dev": true
},
"pump": {
"version": "3.0.0",
"resolved": "https://registry.npm.taobao.org/pump/download/pump-3.0.0.tgz",
"integrity": "sha1-tKIRaBW94vTh6mAjVOjHVWUQemQ=",
"dev": true,
"requires": {
"end-of-stream": "^1.1.0",
"once": "^1.3.1"
}
},
"pupa": {
"version": "2.0.1",
"resolved": "https://registry.npm.taobao.org/pupa/download/pupa-2.0.1.tgz",
"integrity": "sha1-29yf9I/76komoGm2+fersFEAhyY=",
"dev": true,
"requires": {
"escape-goat": "^2.0.0"
}
},
"qs": {
"version": "6.7.0",
"resolved": "https://registry.npm.taobao.org/qs/download/qs-6.7.0.tgz",
"integrity": "sha1-QdwaAV49WB8WIXdr4xr7KHapsbw="
},
"range-parser": {
"version": "1.2.1",
"resolved": "https://registry.npm.taobao.org/range-parser/download/range-parser-1.2.1.tgz",
"integrity": "sha1-PPNwI9GZ4cJNGlW4SADC8+ZGgDE="
},
"raw-body": {
"version": "2.4.0",
"resolved": "https://registry.npm.taobao.org/raw-body/download/raw-body-2.4.0.tgz",
"integrity": "sha1-oc5vucm8NWylLoklarWQWeE9AzI=",
"requires": {
"bytes": "3.1.0",
"http-errors": "1.7.2",
"iconv-lite": "0.4.24",
"unpipe": "1.0.0"
}
},
"rc": {
"version": "1.2.8",
"resolved": "https://registry.npm.taobao.org/rc/download/rc-1.2.8.tgz",
"integrity": "sha1-zZJL9SAKB1uDwYjNa54hG3/A0+0=",
"dev": true,
"requires": {
"deep-extend": "^0.6.0",
"ini": "~1.3.0",
"minimist": "^1.2.0",
"strip-json-comments": "~2.0.1"
}
},
"readdirp": {
"version": "3.4.0",
"resolved": "https://registry.npm.taobao.org/readdirp/download/readdirp-3.4.0.tgz",
"integrity": "sha1-n9zN+ekVWAVEkiGsZF6DA6tbmto=",
"dev": true,
"requires": {
"picomatch": "^2.2.1"
}
},
"registry-auth-token": {
"version": "4.2.0",
"resolved": "https://registry.npm.taobao.org/registry-auth-token/download/registry-auth-token-4.2.0.tgz?cache=0&sync_timestamp=1594638395069&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fregistry-auth-token%2Fdownload%2Fregistry-auth-token-4.2.0.tgz",
"integrity": "sha1-HTff/acrvs0PWB5HFVQCE6Zet9o=",
"dev": true,
"requires": {
"rc": "^1.2.8"
}
},
"registry-url": {
"version": "5.1.0",
"resolved": "https://registry.npm.taobao.org/registry-url/download/registry-url-5.1.0.tgz",
"integrity": "sha1-6YM0tQ1UNLgRNrROxjjZwgCcUAk=",
"dev": true,
"requires": {
"rc": "^1.2.8"
}
},
"requires-port": {
"version": "1.0.0",
"resolved": "https://registry.npm.taobao.org/requires-port/download/requires-port-1.0.0.tgz",
"integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8="
},
"responselike": {
"version": "1.0.2",
"resolved": "https://registry.npm.taobao.org/responselike/download/responselike-1.0.2.tgz",
"integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=",
"dev": true,
"requires": {
"lowercase-keys": "^1.0.0"
}
},
"safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npm.taobao.org/safe-buffer/download/safe-buffer-5.1.2.tgz",
"integrity": "sha1-mR7GnSluAxN0fVm9/St0XDX4go0="
},
"safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npm.taobao.org/safer-buffer/download/safer-buffer-2.1.2.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsafer-buffer%2Fdownload%2Fsafer-buffer-2.1.2.tgz",
"integrity": "sha1-RPoWGwGHuVSd2Eu5GAL5vYOFzWo="
},
"semver": {
"version": "5.7.1",
"resolved": "https://registry.npm.taobao.org/semver/download/semver-5.7.1.tgz?cache=0&sync_timestamp=1586886267748&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsemver%2Fdownload%2Fsemver-5.7.1.tgz",
"integrity": "sha1-qVT5Ma66UI0we78Gnv8MAclhFvc=",
"dev": true
},
"semver-diff": {
"version": "3.1.1",
"resolved": "https://registry.npm.taobao.org/semver-diff/download/semver-diff-3.1.1.tgz",
"integrity": "sha1-Bfd85Z8yXgDicGr9Z7tQbdscoys=",
"dev": true,
"requires": {
"semver": "^6.3.0"
},
"dependencies": {
"semver": {
"version": "6.3.0",
"resolved": "https://registry.npm.taobao.org/semver/download/semver-6.3.0.tgz?cache=0&sync_timestamp=1586886267748&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsemver%2Fdownload%2Fsemver-6.3.0.tgz",
"integrity": "sha1-7gpkyK9ejO6mdoexM3YeG+y9HT0=",
"dev": true
}
}
},
"send": {
"version": "0.17.1",
"resolved": "https://registry.npm.taobao.org/send/download/send-0.17.1.tgz",
"integrity": "sha1-wdiwWfeQD3Rm3Uk4vcROEd2zdsg=",
"requires": {
"debug": "2.6.9",
"depd": "~1.1.2",
"destroy": "~1.0.4",
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"etag": "~1.8.1",
"fresh": "0.5.2",
"http-errors": "~1.7.2",
"mime": "1.6.0",
"ms": "2.1.1",
"on-finished": "~2.3.0",
"range-parser": "~1.2.1",
"statuses": "~1.5.0"
},
"dependencies": {
"debug": {
"version": "2.6.9",
"resolved": "https://registry.npm.taobao.org/debug/download/debug-2.6.9.tgz",
"integrity": "sha1-XRKFFd8TT/Mn6QpMk/Tgd6U2NB8=",
"requires": {
"ms": "2.0.0"
},
"dependencies": {
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npm.taobao.org/ms/download/ms-2.0.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fms%2Fdownload%2Fms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
}
}
},
"ms": {
"version": "2.1.1",
"resolved": "https://registry.npm.taobao.org/ms/download/ms-2.1.1.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fms%2Fdownload%2Fms-2.1.1.tgz",
"integrity": "sha1-MKWGTrPrsKZvLr5tcnrwagnYbgo="
}
}
},
"serve-static": {
"version": "1.14.1",
"resolved": "https://registry.npm.taobao.org/serve-static/download/serve-static-1.14.1.tgz",
"integrity": "sha1-Zm5jbcTwEPfvKZcKiKZ0MgiYsvk=",
"requires": {
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"parseurl": "~1.3.3",
"send": "0.17.1"
}
},
"setprototypeof": {
"version": "1.1.1",
"resolved": "https://registry.npm.taobao.org/setprototypeof/download/setprototypeof-1.1.1.tgz",
"integrity": "sha1-fpWsskqpL1iF4KvvW6ExMw1K5oM="
},
"signal-exit": {
"version": "3.0.3",
"resolved": "https://registry.npm.taobao.org/signal-exit/download/signal-exit-3.0.3.tgz?cache=0&sync_timestamp=1592843131591&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsignal-exit%2Fdownload%2Fsignal-exit-3.0.3.tgz",
"integrity": "sha1-oUEMLt2PB3sItOJTyOrPyvBXRhw=",
"dev": true
},
"statuses": {
"version": "1.5.0",
"resolved": "https://registry.npm.taobao.org/statuses/download/statuses-1.5.0.tgz?cache=0&sync_timestamp=1587327902535&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fstatuses%2Fdownload%2Fstatuses-1.5.0.tgz",
"integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow="
},
"string-width": {
"version": "4.2.0",
"resolved": "https://registry.npm.taobao.org/string-width/download/string-width-4.2.0.tgz",
"integrity": "sha1-lSGCxGzHssMT0VluYjmSvRY7crU=",
"dev": true,
"requires": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
"strip-ansi": "^6.0.0"
},
"dependencies": {
"ansi-regex": {
"version": "5.0.0",
"resolved": "https://registry.npm.taobao.org/ansi-regex/download/ansi-regex-5.0.0.tgz?cache=0&sync_timestamp=1570188663907&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fansi-regex%2Fdownload%2Fansi-regex-5.0.0.tgz",
"integrity": "sha1-OIU59VF5vzkznIGvMKZU1p+Hy3U=",
"dev": true
},
"emoji-regex": {
"version": "8.0.0",
"resolved": "https://registry.npm.taobao.org/emoji-regex/download/emoji-regex-8.0.0.tgz",
"integrity": "sha1-6Bj9ac5cz8tARZT4QpY79TFkzDc=",
"dev": true
},
"is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npm.taobao.org/is-fullwidth-code-point/download/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha1-8Rb4Bk/pCz94RKOJl8C3UFEmnx0=",
"dev": true
},
"strip-ansi": {
"version": "6.0.0",
"resolved": "https://registry.npm.taobao.org/strip-ansi/download/strip-ansi-6.0.0.tgz",
"integrity": "sha1-CxVx3XZpzNTz4G4U7x7tJiJa5TI=",
"dev": true,
"requires": {
"ansi-regex": "^5.0.0"
}
}
}
},
"strip-ansi": {
"version": "5.2.0",
"resolved": "https://registry.npm.taobao.org/strip-ansi/download/strip-ansi-5.2.0.tgz",
"integrity": "sha1-jJpTb+tq/JYr36WxBKUJHBrZwK4=",
"dev": true,
"requires": {
"ansi-regex": "^4.1.0"
}
},
"strip-json-comments": {
"version": "2.0.1",
"resolved": "https://registry.npm.taobao.org/strip-json-comments/download/strip-json-comments-2.0.1.tgz?cache=0&sync_timestamp=1594567543744&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fstrip-json-comments%2Fdownload%2Fstrip-json-comments-2.0.1.tgz",
"integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=",
"dev": true
},
"supports-color": {
"version": "5.5.0",
"resolved": "https://registry.npm.taobao.org/supports-color/download/supports-color-5.5.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsupports-color%2Fdownload%2Fsupports-color-5.5.0.tgz",
"integrity": "sha1-4uaaRKyHcveKHsCzW2id9lMO/I8=",
"dev": true,
"requires": {
"has-flag": "^3.0.0"
}
},
"term-size": {
"version": "2.2.0",
"resolved": "https://registry.npm.taobao.org/term-size/download/term-size-2.2.0.tgz",
"integrity": "sha1-Hxat7f6b3BiADhd2ghc0CG/MZ1M=",
"dev": true
},
"to-readable-stream": {
"version": "1.0.0",
"resolved": "https://registry.npm.taobao.org/to-readable-stream/download/to-readable-stream-1.0.0.tgz",
"integrity": "sha1-zgqgwvPfat+FLvtASng+d8BHV3E=",
"dev": true
},
"to-regex-range": {
"version": "5.0.1",
"resolved": "https://registry.npm.taobao.org/to-regex-range/download/to-regex-range-5.0.1.tgz",
"integrity": "sha1-FkjESq58jZiKMmAY7XL1tN0DkuQ=",
"requires": {
"is-number": "^7.0.0"
}
},
"toidentifier": {
"version": "1.0.0",
"resolved": "https://registry.npm.taobao.org/toidentifier/download/toidentifier-1.0.0.tgz",
"integrity": "sha1-fhvjRw8ed5SLxD2Uo8j013UrpVM="
},
"touch": {
"version": "3.1.0",
"resolved": "https://registry.npm.taobao.org/touch/download/touch-3.1.0.tgz",
"integrity": "sha1-/jZfX3XsntTlaCXgu3bSSrdK+Ds=",
"dev": true,
"requires": {
"nopt": "~1.0.10"
}
},
"type-fest": {
"version": "0.8.1",
"resolved": "https://registry.npm.taobao.org/type-fest/download/type-fest-0.8.1.tgz?cache=0&sync_timestamp=1593293797610&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ftype-fest%2Fdownload%2Ftype-fest-0.8.1.tgz",
"integrity": "sha1-CeJJ696FHTseSNJ8EFREZn8XuD0=",
"dev": true
},
"type-is": {
"version": "1.6.18",
"resolved": "https://registry.npm.taobao.org/type-is/download/type-is-1.6.18.tgz",
"integrity": "sha1-TlUs0F3wlGfcvE73Od6J8s83wTE=",
"requires": {
"media-typer": "0.3.0",
"mime-types": "~2.1.24"
}
},
"typedarray-to-buffer": {
"version": "3.1.5",
"resolved": "https://registry.npm.taobao.org/typedarray-to-buffer/download/typedarray-to-buffer-3.1.5.tgz",
"integrity": "sha1-qX7nqf9CaRufeD/xvFES/j/KkIA=",
"dev": true,
"requires": {
"is-typedarray": "^1.0.0"
}
},
"undefsafe": {
"version": "2.0.3",
"resolved": "https://registry.npm.taobao.org/undefsafe/download/undefsafe-2.0.3.tgz",
"integrity": "sha1-axZucJStRjE7IgLafsws18xueq4=",
"dev": true,
"requires": {
"debug": "^2.2.0"
},
"dependencies": {
"debug": {
"version": "2.6.9",
"resolved": "https://registry.npm.taobao.org/debug/download/debug-2.6.9.tgz",
"integrity": "sha1-XRKFFd8TT/Mn6QpMk/Tgd6U2NB8=",
"dev": true,
"requires": {
"ms": "2.0.0"
}
}
}
},
"unique-string": {
"version": "2.0.0",
"resolved": "https://registry.npm.taobao.org/unique-string/download/unique-string-2.0.0.tgz",
"integrity": "sha1-OcZFH4GvsnSd4rIz4/fF6IQ72J0=",
"dev": true,
"requires": {
"crypto-random-string": "^2.0.0"
}
},
"unpipe": {
"version": "1.0.0",
"resolved": "https://registry.npm.taobao.org/unpipe/download/unpipe-1.0.0.tgz",
"integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw="
},
"update-notifier": {
"version": "4.1.1",
"resolved": "https://registry.npm.taobao.org/update-notifier/download/update-notifier-4.1.1.tgz?cache=0&sync_timestamp=1597574328608&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fupdate-notifier%2Fdownload%2Fupdate-notifier-4.1.1.tgz",
"integrity": "sha1-iV/IViu+ZmF5UA+fLOusTyYyN0Y=",
"dev": true,
"requires": {
"boxen": "^4.2.0",
"chalk": "^3.0.0",
"configstore": "^5.0.1",
"has-yarn": "^2.1.0",
"import-lazy": "^2.1.0",
"is-ci": "^2.0.0",
"is-installed-globally": "^0.3.1",
"is-npm": "^4.0.0",
"is-yarn-global": "^0.3.0",
"latest-version": "^5.0.0",
"pupa": "^2.0.1",
"semver-diff": "^3.1.1",
"xdg-basedir": "^4.0.0"
}
},
"url-parse-lax": {
"version": "3.0.0",
"resolved": "https://registry.npm.taobao.org/url-parse-lax/download/url-parse-lax-3.0.0.tgz",
"integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=",
"dev": true,
"requires": {
"prepend-http": "^2.0.0"
}
},
"utils-merge": {
"version": "1.0.1",
"resolved": "https://registry.npm.taobao.org/utils-merge/download/utils-merge-1.0.1.tgz",
"integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM="
},
"vary": {
"version": "1.1.2",
"resolved": "https://registry.npm.taobao.org/vary/download/vary-1.1.2.tgz",
"integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
},
"widest-line": {
"version": "3.1.0",
"resolved": "https://registry.npm.taobao.org/widest-line/download/widest-line-3.1.0.tgz",
"integrity": "sha1-gpIzO79my0X/DeFgOxNreuFJbso=",
"dev": true,
"requires": {
"string-width": "^4.0.0"
}
},
"wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npm.taobao.org/wrappy/download/wrappy-1.0.2.tgz",
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
"dev": true
},
"write-file-atomic": {
"version": "3.0.3",
"resolved": "https://registry.npm.taobao.org/write-file-atomic/download/write-file-atomic-3.0.3.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fwrite-file-atomic%2Fdownload%2Fwrite-file-atomic-3.0.3.tgz",
"integrity": "sha1-Vr1cWlxwSBzRnFcb05q5ZaXeVug=",
"dev": true,
"requires": {
"imurmurhash": "^0.1.4",
"is-typedarray": "^1.0.0",
"signal-exit": "^3.0.2",
"typedarray-to-buffer": "^3.1.5"
}
},
"xdg-basedir": {
"version": "4.0.0",
"resolved": "https://registry.npm.taobao.org/xdg-basedir/download/xdg-basedir-4.0.0.tgz",
"integrity": "sha1-S8jZmEQDaWIl74OhVzy7y0552xM=",
"dev": true
}
}
}
{
"name": "mockserver",
"version": "1.0.0",
"description": "",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "nodemon --watch sdk --watch ../ --watch server.js server.js mock"
},
"author": "",
"license": "ISC",
"dependencies": {
"axios": "^0.19.2",
"body-parser": "^1.19.0",
"cookie-parser": "^1.4.5",
"express": "^4.17.1",
"http-proxy-middleware": "^1.0.5"
},
"port": 5555,
"serverProxy": {
"target": "http://tornado.duibadev.com.cn"
},
"devDependencies": {
"nodemon": "^2.0.4"
}
}
/** @format */
const { CURD_REQUEST } = require('./request')
class BaseDao {
constructor(context, dbName) {
this.db = context.db
this.TABLE = dbName
}
/**
* 查询一条数据
* @param query
* @param options
*/
async findOne(query, options) {
let result = await CURD_REQUEST({
db: this.db,
TABLE: this.TABLE,
type: `find`,
query: query || {},
options: options || {}
})
return result[0]
}
/**
* 查询多条数据
* @param query
* @param options
*/
async find(query, options) {
console.log(`db`, this.db)
let result = await CURD_REQUEST({
db: this.db,
TABLE: this.TABLE,
type: `find`,
query: query || {},
options: options || {}
})
return result
}
/**
* 插入单条数据
* @param document
*/
async insertOne(document) {
console.log(`insertOne`, document)
let result = await CURD_REQUEST({ db: this.db, TABLE: this.TABLE, type: `insert`, document: document || {} })
return result
}
/**
* 插入多条数据
* @param documents 插入对象
*/
async insertMany(documents) {
let result = await CURD_REQUEST({ db: this.db, TABLE: this.TABLE, type: `insert`, document: documents || [{}] })
return result
}
/**
* 更新数据
* @param query
* @param options
*/
async update(query, options) {
let result = await CURD_REQUEST({
db: this.db,
TABLE: this.TABLE,
type: `update`,
query: query || {},
options: options || {}
})
let res = result.nModified > 0 ? 1 : 0
console.log(`update结果`, res)
return res
}
/**
* 删除多条数据
* @param query
* @param options
*/
async delete(query, options) {
let result = await CURD_REQUEST({
db: this.db,
TABLE: this.TABLE,
type: `delete`,
query: query || {},
options: options || {}
})
return result
}
/**
* 获取条目数
* @param query
* @param options
*/
async count(query, options) {
let result = await CURD_REQUEST({
db: this.db,
TABLE: this.TABLE,
type: `count`,
query: query || {},
options: options || {}
})
return result
}
/**
* 聚合查询
* @param query
* @param options
*/
async aggregate(query) {
let result = await CURD_REQUEST({
db: this.db,
TABLE: this.TABLE,
type: `aggregate`,
query: query || {}
})
return result
}
}
module.exports = BaseDao
/** @format */
const { TBAPI_REQUEST } = require('./request')
let TBAPIS = {}
const APIS = [
`getItemListByItemIds`,
`getPrizeByEname`,
`getShopVipUrl`,
`queryVipinfo`,
`benefitSend`,
`queryCredits`,
`changeCredits`,
`getShopInfo`,
`getBuyerOrderList`
]
APIS.forEach(v => {
TBAPIS[v] = async query => {
let result = await TBAPI_REQUEST(process.db, v, query)
console.log(`TBAPIS.${v}----参数`, process.db, v, query)
console.log(`result`, result)
return result.tbvalue
}
})
module.exports = TBAPIS
/** @format */
const dateFormatter = (thisDate, fmt = 'yyyy-MM-dd hh:mm:ss') => {
thisDate = new Date(thisDate)
console.log(`thisDate`, thisDate)
const o = {
'M+': thisDate.getMonth() + 1,
'd+': thisDate.getDate(),
'h+': thisDate.getHours(),
'm+': thisDate.getMinutes(),
's+': thisDate.getSeconds(),
'q+': Math.floor((thisDate.getMonth() + 3) / 3),
S: thisDate.getMilliseconds()
}
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (thisDate.getFullYear() + '').substr(4 - RegExp.$1.length))
for (const k in o) {
if (new RegExp('(' + k + ')').test(fmt)) {
fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length))
}
}
return fmt
}
module.exports = dateFormatter
/** @format */
const BaseDao = require('./BaseDao')
const TBAPIS = require('./TBAPIS')
const transformBeijingDate = require('./transformBeijingDate')
const dateFormatter = require('./dateFormatter')
module.exports = {
BaseDao,
TBAPIS,
transformBeijingDate,
dateFormatter
}
/** @format */
var axios = require('axios')
let port = require('../package.json').port || 5555
const request = async (path, params) => {
let res = await axios({
method: 'post',
url: path,
data: params,
baseURL: `http://127.0.0.1:${port}`
})
if (!res.data.data) {
console.log(`调用${path}${JSON.stringify(params)}\n返回结果`, res.data)
return res.data.data
}
return res.data.data
}
const CURD_REQUEST = async ({ db, TABLE, type, query, options, document }) => {
// 参数
let data = {
dbName: db,
TABLE,
query,
options,
document
}
console.log(`请求参数`, data)
let path = `/proxy/dataMock/${type}`
return await request(path, data)
}
const TBAPI_REQUEST = async (db, funName, query) => {
// 参数
let data = {
dbName: db,
funName
}
let path = `/proxy/dataMock/tbapi`
let params = {
dbName: data.dbName,
funName: data.funName,
query
}
return await request(path, params)
}
module.exports = {
CURD_REQUEST,
TBAPI_REQUEST
}
module.exports = (day) => {
if (day) {
return new Date(day).getTime();
}else {
return new Date().getTime();
}
}
\ No newline at end of file
/** @format */
var express = require('express')
var bodyParser = require('body-parser')
var cookieParser = require('cookie-parser')
var { createProxyMiddleware } = require('http-proxy-middleware')
const routers = require('../index')
const { port, serverProxy } = require('./package.json')
var app = express()
app.use(cookieParser())
app.use(
bodyParser.urlencoded({
extended: true
})
)
app.use(bodyParser.json())
app.get('/', (req, res) => {
res.json({ message: `ok` })
})
// 执行本地云函数方法
app.post('/handler', async (req, res) => {
console.log(req.body)
let { data, openId, db } = req.body
if (!db) {
res.json({ message: `参数错误,缺少数据库db` })
}
if (!openId) {
res.json({ message: `参数错误,缺少openId` })
}
try {
let query = JSON.parse(JSON.stringify(data))
} catch (e) {
res.json({ message: `查询参数格式错误` })
}
let { handler, data: queryData } = data
if (!handler) {
res.json({ message: `格式错误, handler参数不能为空` })
}
if (!queryData) {
res.json({ message: `格式错误, data参数不能为空` })
}
if (!process.db) {
process.db = db
}
req.context = {
openId,
db,
env: 'mock',
data: queryData,
handler
}
if (routers[handler]) {
let result = await routers[handler](req.context)
res.json(result)
} else {
res.json({ message: `函数${handler}不存在` })
}
})
// 获取本地export的数据库表及云函数
app.get('/getDBHandlers', async (req, res) => {
let dbs = require('../dist/db')
let handlers = routers
// dbsInfo
let dbArray = []
let handlerArray = []
Object.keys(dbs).map(v => {
dbArray.push(dbs[v])
})
Object.keys(handlers).map(v => {
handlerArray.push(v)
})
console.log(dbArray, handlerArray)
res.json({
dbs: dbArray,
handlers: handlerArray,
success: true
})
})
const ProxyOption = {
target: serverProxy.target,
changeOrigin: true,
pathRewrite: (path, req) => {
console.log(`path`, path)
return path.replace('/proxy', '')
},
onProxyReq: (proxyReq, req, res) => {
console.log(`req.body`, req.body)
if (req.body) {
let bodyData = JSON.stringify(req.body)
console.log(`bodyData`, bodyData)
// incase if content-type is application/x-www-form-urlencoded -> we need to change to application/json
proxyReq.setHeader('Content-Type', 'application/json')
proxyReq.setHeader('Content-Length', Buffer.byteLength(bodyData))
// stream the content
proxyReq.write(bodyData)
}
}
}
app.use('/proxy', createProxyMiddleware(ProxyOption))
app.listen(port || 5555)
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@sindresorhus/is@^0.14.0":
version "0.14.0"
resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.14.0.tgz#9fb3a3cf3132328151f353de4632e01e52102bea"
integrity sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==
"@szmarczak/http-timer@^1.1.2":
version "1.1.2"
resolved "https://registry.yarnpkg.com/@szmarczak/http-timer/-/http-timer-1.1.2.tgz#b1665e2c461a2cd92f4c1bbf50d5454de0d4b421"
integrity sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==
dependencies:
defer-to-connect "^1.0.1"
"@types/color-name@^1.1.1":
version "1.1.1"
resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0"
integrity sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==
"@types/http-proxy@^1.17.4":
version "1.17.4"
resolved "https://registry.yarnpkg.com/@types/http-proxy/-/http-proxy-1.17.4.tgz#e7c92e3dbe3e13aa799440ff42e6d3a17a9d045b"
integrity sha512-IrSHl2u6AWXduUaDLqYpt45tLVCtYv7o4Z0s1KghBCDgIIS9oW5K1H8mZG/A2CfeLdEa7rTd1ACOiHBc1EMT2Q==
dependencies:
"@types/node" "*"
"@types/node@*":
version "14.6.0"
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.6.0.tgz#7d4411bf5157339337d7cff864d9ff45f177b499"
integrity sha512-mikldZQitV94akrc4sCcSjtJfsTKt4p+e/s0AGscVA6XArQ9kFclP+ZiYUMnq987rc6QlYxXv/EivqlfSLxpKA==
abbrev@1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8"
integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==
accepts@~1.3.7:
version "1.3.7"
resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.7.tgz#531bc726517a3b2b41f850021c6cc15eaab507cd"
integrity sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==
dependencies:
mime-types "~2.1.24"
negotiator "0.6.2"
ansi-align@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/ansi-align/-/ansi-align-3.0.0.tgz#b536b371cf687caaef236c18d3e21fe3797467cb"
integrity sha512-ZpClVKqXN3RGBmKibdfWzqCY4lnjEuoNzU5T0oEFpfd/z5qJHVarukridD4juLO2FXMiwUQxr9WqQtaYa8XRYw==
dependencies:
string-width "^3.0.0"
ansi-regex@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997"
integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==
ansi-regex@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75"
integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==
ansi-styles@^4.1.0:
version "4.2.1"
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.2.1.tgz#90ae75c424d008d2624c5bf29ead3177ebfcf359"
integrity sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==
dependencies:
"@types/color-name" "^1.1.1"
color-convert "^2.0.1"
anymatch@~3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.1.tgz#c55ecf02185e2469259399310c173ce31233b142"
integrity sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==
dependencies:
normalize-path "^3.0.0"
picomatch "^2.0.4"
array-flatten@1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2"
integrity sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=
axios@^0.19.2:
version "0.19.2"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.19.2.tgz#3ea36c5d8818d0d5f8a8a97a6d36b86cdc00cb27"
integrity sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==
dependencies:
follow-redirects "1.5.10"
balanced-match@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c=
binary-extensions@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.1.0.tgz#30fa40c9e7fe07dbc895678cd287024dea241dd9"
integrity sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ==
body-parser@1.19.0, body-parser@^1.19.0:
version "1.19.0"
resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.19.0.tgz#96b2709e57c9c4e09a6fd66a8fd979844f69f08a"
integrity sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==
dependencies:
bytes "3.1.0"
content-type "~1.0.4"
debug "2.6.9"
depd "~1.1.2"
http-errors "1.7.2"
iconv-lite "0.4.24"
on-finished "~2.3.0"
qs "6.7.0"
raw-body "2.4.0"
type-is "~1.6.17"
boxen@^4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/boxen/-/boxen-4.2.0.tgz#e411b62357d6d6d36587c8ac3d5d974daa070e64"
integrity sha512-eB4uT9RGzg2odpER62bBwSLvUeGC+WbRjjyyFhGsKnc8wp/m0+hQsMUvUe3H2V0D5vw0nBdO1hCJoZo5mKeuIQ==
dependencies:
ansi-align "^3.0.0"
camelcase "^5.3.1"
chalk "^3.0.0"
cli-boxes "^2.2.0"
string-width "^4.1.0"
term-size "^2.1.0"
type-fest "^0.8.1"
widest-line "^3.1.0"
brace-expansion@^1.1.7:
version "1.1.11"
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==
dependencies:
balanced-match "^1.0.0"
concat-map "0.0.1"
braces@^3.0.1, braces@~3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107"
integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==
dependencies:
fill-range "^7.0.1"
bytes@3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.0.tgz#f6cf7933a360e0588fa9fde85651cdc7f805d1f6"
integrity sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==
cacheable-request@^6.0.0:
version "6.1.0"
resolved "https://registry.yarnpkg.com/cacheable-request/-/cacheable-request-6.1.0.tgz#20ffb8bd162ba4be11e9567d823db651052ca912"
integrity sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==
dependencies:
clone-response "^1.0.2"
get-stream "^5.1.0"
http-cache-semantics "^4.0.0"
keyv "^3.0.0"
lowercase-keys "^2.0.0"
normalize-url "^4.1.0"
responselike "^1.0.2"
camelcase@^5.3.1:
version "5.3.1"
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320"
integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==
chalk@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4"
integrity sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==
dependencies:
ansi-styles "^4.1.0"
supports-color "^7.1.0"
chokidar@^3.2.2:
version "3.4.2"
resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.4.2.tgz#38dc8e658dec3809741eb3ef7bb0a47fe424232d"
integrity sha512-IZHaDeBeI+sZJRX7lGcXsdzgvZqKv6sECqsbErJA4mHWfpRrD8B97kSFN4cQz6nGBGiuFia1MKR4d6c1o8Cv7A==
dependencies:
anymatch "~3.1.1"
braces "~3.0.2"
glob-parent "~5.1.0"
is-binary-path "~2.1.0"
is-glob "~4.0.1"
normalize-path "~3.0.0"
readdirp "~3.4.0"
optionalDependencies:
fsevents "~2.1.2"
ci-info@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46"
integrity sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==
cli-boxes@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-2.2.0.tgz#538ecae8f9c6ca508e3c3c95b453fe93cb4c168d"
integrity sha512-gpaBrMAizVEANOpfZp/EEUixTXDyGt7DFzdK5hU+UbWt/J0lB0w20ncZj59Z9a93xHb9u12zF5BS6i9RKbtg4w==
clone-response@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/clone-response/-/clone-response-1.0.2.tgz#d1dc973920314df67fbeb94223b4ee350239e96b"
integrity sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=
dependencies:
mimic-response "^1.0.0"
color-convert@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3"
integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==
dependencies:
color-name "~1.1.4"
color-name@~1.1.4:
version "1.1.4"
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
concat-map@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=
configstore@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/configstore/-/configstore-5.0.1.tgz#d365021b5df4b98cdd187d6a3b0e3f6a7cc5ed96"
integrity sha512-aMKprgk5YhBNyH25hj8wGt2+D52Sw1DRRIzqBwLp2Ya9mFmY8KPvvtvmna8SxVR9JMZ4kzMD68N22vlaRpkeFA==
dependencies:
dot-prop "^5.2.0"
graceful-fs "^4.1.2"
make-dir "^3.0.0"
unique-string "^2.0.0"
write-file-atomic "^3.0.0"
xdg-basedir "^4.0.0"
content-disposition@0.5.3:
version "0.5.3"
resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.3.tgz#e130caf7e7279087c5616c2007d0485698984fbd"
integrity sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==
dependencies:
safe-buffer "5.1.2"
content-type@~1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.4.tgz#e138cc75e040c727b1966fe5e5f8c9aee256fe3b"
integrity sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==
cookie-parser@^1.4.5:
version "1.4.5"
resolved "https://registry.yarnpkg.com/cookie-parser/-/cookie-parser-1.4.5.tgz#3e572d4b7c0c80f9c61daf604e4336831b5d1d49"
integrity sha512-f13bPUj/gG/5mDr+xLmSxxDsB9DQiTIfhJS/sqjrmfAWiAN+x2O4i/XguTL9yDZ+/IFDanJ+5x7hC4CXT9Tdzw==
dependencies:
cookie "0.4.0"
cookie-signature "1.0.6"
cookie-signature@1.0.6:
version "1.0.6"
resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c"
integrity sha1-4wOogrNCzD7oylE6eZmXNNqzriw=
cookie@0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.0.tgz#beb437e7022b3b6d49019d088665303ebe9c14ba"
integrity sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==
crypto-random-string@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/crypto-random-string/-/crypto-random-string-2.0.0.tgz#ef2a7a966ec11083388369baa02ebead229b30d5"
integrity sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==
debug@2.6.9, debug@^2.2.0:
version "2.6.9"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==
dependencies:
ms "2.0.0"
debug@=3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==
dependencies:
ms "2.0.0"
debug@^3.2.6:
version "3.2.6"
resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b"
integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==
dependencies:
ms "^2.1.1"
decompress-response@^3.3.0:
version "3.3.0"
resolved "https://registry.yarnpkg.com/decompress-response/-/decompress-response-3.3.0.tgz#80a4dd323748384bfa248083622aedec982adff3"
integrity sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=
dependencies:
mimic-response "^1.0.0"
deep-extend@^0.6.0:
version "0.6.0"
resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac"
integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==
defer-to-connect@^1.0.1:
version "1.1.3"
resolved "https://registry.yarnpkg.com/defer-to-connect/-/defer-to-connect-1.1.3.tgz#331ae050c08dcf789f8c83a7b81f0ed94f4ac591"
integrity sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==
depd@~1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9"
integrity sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=
destroy@~1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.0.4.tgz#978857442c44749e4206613e37946205826abd80"
integrity sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=
dot-prop@^5.2.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-5.2.0.tgz#c34ecc29556dc45f1f4c22697b6f4904e0cc4fcb"
integrity sha512-uEUyaDKoSQ1M4Oq8l45hSE26SnTxL6snNnqvK/VWx5wJhmff5z0FUVJDKDanor/6w3kzE3i7XZOk+7wC0EXr1A==
dependencies:
is-obj "^2.0.0"
duplexer3@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/duplexer3/-/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2"
integrity sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=
ee-first@1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"
integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=
emoji-regex@^7.0.1:
version "7.0.3"
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156"
integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==
emoji-regex@^8.0.0:
version "8.0.0"
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37"
integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==
encodeurl@~1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59"
integrity sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=
end-of-stream@^1.1.0:
version "1.4.4"
resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0"
integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==
dependencies:
once "^1.4.0"
escape-goat@^2.0.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/escape-goat/-/escape-goat-2.1.1.tgz#1b2dc77003676c457ec760b2dc68edb648188675"
integrity sha512-8/uIhbG12Csjy2JEW7D9pHbreaVaS/OpN3ycnyvElTdwM5n6GY6W6e2IPemfvGZeUMqZ9A/3GqIZMgKnBhAw/Q==
escape-html@~1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988"
integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=
etag@~1.8.1:
version "1.8.1"
resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887"
integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=
eventemitter3@^4.0.0:
version "4.0.4"
resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.4.tgz#b5463ace635a083d018bdc7c917b4c5f10a85384"
integrity sha512-rlaVLnVxtxvoyLsQQFBx53YmXHDxRIzzTLbdfxqi4yocpSjAxXwkU0cScM5JgSKMqEhrZpnvQ2D9gjylR0AimQ==
express@^4.17.1:
version "4.17.1"
resolved "https://registry.yarnpkg.com/express/-/express-4.17.1.tgz#4491fc38605cf51f8629d39c2b5d026f98a4c134"
integrity sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==
dependencies:
accepts "~1.3.7"
array-flatten "1.1.1"
body-parser "1.19.0"
content-disposition "0.5.3"
content-type "~1.0.4"
cookie "0.4.0"
cookie-signature "1.0.6"
debug "2.6.9"
depd "~1.1.2"
encodeurl "~1.0.2"
escape-html "~1.0.3"
etag "~1.8.1"
finalhandler "~1.1.2"
fresh "0.5.2"
merge-descriptors "1.0.1"
methods "~1.1.2"
on-finished "~2.3.0"
parseurl "~1.3.3"
path-to-regexp "0.1.7"
proxy-addr "~2.0.5"
qs "6.7.0"
range-parser "~1.2.1"
safe-buffer "5.1.2"
send "0.17.1"
serve-static "1.14.1"
setprototypeof "1.1.1"
statuses "~1.5.0"
type-is "~1.6.18"
utils-merge "1.0.1"
vary "~1.1.2"
fill-range@^7.0.1:
version "7.0.1"
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40"
integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==
dependencies:
to-regex-range "^5.0.1"
finalhandler@~1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.1.2.tgz#b7e7d000ffd11938d0fdb053506f6ebabe9f587d"
integrity sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==
dependencies:
debug "2.6.9"
encodeurl "~1.0.2"
escape-html "~1.0.3"
on-finished "~2.3.0"
parseurl "~1.3.3"
statuses "~1.5.0"
unpipe "~1.0.0"
follow-redirects@1.5.10:
version "1.5.10"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.5.10.tgz#7b7a9f9aea2fdff36786a94ff643ed07f4ff5e2a"
integrity sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==
dependencies:
debug "=3.1.0"
follow-redirects@^1.0.0:
version "1.13.0"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.13.0.tgz#b42e8d93a2a7eea5ed88633676d6597bc8e384db"
integrity sha512-aq6gF1BEKje4a9i9+5jimNFIpq4Q1WiwBToeRK5NvZBd/TRsmW8BsJfOEGkr76TbOyPVD3OVDN910EcUNtRYEA==
forwarded@~0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.1.2.tgz#98c23dab1175657b8c0573e8ceccd91b0ff18c84"
integrity sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=
fresh@0.5.2:
version "0.5.2"
resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7"
integrity sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=
fsevents@~2.1.2:
version "2.1.3"
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.1.3.tgz#fb738703ae8d2f9fe900c33836ddebee8b97f23e"
integrity sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==
get-stream@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-4.1.0.tgz#c1b255575f3dc21d59bfc79cd3d2b46b1c3a54b5"
integrity sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==
dependencies:
pump "^3.0.0"
get-stream@^5.1.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-5.2.0.tgz#4966a1795ee5ace65e706c4b7beb71257d6e22d3"
integrity sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==
dependencies:
pump "^3.0.0"
glob-parent@~5.1.0:
version "5.1.1"
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.1.tgz#b6c1ef417c4e5663ea498f1c45afac6916bbc229"
integrity sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==
dependencies:
is-glob "^4.0.1"
global-dirs@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/global-dirs/-/global-dirs-2.0.1.tgz#acdf3bb6685bcd55cb35e8a052266569e9469201"
integrity sha512-5HqUqdhkEovj2Of/ms3IeS/EekcO54ytHRLV4PEY2rhRwrHXLQjeVEES0Lhka0xwNDtGYn58wyC4s5+MHsOO6A==
dependencies:
ini "^1.3.5"
got@^9.6.0:
version "9.6.0"
resolved "https://registry.yarnpkg.com/got/-/got-9.6.0.tgz#edf45e7d67f99545705de1f7bbeeeb121765ed85"
integrity sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==
dependencies:
"@sindresorhus/is" "^0.14.0"
"@szmarczak/http-timer" "^1.1.2"
cacheable-request "^6.0.0"
decompress-response "^3.3.0"
duplexer3 "^0.1.4"
get-stream "^4.1.0"
lowercase-keys "^1.0.1"
mimic-response "^1.0.1"
p-cancelable "^1.0.0"
to-readable-stream "^1.0.0"
url-parse-lax "^3.0.0"
graceful-fs@^4.1.2:
version "4.2.4"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb"
integrity sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==
has-flag@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd"
integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0=
has-flag@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b"
integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==
has-yarn@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/has-yarn/-/has-yarn-2.1.0.tgz#137e11354a7b5bf11aa5cb649cf0c6f3ff2b2e77"
integrity sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw==
http-cache-semantics@^4.0.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz#49e91c5cbf36c9b94bcfcd71c23d5249ec74e390"
integrity sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==
http-errors@1.7.2:
version "1.7.2"
resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.7.2.tgz#4f5029cf13239f31036e5b2e55292bcfbcc85c8f"
integrity sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==
dependencies:
depd "~1.1.2"
inherits "2.0.3"
setprototypeof "1.1.1"
statuses ">= 1.5.0 < 2"
toidentifier "1.0.0"
http-errors@~1.7.2:
version "1.7.3"
resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.7.3.tgz#6c619e4f9c60308c38519498c14fbb10aacebb06"
integrity sha512-ZTTX0MWrsQ2ZAhA1cejAwDLycFsd7I7nVtnkT3Ol0aqodaKW+0CTZDQ1uBv5whptCnc8e8HeRRJxRs0kmm/Qfw==
dependencies:
depd "~1.1.2"
inherits "2.0.4"
setprototypeof "1.1.1"
statuses ">= 1.5.0 < 2"
toidentifier "1.0.0"
http-proxy-middleware@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/http-proxy-middleware/-/http-proxy-middleware-1.0.5.tgz#4c6e25d95a411e3d750bc79ccf66290675176dc2"
integrity sha512-CKzML7u4RdGob8wuKI//H8Ein6wNTEQR7yjVEzPbhBLGdOfkfvgTnp2HLnniKBDP9QW4eG10/724iTWLBeER3g==
dependencies:
"@types/http-proxy" "^1.17.4"
http-proxy "^1.18.1"
is-glob "^4.0.1"
lodash "^4.17.19"
micromatch "^4.0.2"
http-proxy@^1.18.1:
version "1.18.1"
resolved "https://registry.yarnpkg.com/http-proxy/-/http-proxy-1.18.1.tgz#401541f0534884bbf95260334e72f88ee3976549"
integrity sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==
dependencies:
eventemitter3 "^4.0.0"
follow-redirects "^1.0.0"
requires-port "^1.0.0"
iconv-lite@0.4.24:
version "0.4.24"
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"
integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==
dependencies:
safer-buffer ">= 2.1.2 < 3"
ignore-by-default@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/ignore-by-default/-/ignore-by-default-1.0.1.tgz#48ca6d72f6c6a3af00a9ad4ae6876be3889e2b09"
integrity sha1-SMptcvbGo68Aqa1K5odr44ieKwk=
import-lazy@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/import-lazy/-/import-lazy-2.1.0.tgz#05698e3d45c88e8d7e9d92cb0584e77f096f3e43"
integrity sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=
imurmurhash@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"
integrity sha1-khi5srkoojixPcT7a21XbyMUU+o=
inherits@2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=
inherits@2.0.4:
version "2.0.4"
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
ini@^1.3.5, ini@~1.3.0:
version "1.3.5"
resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927"
integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==
ipaddr.js@1.9.1:
version "1.9.1"
resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.9.1.tgz#bff38543eeb8984825079ff3a2a8e6cbd46781b3"
integrity sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==
is-binary-path@~2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09"
integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==
dependencies:
binary-extensions "^2.0.0"
is-ci@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-2.0.0.tgz#6bc6334181810e04b5c22b3d589fdca55026404c"
integrity sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==
dependencies:
ci-info "^2.0.0"
is-extglob@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2"
integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=
is-fullwidth-code-point@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f"
integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=
is-fullwidth-code-point@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d"
integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==
is-glob@^4.0.1, is-glob@~4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc"
integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==
dependencies:
is-extglob "^2.1.1"
is-installed-globally@^0.3.1:
version "0.3.2"
resolved "https://registry.yarnpkg.com/is-installed-globally/-/is-installed-globally-0.3.2.tgz#fd3efa79ee670d1187233182d5b0a1dd00313141"
integrity sha512-wZ8x1js7Ia0kecP/CHM/3ABkAmujX7WPvQk6uu3Fly/Mk44pySulQpnHG46OMjHGXApINnV4QhY3SWnECO2z5g==
dependencies:
global-dirs "^2.0.1"
is-path-inside "^3.0.1"
is-npm@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/is-npm/-/is-npm-4.0.0.tgz#c90dd8380696df87a7a6d823c20d0b12bbe3c84d"
integrity sha512-96ECIfh9xtDDlPylNPXhzjsykHsMJZ18ASpaWzQyBr4YRTcVjUvzaHayDAES2oU/3KpljhHUjtSRNiDwi0F0ig==
is-number@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b"
integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==
is-obj@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-2.0.0.tgz#473fb05d973705e3fd9620545018ca8e22ef4982"
integrity sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==
is-path-inside@^3.0.1:
version "3.0.2"
resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.2.tgz#f5220fc82a3e233757291dddc9c5877f2a1f3017"
integrity sha512-/2UGPSgmtqwo1ktx8NDHjuPwZWmHhO+gj0f93EkhLB5RgW9RZevWYYlIkS6zePc6U2WpOdQYIwHe9YC4DWEBVg==
is-typedarray@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a"
integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=
is-yarn-global@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/is-yarn-global/-/is-yarn-global-0.3.0.tgz#d502d3382590ea3004893746754c89139973e232"
integrity sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==
json-buffer@3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.0.tgz#5b1f397afc75d677bde8bcfc0e47e1f9a3d9a898"
integrity sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=
keyv@^3.0.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/keyv/-/keyv-3.1.0.tgz#ecc228486f69991e49e9476485a5be1e8fc5c4d9"
integrity sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==
dependencies:
json-buffer "3.0.0"
latest-version@^5.0.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/latest-version/-/latest-version-5.1.0.tgz#119dfe908fe38d15dfa43ecd13fa12ec8832face"
integrity sha512-weT+r0kTkRQdCdYCNtkMwWXQTMEswKrFBkm4ckQOMVhhqhIMI1UT2hMj+1iigIhgSZm5gTmrRXBNoGUgaTY1xA==
dependencies:
package-json "^6.3.0"
lodash@^4.17.19:
version "4.17.20"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52"
integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==
lowercase-keys@^1.0.0, lowercase-keys@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-1.0.1.tgz#6f9e30b47084d971a7c820ff15a6c5167b74c26f"
integrity sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==
lowercase-keys@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-2.0.0.tgz#2603e78b7b4b0006cbca2fbcc8a3202558ac9479"
integrity sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==
make-dir@^3.0.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f"
integrity sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==
dependencies:
semver "^6.0.0"
media-typer@0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748"
integrity sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=
merge-descriptors@1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61"
integrity sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=
methods@~1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee"
integrity sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=
micromatch@^4.0.2:
version "4.0.2"
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.2.tgz#4fcb0999bf9fbc2fcbdd212f6d629b9a56c39259"
integrity sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==
dependencies:
braces "^3.0.1"
picomatch "^2.0.5"
mime-db@1.44.0:
version "1.44.0"
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.44.0.tgz#fa11c5eb0aca1334b4233cb4d52f10c5a6272f92"
integrity sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==
mime-types@~2.1.24:
version "2.1.27"
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.27.tgz#47949f98e279ea53119f5722e0f34e529bec009f"
integrity sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==
dependencies:
mime-db "1.44.0"
mime@1.6.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1"
integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==
mimic-response@^1.0.0, mimic-response@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-1.0.1.tgz#4923538878eef42063cb8a3e3b0798781487ab1b"
integrity sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==
minimatch@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==
dependencies:
brace-expansion "^1.1.7"
minimist@^1.2.0:
version "1.2.5"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602"
integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==
ms@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=
ms@2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a"
integrity sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==
ms@^2.1.1:
version "2.1.2"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==
negotiator@0.6.2:
version "0.6.2"
resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.2.tgz#feacf7ccf525a77ae9634436a64883ffeca346fb"
integrity sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==
nodemon@^2.0.4:
version "2.0.4"
resolved "https://registry.yarnpkg.com/nodemon/-/nodemon-2.0.4.tgz#55b09319eb488d6394aa9818148c0c2d1c04c416"
integrity sha512-Ltced+hIfTmaS28Zjv1BM552oQ3dbwPqI4+zI0SLgq+wpJhSyqgYude/aZa/3i31VCQWMfXJVxvu86abcam3uQ==
dependencies:
chokidar "^3.2.2"
debug "^3.2.6"
ignore-by-default "^1.0.1"
minimatch "^3.0.4"
pstree.remy "^1.1.7"
semver "^5.7.1"
supports-color "^5.5.0"
touch "^3.1.0"
undefsafe "^2.0.2"
update-notifier "^4.0.0"
nopt@~1.0.10:
version "1.0.10"
resolved "https://registry.yarnpkg.com/nopt/-/nopt-1.0.10.tgz#6ddd21bd2a31417b92727dd585f8a6f37608ebee"
integrity sha1-bd0hvSoxQXuScn3Vhfim83YI6+4=
dependencies:
abbrev "1"
normalize-path@^3.0.0, normalize-path@~3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65"
integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==
normalize-url@^4.1.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-4.5.0.tgz#453354087e6ca96957bd8f5baf753f5982142129"
integrity sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ==
on-finished@~2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947"
integrity sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=
dependencies:
ee-first "1.1.1"
once@^1.3.1, once@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E=
dependencies:
wrappy "1"
p-cancelable@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-1.1.0.tgz#d078d15a3af409220c886f1d9a0ca2e441ab26cc"
integrity sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==
package-json@^6.3.0:
version "6.5.0"
resolved "https://registry.yarnpkg.com/package-json/-/package-json-6.5.0.tgz#6feedaca35e75725876d0b0e64974697fed145b0"
integrity sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==
dependencies:
got "^9.6.0"
registry-auth-token "^4.0.0"
registry-url "^5.0.0"
semver "^6.2.0"
parseurl@~1.3.3:
version "1.3.3"
resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4"
integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==
path-to-regexp@0.1.7:
version "0.1.7"
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c"
integrity sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=
picomatch@^2.0.4, picomatch@^2.0.5, picomatch@^2.2.1:
version "2.2.2"
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.2.tgz#21f333e9b6b8eaff02468f5146ea406d345f4dad"
integrity sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==
prepend-http@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897"
integrity sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=
proxy-addr@~2.0.5:
version "2.0.6"
resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.6.tgz#fdc2336505447d3f2f2c638ed272caf614bbb2bf"
integrity sha512-dh/frvCBVmSsDYzw6n926jv974gddhkFPfiN8hPOi30Wax25QZyZEGveluCgliBnqmuM+UJmBErbAUFIoDbjOw==
dependencies:
forwarded "~0.1.2"
ipaddr.js "1.9.1"
pstree.remy@^1.1.7:
version "1.1.8"
resolved "https://registry.yarnpkg.com/pstree.remy/-/pstree.remy-1.1.8.tgz#c242224f4a67c21f686839bbdb4ac282b8373d3a"
integrity sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==
pump@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64"
integrity sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==
dependencies:
end-of-stream "^1.1.0"
once "^1.3.1"
pupa@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/pupa/-/pupa-2.0.1.tgz#dbdc9ff48ffbea4a26a069b6f9f7abb051008726"
integrity sha512-hEJH0s8PXLY/cdXh66tNEQGndDrIKNqNC5xmrysZy3i5C3oEoLna7YAOad+7u125+zH1HNXUmGEkrhb3c2VriA==
dependencies:
escape-goat "^2.0.0"
qs@6.7.0:
version "6.7.0"
resolved "https://registry.yarnpkg.com/qs/-/qs-6.7.0.tgz#41dc1a015e3d581f1621776be31afb2876a9b1bc"
integrity sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==
range-parser@~1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031"
integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==
raw-body@2.4.0:
version "2.4.0"
resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.4.0.tgz#a1ce6fb9c9bc356ca52e89256ab59059e13d0332"
integrity sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==
dependencies:
bytes "3.1.0"
http-errors "1.7.2"
iconv-lite "0.4.24"
unpipe "1.0.0"
rc@^1.2.8:
version "1.2.8"
resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed"
integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==
dependencies:
deep-extend "^0.6.0"
ini "~1.3.0"
minimist "^1.2.0"
strip-json-comments "~2.0.1"
readdirp@~3.4.0:
version "3.4.0"
resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.4.0.tgz#9fdccdf9e9155805449221ac645e8303ab5b9ada"
integrity sha512-0xe001vZBnJEK+uKcj8qOhyAKPzIT+gStxWr3LCB0DwcXR5NZJ3IaC+yGnHCYzB/S7ov3m3EEbZI2zeNvX+hGQ==
dependencies:
picomatch "^2.2.1"
registry-auth-token@^4.0.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/registry-auth-token/-/registry-auth-token-4.2.0.tgz#1d37dffda72bbecd0f581e4715540213a65eb7da"
integrity sha512-P+lWzPrsgfN+UEpDS3U8AQKg/UjZX6mQSJueZj3EK+vNESoqBSpBUD3gmu4sF9lOsjXWjF11dQKUqemf3veq1w==
dependencies:
rc "^1.2.8"
registry-url@^5.0.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/registry-url/-/registry-url-5.1.0.tgz#e98334b50d5434b81136b44ec638d9c2009c5009"
integrity sha512-8acYXXTI0AkQv6RAOjE3vOaIXZkT9wo4LOFbBKYQEEnnMNBpKqdUrI6S4NT0KPIo/WVvJ5tE/X5LF/TQUf0ekw==
dependencies:
rc "^1.2.8"
requires-port@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff"
integrity sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=
responselike@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/responselike/-/responselike-1.0.2.tgz#918720ef3b631c5642be068f15ade5a46f4ba1e7"
integrity sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=
dependencies:
lowercase-keys "^1.0.0"
safe-buffer@5.1.2:
version "5.1.2"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"
integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==
"safer-buffer@>= 2.1.2 < 3":
version "2.1.2"
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==
semver-diff@^3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/semver-diff/-/semver-diff-3.1.1.tgz#05f77ce59f325e00e2706afd67bb506ddb1ca32b"
integrity sha512-GX0Ix/CJcHyB8c4ykpHGIAvLyOwOobtM/8d+TQkAd81/bEjgPHrfba41Vpesr7jX/t8Uh+R3EX9eAS5be+jQYg==
dependencies:
semver "^6.3.0"
semver@^5.7.1:
version "5.7.1"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7"
integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==
semver@^6.0.0, semver@^6.2.0, semver@^6.3.0:
version "6.3.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d"
integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==
send@0.17.1:
version "0.17.1"
resolved "https://registry.yarnpkg.com/send/-/send-0.17.1.tgz#c1d8b059f7900f7466dd4938bdc44e11ddb376c8"
integrity sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==
dependencies:
debug "2.6.9"
depd "~1.1.2"
destroy "~1.0.4"
encodeurl "~1.0.2"
escape-html "~1.0.3"
etag "~1.8.1"
fresh "0.5.2"
http-errors "~1.7.2"
mime "1.6.0"
ms "2.1.1"
on-finished "~2.3.0"
range-parser "~1.2.1"
statuses "~1.5.0"
serve-static@1.14.1:
version "1.14.1"
resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.14.1.tgz#666e636dc4f010f7ef29970a88a674320898b2f9"
integrity sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==
dependencies:
encodeurl "~1.0.2"
escape-html "~1.0.3"
parseurl "~1.3.3"
send "0.17.1"
setprototypeof@1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.1.1.tgz#7e95acb24aa92f5885e0abef5ba131330d4ae683"
integrity sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==
signal-exit@^3.0.2:
version "3.0.3"
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c"
integrity sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==
"statuses@>= 1.5.0 < 2", statuses@~1.5.0:
version "1.5.0"
resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c"
integrity sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=
string-width@^3.0.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-3.1.0.tgz#22767be21b62af1081574306f69ac51b62203961"
integrity sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==
dependencies:
emoji-regex "^7.0.1"
is-fullwidth-code-point "^2.0.0"
strip-ansi "^5.1.0"
string-width@^4.0.0, string-width@^4.1.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.0.tgz#952182c46cc7b2c313d1596e623992bd163b72b5"
integrity sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.0"
strip-ansi@^5.1.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae"
integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==
dependencies:
ansi-regex "^4.1.0"
strip-ansi@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.0.tgz#0b1571dd7669ccd4f3e06e14ef1eed26225ae532"
integrity sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==
dependencies:
ansi-regex "^5.0.0"
strip-json-comments@~2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a"
integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo=
supports-color@^5.5.0:
version "5.5.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f"
integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==
dependencies:
has-flag "^3.0.0"
supports-color@^7.1.0:
version "7.1.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.1.0.tgz#68e32591df73e25ad1c4b49108a2ec507962bfd1"
integrity sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==
dependencies:
has-flag "^4.0.0"
term-size@^2.1.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/term-size/-/term-size-2.2.0.tgz#1f16adedfe9bdc18800e1776821734086fcc6753"
integrity sha512-a6sumDlzyHVJWb8+YofY4TW112G6p2FCPEAFk+59gIYHv3XHRhm9ltVQ9kli4hNWeQBwSpe8cRN25x0ROunMOw==
to-readable-stream@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/to-readable-stream/-/to-readable-stream-1.0.0.tgz#ce0aa0c2f3df6adf852efb404a783e77c0475771"
integrity sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==
to-regex-range@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4"
integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==
dependencies:
is-number "^7.0.0"
toidentifier@1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.0.tgz#7e1be3470f1e77948bc43d94a3c8f4d7752ba553"
integrity sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==
touch@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/touch/-/touch-3.1.0.tgz#fe365f5f75ec9ed4e56825e0bb76d24ab74af83b"
integrity sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==
dependencies:
nopt "~1.0.10"
type-fest@^0.8.1:
version "0.8.1"
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d"
integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==
type-is@~1.6.17, type-is@~1.6.18:
version "1.6.18"
resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131"
integrity sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==
dependencies:
media-typer "0.3.0"
mime-types "~2.1.24"
typedarray-to-buffer@^3.1.5:
version "3.1.5"
resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080"
integrity sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==
dependencies:
is-typedarray "^1.0.0"
undefsafe@^2.0.2:
version "2.0.3"
resolved "https://registry.yarnpkg.com/undefsafe/-/undefsafe-2.0.3.tgz#6b166e7094ad46313b2202da7ecc2cd7cc6e7aae"
integrity sha512-nrXZwwXrD/T/JXeygJqdCO6NZZ1L66HrxM/Z7mIq2oPanoN0F1nLx3lwJMu6AwJY69hdixaFQOuoYsMjE5/C2A==
dependencies:
debug "^2.2.0"
unique-string@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/unique-string/-/unique-string-2.0.0.tgz#39c6451f81afb2749de2b233e3f7c5e8843bd89d"
integrity sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==
dependencies:
crypto-random-string "^2.0.0"
unpipe@1.0.0, unpipe@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec"
integrity sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=
update-notifier@^4.0.0:
version "4.1.1"
resolved "https://registry.yarnpkg.com/update-notifier/-/update-notifier-4.1.1.tgz#895fc8562bbe666179500f9f2cebac4f26323746"
integrity sha512-9y+Kds0+LoLG6yN802wVXoIfxYEwh3FlZwzMwpCZp62S2i1/Jzeqb9Eeeju3NSHccGGasfGlK5/vEHbAifYRDg==
dependencies:
boxen "^4.2.0"
chalk "^3.0.0"
configstore "^5.0.1"
has-yarn "^2.1.0"
import-lazy "^2.1.0"
is-ci "^2.0.0"
is-installed-globally "^0.3.1"
is-npm "^4.0.0"
is-yarn-global "^0.3.0"
latest-version "^5.0.0"
pupa "^2.0.1"
semver-diff "^3.1.1"
xdg-basedir "^4.0.0"
url-parse-lax@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/url-parse-lax/-/url-parse-lax-3.0.0.tgz#16b5cafc07dbe3676c1b1999177823d6503acb0c"
integrity sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=
dependencies:
prepend-http "^2.0.0"
utils-merge@1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713"
integrity sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=
vary@~1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"
integrity sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=
widest-line@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/widest-line/-/widest-line-3.1.0.tgz#8292333bbf66cb45ff0de1603b136b7ae1496eca"
integrity sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg==
dependencies:
string-width "^4.0.0"
wrappy@1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=
write-file-atomic@^3.0.0:
version "3.0.3"
resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-3.0.3.tgz#56bd5c5a5c70481cd19c571bd39ab965a5de56e8"
integrity sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==
dependencies:
imurmurhash "^0.1.4"
is-typedarray "^1.0.0"
signal-exit "^3.0.2"
typedarray-to-buffer "^3.1.5"
xdg-basedir@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/xdg-basedir/-/xdg-basedir-4.0.0.tgz#4bc8d9984403696225ef83a1573cbbcb4e79db13"
integrity sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==
{
"name": "cloudfn",
"version": "1.0.0",
"description": "11",
"main": "index.js",
"author": "duiba",
"license": "ISC",
"sdkVersion": "*",
"dependencies": {
"dayjs": "^1.8.28",
"lodash": "^4.17.20",
"node-xlsx": "^0.15.0",
"source-map-support": "^0.5.19",
"taobao-mini-sdk": "^0.2.1"
},
"scripts": {
"start": "tsc",
"mock": "cd mockServer && npm start",
"preinstall": "cd mockServer && yarn"
},
"config": {
"notNeedLogin": []
},
"optionalDependencies": {
"@types/lodash": "^4.14.160",
"@types/node": "^14.6.0",
"@typescript-eslint/eslint-plugin": "^3.9.1",
"@typescript-eslint/parser": "^3.9.1",
"eslint": "^7.7.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-prettier": "^3.1.4",
"prettier": "^2.0.5",
"typescript": "^3.9.7"
}
}
/** @format */
import online from './online'
import test from './test'
interface Iconfig {
generateVipCallBackUrl(activityId?: string): string
}
const configs = {
online,
test,
mock: test
}
// 根据服务环境获取配置
export const getConfig = (context: IContext<{}>): Iconfig => {
const env = context.env
return configs[env] || configs.online
}
/** @format */
import { appId } from '../constants'
export default {
generateVipCallBackUrl(activityId: string) {
return `https://m.duanqu.com/?_ariver_appid=${appId}&query=activityId%3D${activityId}`
}
}
/** @format */
export default {
generateVipCallBackUrl() {
return `客户端生成的预览地址`
}
}
/** @format */
import { DEFAULT_CODE_TYPES } from './sdk'
export const BusinessError = {
// 更新重试失败(用于并发更新)
ERROR_UPDATE_RETRY: {
code: `210001`,
defaultMsg: `系统错误`
},
// 活动不存在
ERROR_NO_ACTIVITY: {
code: `220001`,
defaultMsg: `活动不存在`
},
// 活动未开始
ERROR_ACTIVITY_NOSTART: {
code: `220002`,
defaultMsg: `活动未开始`
},
// 活动已结束
ERROR_ACTIVITY_OVER: {
code: `220003`,
defaultMsg: `活动已结束`
},
// 用户不存在
ERROR_NO_USER: {
code: `310002`,
defaultMsg: `用户不存在`
},
// 非店铺会员
ERROR_NO_VIP: {
code: `310003`,
defaultMsg: '非店铺会员'
},
// 暂无次数可领取
ERROR_TASK_NORECEIVE: {
code: `430001`,
defaultMsg: `该任务暂无领取次数`
},
// 任务奖励已领取
ERROR_TASK_ALREADYRECEIVE: {
code: `430002`,
defaultMsg: `任务奖励已领取`
},
// 任务已完成
ERROR_TASK_COMPLETE: {
code: `430003`,
defaultMsg: `任务已完成`
},
ERROR_INVALID_INVITE_ID: {
code: `430004`,
defaultMsg: `邀请码无效`
},
ERROR_NO_CREDITS: {
code: `430005`,
defaultMsg: `任务所需积分不足`
},
ERROR_TASK_LIMIT: {
code: `430006`,
defaultMsg: `今日该任务次数超限`
},
ERROR_AREADY_INVITE_SUCCESS: {
code: `430007`,
defaultMsg: `已经成功邀请过`
},
ERROR_FORBIDDEN_OPE: {
code: `530001`,
defaultMsg: `非法操作`
},
ERROR_RECEIVE_PRIZE: {
code: `630002`,
defaultMsg: `奖励已领取`
},
ERROR_SEND_PRIZE: {
code: `730001`,
defaultMsg: `发奖失败`
},
ERROR_NO_PRIZE: {
code: `730002`,
defaultMsg: `奖品不存在`
},
ERROR_NO_STOCK: {
code: `730003`,
defaultMsg: `库存不足`
},
ERROR_PRIZE_EXPIRED: {
code: `740001`,
defaultMsg: `奖品已超过领取时间`
}
}
export const CODE_TYPES = Object.assign({}, DEFAULT_CODE_TYPES, BusinessError)
// tb 接口返回部分错误
export const TBERROR = {
USER_PERMISSION_EXCEED_MAX_RIGHT_COUNT_IN_DAY: '今日领取达到上限,明日再来领取哦',
COUPON_INVALID_OR_DELETED: '权益无效或者被删除,请联系商家',
APPLY_OWNSELF_COUPON: '不能领取自己家店铺权益',
APPLY_SINGLE_COUPON_COUNT_EXCEED_LIMIT: '请至卡券包删除无用权益再领取',
NO_RIGHT_QUANTITY: '权益库存不足,请联系商家',
ERRORA_3_567: '领取失败,为风险用户',
'Invalid session': '订购应用已过期,请联系商家处理'
}
// 领取奖品状态
export const DRAW_STATUS = {
// 待领取
WAITAWARD: 1,
// 处理中
PROCESSING: 2,
// 领取成功
SUCCESS: 3,
// 领取失败
FAIL: 4,
// 已过期
EXPIRED: 5,
// 重新领取
RETRY: 6
}
export const appId = '${需要补充}'
// C端的APP NAME
export const C_APP_NAME: string = `promotioncenter-${appId}`
// 订单状态
export const TAOBAO_SUCCESS_ORDER_STATUS: string[] = [
'WAIT_SELLER_SEND_GOODS',
'SELLER_CONSIGNED_PART',
'WAIT_BUYER_CONFIRM_GOODS',
'TRADE_BUYER_SIGNED',
'TRADE_FINISHED',
'PAID_FORBID_CONSIGN'
]
// 活动状态
export const enum ACTIVITY_STATUS {
NORMAL = 1,
DELETE = 2
}
// 奖品状态
export const enum DELETE_STATUS {
NORMAL = 1,
DELETE = 2
}
//任务频率类型常量
export const TASK_RATE_TYPE = {
FOREVER: 1,
EVERYDAY: 2,
NOLIMIT: 3
}
//任务状态
export const TASK_STATUS = {
WAIT_DO: 1, // 未完成
WAIT_RECEIVE: 2, // 待领取
DONE: 3 // 已完成
}
// 奖品类型
export const PRIZE_TYPE = {
ENAME: 1,
CREDITS: 2,
OBJECT: 3,
THANKS: 5
}
// 奖品分类
export const PRIZE_DATA_TYPE = {
RANKING: 1, // 排行榜
PROBABILITY: 2 // 概率
}
// 奖品是否限制库存
export enum SWICH_TOCK {
LIMIT = 1,
NO_LIMIT = 2
}
/** @format */
import { services, paramsCheck, userCheck, activityTimeCheck } from '../decorator'
import { resultsModel } from '../sdk'
import { AwardsService } from '../service'
import { PRIZE_TYPE, PRIZE_DATA_TYPE, DRAW_STATUS } from '../constants'
import { getToday, logger } from '../utils'
import { CodeType } from 'taobao-mini-sdk/lib/utils/codetypes'
export interface IPrizeListParams {
activityId: string
}
export interface IReceiveOjectParams {
activityId: string
_id: string
name: string
phone: string
province: string
city: string
area: string
addressdetail: string
}
export interface IReceiveEnameParams {
activityId: string
_id: string
}
export default class AwardsController {
/**
* 我的奖品列表
*/
@paramsCheck(['activityId'])
@userCheck({ intercept: true })
@services([AwardsService])
async getMyPrizeList(
context: IContext<IPrizeListParams>,
{},
[awardSer]: [AwardsService]
): Promise<IResult<IAwards[]>> {
const {
openId,
data: { activityId }
} = context
let result = await awardSer.getMyPrizeList({ openId, activityId })
return resultsModel.success(result)
}
/**
* 领取实物
*/
@paramsCheck(['activityId', '_id', 'name', 'phone', 'province', 'city', 'area', 'addressdetail'])
@userCheck({ intercept: true })
@services([AwardsService])
async receiveObjectPrize(
context: IContext<IReceiveOjectParams>,
{},
[awardSer]: [AwardsService]
): Promise<IResult<boolean>> {
let { province, city, area, addressdetail, _id, name, phone, activityId } = context.data
let result = await awardSer.recieveObjectPrize(_id, {
activityId,
province,
city,
area,
addressdetail,
name,
phone
})
if ((result as CodeType).code) {
return resultsModel.error(result as CodeType)
}
return resultsModel.success(result as true)
}
/**
* 权益重新领取
*/
@paramsCheck(['activityId', '_id'])
@userCheck({ intercept: true })
@services([AwardsService])
async receiveEnamePrize(context: IContext<IReceiveEnameParams>, {}, [awardSer]: [AwardsService]) {
let { _id, activityId } = context.data
let result = await awardSer.recieveEnamePrize(_id, activityId)
//@ts-ignore
if (result.code) {
//@ts-ignore
return resultsModel.error(result)
}
//@ts-ignore
if (result.remark) {
//@ts-ignore
return resultsModel.error(result, result.remark)
}
return resultsModel.success(result)
}
/**
* 概率抽奖
*/
@paramsCheck(['activityId', 'prizeDataType'])
@activityTimeCheck
@services([AwardsService])
async drawLotteryPrize(context: IContext<IParams>, { userInfo }: IControllerInfos, [awardSer]: [AwardsService]) {
const { openId } = context
const { activityId, prizeDataType } = context.data
// 获取奖池配置
const prizesPool = await awardSer.getPrizeConfig({
activityId,
// 根据需求配置筛选条件
prizeDataType
})
logger(prizesPool)
// 根据概率获取
const prize = await awardSer.getPrizeByProbability(prizesPool)
// 未找到奖品,降级到谢谢参与
if (!prize) {
return resultsModel.success({
data: {
type: PRIZE_TYPE.THANKS,
name: '谢谢参与'
}
})
}
let reduceResult: ICodeType | 1 = 1
// 不是积分奖品, 检查是否扣库存
if (prize.type !== PRIZE_TYPE.CREDITS) {
reduceResult = await awardSer.reduceStock(prize._id)
}
// 扣库存失败
if ((reduceResult as ICodeType).code) return resultsModel.error(reduceResult as ICodeType)
const { type, _id, ename, image, name } = prize
const { userNick } = userInfo
let record = {
openId,
prizeId: _id,
activityId,
drawStatus: DRAW_STATUS.WAITAWARD,
prizeDataType,
remark: '',
type,
ename,
name,
image,
userNick,
createDay: getToday()
}
// 奖品信息 insert c_awards表
const result = await awardSer.addAward(record)
return resultsModel.success({
id: result,
type,
name,
image
})
}
}
/** @format */
import { CODE_TYPES } from './../constants'
import { services, paramsCheck } from '../decorator'
import { resultsModel } from '../sdk'
import { logger } from '../utils'
import { BaseService } from '../service'
export default class BaseController {
/**
* 活动基本信息
*/
@paramsCheck(['activityId'])
@services([BaseService])
async getActivityBaseInfoById(
context: IContext<{
activityId: string
}>,
{},
[baseService]: [BaseService]
): Promise<IResult<IActivityInfo>> {
const { activityId } = context.data
// 参数校验
if (!activityId) {
return resultsModel.error(CODE_TYPES.PARAMS_ERROR, `activityId必填`)
}
// 活动基本情况
const activityInfo = await baseService.getBaseInfo(activityId)
return resultsModel.success(activityInfo)
}
/**
* 获取商品列表
*/
@paramsCheck(['itemIds'])
@services([BaseService])
async getItemListByItemIds(
context: IContext<{ itemIds: string }>,
{ session }: IControllerInfos,
[baseService]: [BaseService]
): Promise<IResult<ITaoBaoItems[]>> {
const { itemIds } = context.data
const list = await baseService.getItemListByIds(itemIds, session)
return resultsModel.success(list)
}
}
/** @format */
import { CODE_TYPES } from './../constants'
import { paramsCheck, userCheck, activityTimeCheck } from '../decorator/check'
import { services } from '../decorator/services'
import { resultsModel } from '../sdk'
import { getToday } from '../utils'
import { UserService, AccessService, TaskService } from '../service'
export default class Share {
/**
* 完成分享
*/
@paramsCheck(['activityId', 'inviteId'])
@activityTimeCheck
@services([UserService, TaskService, AccessService])
async doHelp(
context: IContext<IParams>,
{ userInfo, vipInfo, activityInfo }: IControllerInfos,
[userService, taskService, accessService]: [UserService, TaskService, AccessService]
): Promise<IResult<boolean>> {
const { inviteId } = context.data
const { openId } = context
const inviteUserInfo: IUserInfo = await userService.getUserInfoByOpenId(inviteId)
// inviteId的用户信息查询不到, 则inviteId无效
if (!inviteUserInfo) return resultsModel.error(CODE_TYPES.ERROR_INVALID_INVITE_ID)
const inviteCompleteList = taskService.getCompleteTaskByUserTaskInfo('invites', inviteUserInfo)
// 邀请成功列表有该用户信息
if (inviteCompleteList.some(v => v.openId === openId)) {
return resultsModel.error(CODE_TYPES.ERROR_AREADY_INVITE_SUCCESS)
}
// const isFirstLogin: boolean = (await accessService.getAccessCount()) === 1
// 获取活动基本信息
const { tasks } = activityInfo
// 获取分享奖励
const {
inviteFriends: { value }
}: ITasks = tasks || {}
// 新会员
const isNewVip = userService.checkNewVipStatus(userInfo, vipInfo)
// 满足邀请标准的条件, 根据需求变化
const isValidShare = [isNewVip].every(v => !!v)
const today = getToday()
if (isValidShare) {
const { _id: inviteUserId } = inviteUserInfo
// 增加邀请人的待领取次数和邀请记录
await userService.updateUser(inviteUserId, {
$inc: {
'remainTimes.invites': value
},
$push: {
[`taskInfo.${today}.invites`]: { openId, createTime: Date.now() }
}
})
}
return resultsModel.success(true)
}
}
/** @format */
import { USER_DB_NAME, ACCESS_DB_NAME, AWARDS_DB_NAME } from '../db'
import { resultsModel, dateFormatter, transformBeijingDate, BaseDao } from '../sdk'
import { CODE_TYPES } from '../constants'
import * as xlsx from 'node-xlsx'
export interface IStatsParams {
activityId: string
startDay: string
endDay: string
}
/** @format */
export default class StatController {
/**
* 统计数据
*/
async getStats(context: IContext<IStatsParams>) {
const { activityId, startDay, endDay } = context.data
const userDao: IBaseDao = new BaseDao(context, USER_DB_NAME)
const accessDao: IBaseDao = new BaseDao(context, ACCESS_DB_NAME)
const oneDay = 24 * 3600 * 1000
const xlsxData = []
try {
let day = startDay
while (new Date(day).getTime() <= new Date(endDay).getTime()) {
// 访问PV
const PV = await accessDao.count({ activityId, createDay: day })
// 访问UV
const UV = (
await accessDao.aggregate([
{ $match: { activityId, createDay: day } },
{ $group: { _id: '$openId', count: { $sum: 1 } } }
])
).length
// 新增UV
const newUV = await userDao.count({
activityId,
createDay: day
})
// 已入会PV
const vipPV = await accessDao.count({ activityId, createDay: day, isVip: true })
// 未入会PV
const noVipPV = await accessDao.count({ activityId, createDay: day, isVip: false })
// 已入会UV
const vipUV = (
await accessDao.aggregate([
{ $match: { activityId, createDay: day, isVip: true } },
{ $group: { _id: '$openId', count: { $sum: 1 } } }
])
).length
// 未入会UV
const noVipUV = (
await accessDao.aggregate([
{ $match: { activityId, createDay: day, isVip: false } },
{ $group: { _id: '$openId', count: { $sum: 1 } } }
])
).length
// 新增入会UV
const newVipUV = await userDao.count({
activityId,
'member.newMember': true,
'member.bememberDay': day
})
const newFollowUV = await userDao.count({
activityId,
'member.follow': true,
'member.followDay': day
})
// 签到任务
// const signTaskUV = await userDao.count({
// activityId,
// [`taskInfo.${day}.sign`]: {
// $exists: true
// }
// })
// 收藏商品
// const collectGoodsTaskUV = await userDao.count({
// activityId,
// [`taskInfo.${day}.collecctGoods`]: {
// $exists: true
// }
// })
const keyValueMapper = {
时间: day,
访问PV: PV,
访问UV: UV,
新增UV: newUV,
已入会PV: vipPV,
已入会UV: vipUV,
未入会PV: noVipPV,
未入会UV: noVipUV,
新入会UV: newVipUV,
新增关注UV: newFollowUV
// 收藏商品UV: collectGoodsTaskUV
// 签到任务UV: signTaskUV
}
if (day === startDay) {
xlsxData.push(Object.keys(keyValueMapper))
}
// @ts-ignore
xlsxData.push(Object.values(keyValueMapper))
let tommorrow = new Date(day).getTime() + oneDay
day = dateFormatter(transformBeijingDate(tommorrow), 'yyyy/MM/dd')
}
let buffer = xlsx.build([
{
name: `数据统计${startDay.replace(/\//g, '-')}-${endDay.replace(/\//g, '-')}`,
data: xlsxData
}
])
// let result = {}
console.log(xlsxData, 'xlsxData')
// let result = await context.cloud.file.uploadFile({
// fileContent: buffer,
// fileName: `数据统计${startDay.replace(/\//g, '-')}-${endDay.replace(/\//g, '-')}.xlsx`
// })
// console.log(xlsxData, 'xlsxData')
// if (result.url) {
// result.url = result.url.replace('http', 'https').replace('-internal', '')
// }
return resultsModel.success(xlsxData)
} catch (e) {
console.log('上传文件出错', e)
// 打印日志
return resultsModel.error(CODE_TYPES.SYSTEM_ERROR, `上传文件错误`)
}
}
}
/** @format */
import { CODE_TYPES, TASK_RATE_TYPE } from './../constants'
import { paramsCheck, userCheck, activityTimeCheck, noCatch, services } from '../decorator'
import { resultsModel, TBAPIS } from '../sdk'
import { TaskService, BaseService } from '../service'
import { logger } from '../utils'
import { ITaskInfo } from '../service/task.service'
export default class Task {
/**
* 任务列表
*/
@paramsCheck(['activityId'])
@userCheck({ intercept: true })
@activityTimeCheck
@services([TaskService])
async getTaskList(
context: IContext<{ activityId: string }>,
{ userInfo, vipInfo, activityInfo, session }: IControllerInfos,
[taskService]: [TaskService]
): Promise<IResult<ITaskInfo[]>> {
const { tasks, startTime } = activityInfo
// 更新user状态
let updatedUserInfo = await taskService.updateTasks(
userInfo._id,
// 需要查询更新的任务
[
taskService.updateVipTask(userInfo, vipInfo, tasks)
// taskService.updateSignTask(userInfo, tasks),
// await taskService.updateOrderGoodsTask(userInfo, tasks, startTime, session)
],
userInfo
)
if (!updatedUserInfo) return resultsModel.error(CODE_TYPES.SYSTEM_ERROR, '更新任务列表失败')
// 会员任务
const vipTask = taskService.initVipTask(updatedUserInfo, vipInfo, tasks)
// 关注店铺
const followTask = taskService.initFollowTask(updatedUserInfo, tasks)
// 签到任务
// const signTask = taskService.initSignTask(updatedUserInfo, tasks)
// // 下单任务
// const orderGoodsTask = taskService.initOrderGoodsTask(updatedUserInfo, tasks)
// // 浏览商品任务
// const browseGoodsTask = taskService.initBrowseGoodsTask(updatedUserInfo, tasks)
// // 收藏商品任务
// const collectGoodsTask = taskService.initCollectGoodsTask(updatedUserInfo, tasks)
// // 跳转链接任务
// const jumpLinkTask = taskService.initJumpLinkTask(updatedUserInfo, tasks)
// // 邀请任务
// const invitesTask = taskService.initInvitesTask(updatedUserInfo, tasks)
// 积分兑换
//const exchangeCreditsTask = taskService.initExchangeCreditsTask(updatedUserInfo, tasks)
return resultsModel.success([
//signTask,
vipTask,
followTask
// orderGoodsTask,
// browseGoodsTask,
// invitesTask,
// collectGoodsTask,
// jumpLinkTask
])
}
/**
* 完成关注店铺任务
*/
@paramsCheck(['activityId'])
@activityTimeCheck
@services([TaskService])
async doFollowTask(
context: IContext<{ activityId: string }>,
{ userInfo, activityInfo }: IControllerInfos,
[TaskService]: [TaskService]
): Promise<IResult<boolean>> {
let { follow } = userInfo
const { flag, newFollow } = follow
// 已经关注过店铺,不可完成
const hasFollowed = flag || newFollow
if (hasFollowed) return resultsModel.error(CODE_TYPES.ERROR_TASK_COMPLETE)
// 更新状态
const result = await TaskService.updateFollowTask(userInfo, activityInfo)
return result ? resultsModel.success(true) : resultsModel.error(CODE_TYPES.SYSTEM_ERROR)
}
/**
* 积分兑换次数
*/
@paramsCheck(['activityId', 'credits'])
@userCheck({ intercept: true })
@activityTimeCheck
@services([TaskService])
async doExchangeCreditsTask(
context: IContext<IParams>,
{ userInfo, activityInfo, session }: IControllerInfos,
[taskService]: [TaskService]
): Promise<IResult<boolean>> {
const { credits } = context.data
const taskType = `exchangeCredits`
const {
tasks: {
exchangeCredits: { value, times, taskRateType }
}
} = activityInfo
const { todayCompleteTimes } = taskService.getTodayCompleteTask(taskType, userInfo)
// 如果每日限制次数并到达了限制次数
if (times && times === todayCompleteTimes && taskRateType === TASK_RATE_TYPE.EVERYDAY) {
return resultsModel.error(CODE_TYPES.ERROR_TASK_LIMIT)
}
const myCredits = await TBAPIS.queryCredits(context, session)
console.log('myCredits', myCredits)
// 积分不足
if (myCredits < credits) return resultsModel.error(CODE_TYPES.ERROR_NO_CREDITS)
// 扣积分
let result = await TBAPIS.changeCredits(context, session, {
quantity: +credits,
change_type: 2,
opt_type: '1',
remark: `积分兑换任务减积分`
})
if (!result) return resultsModel.error(CODE_TYPES.SYSTEM_ERROR)
// 更新user表
await taskService.updateUserTaskRecord(taskType, value, userInfo)
return resultsModel.success(true)
}
/**
* 浏览商品
*/
@paramsCheck(['activityId', 'itemId'])
@userCheck({ intercept: true })
@activityTimeCheck
@services([TaskService])
async doBrowseGoodsTask(
context: IContext<IParams>,
{ userInfo, activityInfo }: IControllerInfos,
[taskService]: [TaskService]
): Promise<IResult<boolean>> {
const taskType = 'browseGoods'
const { itemId } = context.data
const {
tasks: {
browseGoods: { taskRateType, times, itemIds, value }
}
} = activityInfo
const itemIdArray: number[] = Array.isArray(itemIds) ? itemIds : itemIds.split(',').map(v => +v)
// B端配置商品ids不匹配正确
if (!itemIdArray.includes(+itemId)) return resultsModel.error(CODE_TYPES.PARAMS_ERROR, '商品id不匹配')
const { todayTaskInfo, todayCompleteTimes } = taskService.getTodayCompleteTask('browseGoods', userInfo)
const hasCompleteToday =
todayTaskInfo.filter((v: { itemId: string }) => v.itemId === itemId).length &&
taskRateType === TASK_RATE_TYPE.EVERYDAY
// 今日任务已经完成
if (hasCompleteToday) {
return resultsModel.error(CODE_TYPES.PARAMS_ERROR, '今日该浏览商品任务已完成')
}
// 次数超限
if (times && times === todayCompleteTimes && taskRateType === TASK_RATE_TYPE.EVERYDAY) {
return resultsModel.error(CODE_TYPES.ERROR_TASK_LIMIT)
}
// 更新user表
await taskService.updateUserTaskRecord(taskType, value, userInfo, {
itemId
})
return resultsModel.success(true)
}
/**
* 收藏商品
*/
@paramsCheck(['activityId', 'itemId'])
@userCheck({ intercept: true })
@activityTimeCheck
@services([TaskService])
async doCollectGoodsTask(
context: IContext<IParams>,
{ userInfo, activityInfo }: IControllerInfos,
[taskService]: [TaskService]
): Promise<IResult<boolean>> {
const taskType = 'collectGoods'
const { itemId } = context.data
const {
tasks: {
collectGoods: { taskRateType, times, itemIds, value }
}
} = activityInfo
const itemIdArray: number[] = Array.isArray(itemIds) ? itemIds : itemIds.split(',').map(v => +v)
// B端配置商品ids不匹配正确
if (!itemIdArray.includes(+itemId)) return resultsModel.error(CODE_TYPES.PARAMS_ERROR, '商品id不匹配')
const { todayTaskInfo, todayCompleteTimes } = taskService.getTodayCompleteTask(taskType, userInfo)
const hasCompleteToday =
todayTaskInfo.filter((v: { itemId: string }) => v.itemId === itemId).length &&
taskRateType === TASK_RATE_TYPE.EVERYDAY
// 今日任务已经完成
if (hasCompleteToday) {
return resultsModel.error(CODE_TYPES.PARAMS_ERROR, '今日该收藏商品任务已完成')
}
// 次数超限
if (times && times === todayCompleteTimes && taskRateType === TASK_RATE_TYPE.EVERYDAY) {
return resultsModel.error(CODE_TYPES.ERROR_TASK_LIMIT)
}
// 更新user表
await taskService.updateUserTaskRecord(taskType, value, userInfo, {
itemId
})
return resultsModel.success(true)
}
/**
* 浏览链接
*/
@paramsCheck(['activityId'])
@userCheck({ intercept: true })
@activityTimeCheck
@services([TaskService])
async doJumpLinkTask(
context: IContext<IParams>,
{ userInfo, activityInfo }: IControllerInfos,
[taskService]: [TaskService]
): Promise<IResult<boolean>> {
const taskType = 'jumpLink'
const {
tasks: {
jumpLink: { taskRateType, times, value, link }
}
} = activityInfo
const { todayCompleteTimes } = taskService.getTodayCompleteTask(taskType, userInfo)
const hasCompleteToday = times && todayCompleteTimes === times && taskRateType === TASK_RATE_TYPE.EVERYDAY
// 今日任务已经完成
if (hasCompleteToday) {
return resultsModel.error(CODE_TYPES.PARAMS_ERROR, '今日跳转链接任务已完成')
}
// 次数超限
if (times && times === todayCompleteTimes && taskRateType === TASK_RATE_TYPE.EVERYDAY) {
return resultsModel.error(CODE_TYPES.ERROR_TASK_LIMIT)
}
// 更新user表
await taskService.updateUserTaskRecord(taskType, value, userInfo)
return resultsModel.success(true)
}
/**
* 领取任务奖励
*/
@paramsCheck(['activityId', 'taskType'])
@userCheck({ intercept: true })
@activityTimeCheck
@services([TaskService])
async receiveTaskRewards(
context: IContext<IParams>,
{ userInfo }: IControllerInfos,
[taskService]: [TaskService]
): Promise<IResult<boolean>> {
const { taskType } = context.data
const { remainTimes, _id } = userInfo
// 暂无领取次数
if (!remainTimes?.[taskType]) return resultsModel.error(CODE_TYPES.ERROR_TASK_NORECEIVE)
const waitReceiveTimes = remainTimes?.[taskType]
// 根据需求自定义领取任务增加的key值 如: gameTimes
const awardsTargetKey = `gameTimes`
await taskService.updateUser(_id, {
$set: {
[`remainTimes.${taskType}`]: 0
},
$inc: {
[awardsTargetKey]: waitReceiveTimes
}
})
return resultsModel.success(true)
}
/**
* 获取收藏商品列表
*/
@paramsCheck(['activityId', 'itemIds'])
@services([BaseService, TaskService])
async getCollectGoodsList(
context: IContext<IParams>,
{ session, userInfo }: IControllerInfos,
[baseService, taskService]: [BaseService, TaskService]
) {
const { itemIds } = context.data
const list = await baseService.getItemListByIds(itemIds, session)
const completeList = taskService.getCompleteTaskByUserTaskInfo('collectGoods', userInfo)
const listWithCollectStatus = list.map(v => {
return {
...v,
// 完成列表是否含有itemId
collected: completeList.some(completeItem => completeItem.itemId === v.itemId)
}
})
return resultsModel.success(listWithCollectStatus)
}
}
/** @format */
import { services, paramsCheck, activityTimeCheck } from '../decorator'
import { resultsModel } from '../sdk'
import { UserService, AccessService } from '../service'
import { getConfig } from '../config'
export interface IVipParams {
activityId: string
callbackUrl?: string
}
export interface ILoginParams {
activityId: string
userNick: string
avatar: string
isFollow: boolean
inviteId?: string
}
export default class User {
/**
* 登录接口, 初始化/更新用户信息
*/
@paramsCheck(['activityId', 'userNick', 'avatar', 'isFollow'])
@activityTimeCheck
@services([UserService, AccessService])
async login(
context: IContext<ILoginParams>,
{ userInfo, vipInfo, activityInfo }: IControllerInfos,
[userService, accessService]: [UserService, AccessService]
): Promise<IResult<{ openId: string }>> {
const { openId } = context
const { isFollow } = context.data
if (!userInfo) {
await userService.initUserData(vipInfo, activityInfo)
} else {
await userService.updateUserData(vipInfo, userInfo, activityInfo)
}
// access表
await accessService.addAccess(isFollow, vipInfo.isVip)
return resultsModel.success({
openId
})
}
/**
* 获取会员信息
*/
@paramsCheck(['activityId'])
@services([UserService])
async getVipInfo(
context: IContext<IVipParams>,
{ session, activityUserNick }: IControllerInfos,
[userService]: [UserService]
): Promise<IResult<IVipInfo>> {
const { callbackUrl, activityId } = context.data
const { generateVipCallBackUrl } = getConfig(context)
const result = await userService.getShopVip(
session,
activityUserNick,
callbackUrl || generateVipCallBackUrl(activityId)
)
return resultsModel.success(result)
}
}
/** @format */
export const ACCESS_DB_NAME: string = 'c_user_access'
export const USER_DB_NAME: string = 'c_user'
export const AWARDS_DB_NAME: string = 'c_awards_info'
export const ERROR_LOG_DB_NAME: string = 'error_log'
export const SELLER_INFO_DB_NAME: string = 'a_seller_info'
export const PRIZE_CONFIG_DB_NAME: string = 'b_prize_config'
export const ACTIVITY_CONFIG_DB_NAME: string = 'b_activity_config'
/** @format */
import { resultsModel } from '../sdk'
import { CODE_TYPES } from '../constants'
import { UserService, BaseService } from '../service'
import { getSellerSession } from '../utils'
import { getConfig } from '../config'
// 检验参数是否存在
export const paramsCheck = (params: string[]) => {
return function (target: Object, name: string, descriptor: PropertyDescriptor) {
const method = descriptor.value
descriptor.value = function (...args: any[]) {
const [context, otherArgs = {}] = args
const dataKeys = Object.keys(context.data)
for (let i = 0; i < params.length; i++) {
const param = params[i]
if (!dataKeys.includes(param)) return resultsModel.error(CODE_TYPES.PARAMS_ERROR, `缺少${param}参数`)
}
return method.apply(target, [context, { ...otherArgs }])
}
}
}
// 检验用户是否存在
export const userCheck = ({ intercept = true }) => {
return function (target: any, name: string, descriptor: PropertyDescriptor) {
const method = descriptor.value
descriptor.value = async function (...args: any[]) {
const [context, otherArgs = {}] = args
const userService = new UserService(context)
const userInfo = await userService.getUserInfo()
if (!userInfo && intercept) return resultsModel.error(CODE_TYPES.ERROR_NO_USER)
return method.apply(target, [context, { ...otherArgs, userInfo }])
}
}
}
// 是否是会员
export const vipCheck = ({ intercept = true, callbackUrl = '' }) => {
return function (target: any, name: string, descriptor: PropertyDescriptor) {
const method = descriptor.value
descriptor.value = async function (...args: any[]) {
const [context, otherArgs = {}] = args
const { activityId } = context.data
const { generateVipCallBackUrl } = getConfig(context)
const userService = new UserService(context)
const { session } = await getSellerSession(context)
const vipInfo = await userService.getShopVip(session, callbackUrl || generateVipCallBackUrl(activityId))
if (!vipInfo.isVip && intercept) return resultsModel.error(CODE_TYPES.ERROR_NO_VIP, '非店铺会员', vipInfo)
return method.apply(target, [context, { ...otherArgs, vipInfo, session }])
}
}
}
// 活动时间校验
export const activityTimeCheck = (target: any, name: string, descriptor: PropertyDescriptor) => {
const method = descriptor.value
descriptor.value = async function (...args: any[]) {
const [context, otherArgs = {}] = args
const { activityId } = context.data
if (!activityId) return resultsModel.error(CODE_TYPES.PARAMS_ERROR, `缺少活动id`)
const baseService = new BaseService(context)
// 活动基本情况
const activityInfo = await baseService.getBaseInfo(activityId)
// 活动不存在
if (!activityInfo) {
return resultsModel.error(CODE_TYPES.ERROR_NO_ACTIVITY)
}
const { startTime, endTime } = activityInfo
const currentTime = Date.now()
if (currentTime < startTime) {
return resultsModel.error(CODE_TYPES.ERROR_ACTIVITY_NOSTART, `活动未开始`)
}
if (currentTime > endTime) {
return resultsModel.error(CODE_TYPES.ERROR_ACTIVITY_OVER, `活动已结束`)
}
return method.apply(target, [context, { ...otherArgs, activityInfo }])
}
}
/** @format */
export * from './check'
export * from './services'
export * from './noCatch'
/** @format */
export const noCatch = (target: any, name: string, descriptor: PropertyDescriptor) => {
const method = descriptor.value
descriptor.value = async function (...args: any[]) {
const [context, otherArgs = {}] = args
return method.apply(this, [context, { ...otherArgs, noCatch: true }])
}
}
/** @format */
import { UserService } from '../service'
import { getSellerSession, logFn, recordErrorLog } from '../utils'
import { resultsModel } from '../sdk'
import { CODE_TYPES } from '../constants'
async function initBaseInfo(context: IContext<IParams>, baseInfos: IControllerInfos) {
const userService = new UserService(context)
if (!baseInfos.userInfo) {
const userInfo = await userService.getUserInfo()
baseInfos.userInfo = userInfo
}
if (!baseInfos.session) {
const { session, userNick } = await getSellerSession(context)
baseInfos.session = session
baseInfos.activityUserNick = userNick
}
if (!baseInfos.vipInfo) {
const vipInfo = await userService.getShopVip(baseInfos.session)
baseInfos.vipInfo = vipInfo
}
return baseInfos
}
// 注入服务
export const services = (services: any[]) => {
return (target: Object, name: string, descriptor: PropertyDescriptor) => {
const method = descriptor.value
descriptor.value = async function (...args: any[]) {
let [context, otherArgs = {}] = args
const servicesInstance = services.map(v => new v(context))
const baseInfos: IControllerInfos = await initBaseInfo(context, otherArgs)
// 默认全局try catch 如果有noCatch参数则直接执行
if (baseInfos.noCatch) {
delete baseInfos.noCatch
return method.apply(target, [context, baseInfos, servicesInstance])
}
let ret: IResult<any>
try {
logFn(context)
ret = await method.apply(target, [context, baseInfos, servicesInstance])
} catch (error) {
console.log('error', error)
await recordErrorLog(context, baseInfos, error.toString(), error.stack)
ret = resultsModel.error(CODE_TYPES.SYSTEM_ERROR)
}
return ret
}
}
}
/** @format */
// import { exportHandlers } from './utils'
import UserController from './controller/user.controller'
import TaskController from './controller/task.controller'
import BaseController from './controller/base.controller'
import AwardsController from './controller/awards.controller'
import ShareController from './controller/share.controller'
import StatController from './controller/stat.controller'
const { login, getVipInfo } = new UserController()
const {
getTaskList,
receiveTaskRewards,
getCollectGoodsList, // 获取收藏商品列表,包含收藏状态
doFollowTask,
doJumpLinkTask,
doBrowseGoodsTask,
doCollectGoodsTask,
doExchangeCreditsTask
} = new TaskController()
const { getActivityBaseInfoById, getItemListByItemIds } = new BaseController()
const { getMyPrizeList, receiveObjectPrize, receiveEnamePrize, drawLotteryPrize } = new AwardsController()
const { doHelp } = new ShareController()
const { getStats } = new StatController()
export default {
login,
getVipInfo,
getTaskList,
receiveTaskRewards,
getActivityBaseInfoById,
getMyPrizeList,
receiveObjectPrize,
receiveEnamePrize,
doHelp,
getStats
}
/** @format */
import Utils from 'taobao-mini-sdk/lib/utils/index'
import { BaseDao as CloudBaseDao } from 'taobao-mini-sdk/lib/dao/base.dao'
import TBAPI from 'taobao-mini-sdk/lib/service/TBAPI'
let MockConfig = require('../mockServer/sdk')
const {
DEFAULT_CODE_TYPES,
dateFormatter: cloudDateFormatter,
transformBeijingDate: cloudTransformBeijingDate,
getStartTimestamp,
getEndTimestamp,
ResultsModel
} = Utils
const resultsModel = new ResultsModel()
let env = process.argv[2]
console.log(`env`, env)
export const TBAPIS: typeof TBAPI = env === 'mock' ? MockConfig.TBAPIS : TBAPI
export const BaseDao = env === 'mock' ? MockConfig.BaseDao : CloudBaseDao
export const transformBeijingDate: typeof Utils.transformBeijingDate =
env === 'mock' ? MockConfig.transformBeijingDate : cloudTransformBeijingDate
export const dateFormatter: typeof Utils.dateFormatter = env === 'mock' ? MockConfig.dateFormatter : cloudDateFormatter
export { DEFAULT_CODE_TYPES, resultsModel, getStartTimestamp, getEndTimestamp }
/**
* 访问明细
*
* @format
*/
import { BaseDao } from '../sdk'
import { getToday } from '../utils'
import { ACCESS_DB_NAME } from '../db'
export default class UserAccessService {
context: IContext<IParams>
accessdao: IBaseDao
constructor(context: IContext<IParams>) {
this.context = context
this.accessdao = new BaseDao(context, ACCESS_DB_NAME)
}
/**
* 增加访问记录
* @param {是否关注店铺} isFollow
*/
async addAccess(isFollow: boolean, isVip: boolean) {
let { openId, data } = this.context
let { activityId, userNick, avatar, inviteId } = data
return await this.accessdao.insertOne({
openId,
activityId,
userNick,
avatar,
isReceiveShare: !!inviteId,
inviteId,
isFollow,
isVip,
accessTime: Date.now(),
createTime: Date.now(),
updateTime: Date.now(),
createDay: getToday()
})
}
async getAccessCount() {
let { openId, data } = this.context
let { activityId } = data
return await this.accessdao.count({
openId,
activityId
})
}
}
/**
* 奖励
*
* @format
*/
import { BaseDao } from '../sdk'
import UserService from './user.service'
import { CODE_TYPES, DRAW_STATUS, PRIZE_TYPE, ACTIVITY_STATUS, DELETE_STATUS, SWICH_TOCK } from '../constants'
import { AWARDS_DB_NAME, PRIZE_CONFIG_DB_NAME } from '../db'
import { sendTBAward, getSellerSession, rand, signFigures } from '../utils'
export default class AwardsService extends UserService {
awardsdao: IBaseDao
activityprizedao: IBaseDao
constructor(context: IContext<IParams>) {
super(context)
this.awardsdao = new BaseDao(context, AWARDS_DB_NAME)
this.activityprizedao = new BaseDao(context, PRIZE_CONFIG_DB_NAME)
}
// 根据奖品Id扣库存, 扣库存成功返回为1
async reduceStock(_id: string) {
let result = await this.activityprizedao.findOne({ _id, deleteStatus: ACTIVITY_STATUS.NORMAL })
// 奖品不存在
if (!result) {
return CODE_TYPES.ERROR_NO_PRIZE
}
let { switchStock, stock, useStock } = result
// 若不限制库存
if (switchStock === SWICH_TOCK.NO_LIMIT) {
return 1
}
// 若库存不足
if (useStock >= stock) {
return CODE_TYPES.ERROR_NO_STOCK
}
try {
return await this.activityprizedao.update(
{
_id,
$where: 'this.useStock < this.stock'
},
{
$inc: {
useStock: +1
}
}
)
} catch (e) {
console.log(`扣库存失败:`, e)
return CODE_TYPES.SYSTEM_ERROR
}
}
/**
* 插入奖品记录
* @param {*} award
*/
async addAward(award: IAwards) {
try {
return await this.awardsdao.insertOne({
...award,
createTime: Date.now(),
updateTime: Date.now()
})
} catch (e) {
console.log(`插入中奖记录错误:`, e)
return CODE_TYPES.SYSTEM_ERROR
}
}
/**
* 发放奖品
* @param {*} document
*/
async sendAward(document: IAwards) {
let { session } = await getSellerSession(this.context)
// 发放淘宝权益
let result = await sendTBAward(this.context, session, document)
//@ts-ignore
if (result.code) {
return result
}
let { _id } = document
// 更新结果
let update = await this.awardsdao.update(
{ _id },
{
$set: {
drawStatus: document.drawStatus,
remark: document.remark,
updateTime: Date.now()
}
}
)
console.log(`更新奖品状态`, update, document)
return document
}
/**
* 我的奖品
* @param {*} param0
*/
async getMyPrizeList({ openId, activityId }: { openId: string; activityId: string }): Promise<Array<IAwards>> {
// 获取奖品领取过期时间
let { awardReceiveExpiredTime } = await this.getBaseInfo(activityId)
let myprizeList = await this.awardsdao.find(
{ openId, activityId },
{
sort: {
createTime: -1
}
}
)
// 若有过期时间,且已过期
if (awardReceiveExpiredTime) {
let currentTime = Date.now()
myprizeList = myprizeList.map((v: { drawStatus: number; remark: string; expiredTime: any }) => {
if (currentTime > awardReceiveExpiredTime) {
if ([DRAW_STATUS.WAITAWARD, DRAW_STATUS.RETRY].includes(v.drawStatus)) {
v.drawStatus = DRAW_STATUS.EXPIRED
v.remark = `奖品已过期`
}
}
v.expiredTime = awardReceiveExpiredTime
})
}
return myprizeList
}
// 领取实物
async recieveObjectPrize(
_id: string,
{
activityId,
province,
city,
area,
addressdetail,
name,
phone
}: {
activityId: string
province: string
city: string
area: string
addressdetail: string
name: string
phone: string | number
}
) {
// 若有过期时间,且已过期
let { awardReceiveExpiredTime } = await this.getBaseInfo(activityId)
if (awardReceiveExpiredTime && Date.now() > awardReceiveExpiredTime) {
return CODE_TYPES.ERROR_PRIZE_EXPIRED
}
let award = await this.awardsdao.findOne({ _id })
console.log(`receiveObject-award`, award)
// 奖品不存在
if (!award) {
return CODE_TYPES.ERROR_NO_PRIZE
}
// 已领取
if (award.drawStatus === DRAW_STATUS.SUCCESS) {
return CODE_TYPES.ERROR_RECEIVE_PRIZE
}
// 不是实物,非法操作
if (award.type !== PRIZE_TYPE.OBJECT) {
return CODE_TYPES.ERROR_FORBIDDEN_OPE
}
try {
let result = await this.awardsdao.update(
{ _id },
{
$set: {
receiveName: name,
phone,
drawStatus: DRAW_STATUS.SUCCESS,
province,
city,
area,
addressdetail,
receiveTime: Date.now(),
updateTime: Date.now()
}
}
)
return true
} catch (e) {
console.log(`领取实物错误:`, e)
return CODE_TYPES.SYSTEM_ERROR
}
}
// 发放淘宝权益(奖品数据已插入到awards_info表,且状态drawStatus 为1或者6)
async recieveEnamePrize(_id: string, activityId: string) {
// 若有过期时间,且已过期
let { awardReceiveExpiredTime } = await this.getBaseInfo(activityId)
if (awardReceiveExpiredTime && Date.now() > awardReceiveExpiredTime) {
return CODE_TYPES.ERROR_PRIZE_EXPIRED
}
let result: {} = {}
let award = await this.awardsdao.findOne({ _id })
// 奖品不存在
if (!award) {
return CODE_TYPES.ERROR_NO_PRIZE
}
// 已领取
if (award.drawStatus === DRAW_STATUS.SUCCESS) {
return CODE_TYPES.ERROR_RECEIVE_PRIZE
}
console.log(`award.drawStatus`, award.drawStatus)
// 状态不是1,6
if (![DRAW_STATUS.WAITAWARD, DRAW_STATUS.RETRY].includes(award.drawStatus)) {
return CODE_TYPES.ERROR_FORBIDDEN_OPE
}
let { session } = await getSellerSession(this.context)
// 发放淘宝权益
result = await sendTBAward(this.context, session, award)
// 更新
await this.awardsdao.update(
{ _id },
{
$set: {
// @ts-ignore
drawStatus: result.drawStatus,
// @ts-ignore
remark: result.remark,
updateTime: Date.now()
}
}
)
return result
}
// 根据查询条件获取奖品配置
async getPrizeConfig(query: { activityId: string; [queryParam: string]: any }): Promise<Array<IActivityPrize>> {
return this.activityprizedao.find({
deleteStatus: DELETE_STATUS.NORMAL,
...query
})
}
// 根据概率抽取奖品
async getPrizeByProbability(prizes: Array<IActivityPrize>): Promise<IActivityPrize> {
// 获取 1-10000的随机数
const probability = rand(10000)
return prizes.find(v => probability <= v.properiodto && probability >= v.properiodfrom)
}
/**
* 获取活动配置项奖品
* @param {string} _id
*/
async getActivityPrizeById(_id: string) {
return await this.activityprizedao.findOne(
{ _id, deleteStatus: ACTIVITY_STATUS.NORMAL },
{
sort: {
index: 1
}
}
)
}
}
/**
* 基本信息
*
* @format
*/
import { BaseDao, TBAPIS } from '../sdk'
import { ACTIVITY_CONFIG_DB_NAME } from '../db'
import { ACTIVITY_STATUS } from '../constants'
export default class BaseService {
context: IContext<any>
activitydao: IBaseDao
constructor(context: IContext<any>) {
this.context = context
this.activitydao = new BaseDao(context, ACTIVITY_CONFIG_DB_NAME)
}
/**
* @desc 活动基本信息
* @param {活动id} activityId
* @returns 返回活动详情,若不存在活动,返回为null
*/
async getBaseInfo(activityId: string): Promise<IActivityInfo> {
return await this.activitydao.findOne({ _id: activityId, deleteStatus: ACTIVITY_STATUS.NORMAL })
}
/**
*
* 根据itemIds获取商品列表
*
* @param {string} itemIds
* @param {string} session
* @return {Array}
* @memberof BaseService
*/
async getItemListByIds(itemIds: string, session: string): Promise<Array<ITaoBaoItems>> {
const GOODSINFO =
'detail_url,approve_status,num_iid,title,nick,type,cid,pic_url,num,props,valid_thru,list_time,desc,price,has_discount,has_invoice,has_warranty,has_showcase,modified,delist_time,postage_id,seller_cids,outer_id,sold_quantity'
const result = await TBAPIS.getItemListByItemIds(this.context, session, itemIds, { fields: GOODSINFO })
const items = result?.items?.item || []
const list = items.map(
(v: { num_iid: string; title: string; price: string; detail_url: string; pic_url: string; desc: string }) => {
return {
itemId: v.num_iid,
name: v.title,
price: v.price,
url: v.detail_url,
image: v.pic_url,
desc: v.desc
}
}
)
return list
}
}
/** @format */
export { default as AccessService } from './access.service'
export { default as BaseService } from './base.service'
export { default as UserService } from './user.service'
export { default as AwardsService } from './awards.service'
export { default as TaskService } from './task.service'
/**
* 任务相关方法
*
* @format
*/
import { merge } from 'lodash'
import UserService from './user.service'
import { getToday, getUserOrderlist, logger } from '../utils'
import { TASK_RATE_TYPE, TASK_STATUS } from '../constants'
export interface ITaskInfo {
taskType?: string // 任务类型
url?: string // 链接地址
rewards: number // 任务奖励
itemIds?: string // 商品配置ids 商品相关任务返回
todayCompleteTimes?: number // 今日完成次数
completeTimes?: number // 总共完成次数
taskRateType: number // 任务频率
times?: number // 任务每日限制次数
waitReceive?: number // 待领取次数
title: string // 任务文案
status: number // 任务状态 1未完成 2 待领取 3 已完成
}
export default class TaskService extends UserService {
constructor(context: IContext<IParams>) {
super(context)
}
initVipTask(userInfo: IUserInfo, vipInfo: IVipInfo, tasks: ITasks): ITaskInfo {
const { remainTimes } = userInfo
// 后台配置奖励
const {
beMembership: { value }
} = tasks
return {
taskType: `member`,
title: `加入会员`,
url: vipInfo.url,
rewards: value,
taskRateType: TASK_RATE_TYPE.FOREVER,
waitReceive: remainTimes.member,
status: this.setTaskStatus(userInfo, 'member', TASK_RATE_TYPE.FOREVER)
}
}
// 初始化下单任务
initOrderGoodsTask(userInfo: IUserInfo, tasks: ITasks): ITaskInfo {
const {
orderGoods: { value, itemIds, taskRateType, times }
} = tasks
const { remainTimes } = userInfo
const { todayCompleteTimes } = this.getTodayCompleteTask('orderGoods', userInfo)
const orderGoodsCompleteList: object[] = this.getCompleteTaskByUserTaskInfo('orderGoods', userInfo)
let orderTask: ITaskInfo = {
taskType: `orderGoods`,
title: `下单商品`,
itemIds,
rewards: value,
taskRateType,
times,
todayCompleteTimes,
completeTimes: orderGoodsCompleteList.length,
status: this.setTaskStatus(userInfo, 'orderGoods', taskRateType, times),
waitReceive: remainTimes.orderGoods
}
return orderTask
}
// 初始化浏览商品任务
initBrowseGoodsTask(userInfo: IUserInfo, tasks: ITasks): ITaskInfo {
const {
browseGoods: { value, itemIds, taskRateType, times }
} = tasks
const { remainTimes } = userInfo
const { todayCompleteTimes } = this.getTodayCompleteTask('browseGoods', userInfo)
const browseGoodsCompleteList: object[] = this.getCompleteTaskByUserTaskInfo('browseGoods', userInfo)
let orderTask: ITaskInfo = {
taskType: `browseGoods`,
title: `浏览商品`,
itemIds,
times,
rewards: value,
waitReceive: remainTimes.browseGoods,
todayCompleteTimes,
completeTimes: browseGoodsCompleteList.length,
status: this.setTaskStatus(userInfo, 'browseGoods', taskRateType, times),
taskRateType
}
return orderTask
}
// 初始化收藏商品任务
initCollectGoodsTask(userInfo: IUserInfo, tasks: ITasks): ITaskInfo {
const { value, itemIds, taskRateType, times } = tasks.collectGoods
const { remainTimes } = userInfo
const { todayCompleteTimes } = this.getTodayCompleteTask('collectGoods', userInfo)
const completeList: object[] = this.getCompleteTaskByUserTaskInfo('collectGoods', userInfo)
let orderTask: ITaskInfo = {
taskType: `collectGoods`,
title: `收藏商品`,
itemIds,
times,
rewards: value,
waitReceive: remainTimes.collectGoods,
todayCompleteTimes,
completeTimes: completeList.length,
taskRateType,
status: this.setTaskStatus(userInfo, 'collectGoods', taskRateType, times)
}
return orderTask
}
// 初始化跳转任务
initJumpLinkTask(userInfo: IUserInfo, tasks: ITasks): ITaskInfo {
const { value, link, taskRateType, times } = tasks.jumpLink
const { remainTimes } = userInfo
const { todayCompleteTimes } = this.getTodayCompleteTask('jumpLink', userInfo)
const completeList: object[] = this.getCompleteTaskByUserTaskInfo('jumpLink', userInfo)
let orderTask: ITaskInfo = {
taskType: `jumpLink`,
title: `跳转链接`,
url: link,
times,
rewards: value,
waitReceive: remainTimes.jumpLink,
todayCompleteTimes,
completeTimes: completeList.length,
taskRateType,
status: this.setTaskStatus(userInfo, 'jumpLink', taskRateType, times)
}
return orderTask
}
// 初始化邀请任务
initInvitesTask(userInfo: IUserInfo, tasks: ITasks): ITaskInfo {
const {
inviteFriends: { value, taskRateType, times }
} = tasks
const { remainTimes } = userInfo
const { todayCompleteTimes } = this.getTodayCompleteTask('invites', userInfo)
const invitesCompleteList: object[] = this.getCompleteTaskByUserTaskInfo('invites', userInfo)
let orderTask: ITaskInfo = {
taskType: `invites`,
title: `邀请`,
rewards: value,
taskRateType,
times,
todayCompleteTimes,
completeTimes: invitesCompleteList.length,
waitReceive: remainTimes.invites,
status: this.setTaskStatus(userInfo, 'invites', taskRateType, times)
}
return orderTask
}
// 关注店铺
initFollowTask(userInfo: IUserInfo, tasks: ITasks): ITaskInfo {
const {
attentionStore: { value }
} = tasks
const { remainTimes } = userInfo
const followCompleteList: object[] = this.getCompleteTaskByUserTaskInfo('follow', userInfo)
return {
taskType: `follow`,
title: `关注店铺`,
rewards: value,
taskRateType: TASK_RATE_TYPE.FOREVER,
waitReceive: remainTimes.follow,
completeTimes: followCompleteList.length,
status: this.setTaskStatus(userInfo, 'follow', TASK_RATE_TYPE.FOREVER)
}
}
// 初始化签到任务
initSignTask(userInfo: IUserInfo, tasks: ITasks): ITaskInfo {
const {
sign: { value }
} = tasks
const { remainTimes } = userInfo
const completeList: object[] = this.getCompleteTaskByUserTaskInfo('sign', userInfo)
const { todayCompleteTimes } = this.getTodayCompleteTask('sign', userInfo)
return {
taskType: `sign`,
title: `每日签到`,
rewards: value,
times: 1,
taskRateType: TASK_RATE_TYPE.EVERYDAY,
waitReceive: remainTimes.sign,
completeTimes: completeList.length,
todayCompleteTimes,
status: this.setTaskStatus(userInfo, 'sign', TASK_RATE_TYPE.EVERYDAY)
}
}
// 积分兑换 /固定为每日限制
initExchangeCreditsTask(userInfo: IUserInfo, tasks: ITasks): ITaskInfo {
const {
exchangeCredits: { value, times }
} = tasks
const { remainTimes, taskInfo } = userInfo
const { todayCompleteTimes } = this.getTodayCompleteTask('exchangeCredits', userInfo)
return {
taskType: `exchangeCredits`,
title: `积分兑换`,
rewards: value,
times,
taskRateType: TASK_RATE_TYPE.EVERYDAY,
todayCompleteTimes,
waitReceive: remainTimes.exchangeCredits,
status: this.setTaskStatus(userInfo, 'exchangeCredits', TASK_RATE_TYPE.EVERYDAY)
}
}
// 根据会员状态更新
updateVipTask(userInfo: IUserInfo, vipInfo: IVipInfo, tasks: ITasks) {
let { member, remainTimes, taskInfo } = userInfo
const { newMember } = member
const today = getToday()
const isNewVip = this.checkNewVipStatus(userInfo, vipInfo)
const {
beMembership: { value }
} = tasks
let projection = {
$set: {},
$inc: {},
$push: {}
}
if (isNewVip && !newMember) {
member = this.setNewVipUserData(member)
// @ts-ignore
projection.$set.member = member
projection.$inc['remainTimes.member'] = +value
projection.$push[`taskInfo.${today}.member`] = {
creatTime: Date.now()
}
}
return projection
}
// 根据下单下单记录,更新状态
async updateOrderGoodsTask(userInfo: IUserInfo, tasks: ITasks, activityStartTime: number, session?: string) {
const {
orderGoods: { value, itemIds, taskRateType, times }
} = tasks
const orderGoodsCompleteList: object[] = this.getCompleteTaskByUserTaskInfo('orderGoods', userInfo)
const { todayCompleteTimes } = this.getTodayCompleteTask('orderGoods', userInfo)
// 永久任务且已完成
if (taskRateType === TASK_RATE_TYPE.FOREVER && orderGoodsCompleteList.length) {
return {}
}
// 每日限制完成且完成次数达到限制
const today = getToday()
if (taskRateType === TASK_RATE_TYPE.EVERYDAY && todayCompleteTimes >= times) {
return {}
}
const orderResult = await getUserOrderlist(
this.context,
//@ts-ignore
activityStartTime || Date.now(),
Date.now(),
session
)
const itemIdsArr = itemIds.split(',').map(v => +v)
let projection = {
$inc: {
'remainTimes.orderGoods': 0
},
$pushAll: {}
}
let targetOrders = []
orderResult.forEach(v => {
// @ts-ignore
// 商品订单包含目标商品 且orderId为新订单
if (itemIdsArr.includes(v.itemId) && !orderGoodsCompleteList.some(order => order.orderId === v.orderId)) {
projection.$inc['remainTimes.orderGoods'] += +value
targetOrders.push({
itemId: v.itemId,
orderId: v.orderId,
payTime: v.payTime,
createTime: Date.now()
})
}
if (targetOrders.length) {
projection.$pushAll[`taskInfo.${today}.orderGoods`] = targetOrders
}
})
return projection
}
// 更新签到任务数据
updateSignTask(userInfo: IUserInfo, tasks: ITasks) {
// 获取签到奖励
const {
sign: { value }
} = tasks || {}
const { todayCompleteTimes } = this.getTodayCompleteTask('sign', userInfo)
const today = getToday()
logger(todayCompleteTimes)
// 今天没有有完成记录
return todayCompleteTimes === 0
? {
$inc: {
'remainTimes.sign': value
},
$push: {
[`taskInfo.${today}.sign`]: { createTime: Date.now() }
}
}
: {}
}
/**
*更新关注店铺任务状态
*
* @param {IUserInfo} userInfo
* @param {IActivityInfo} activityInfo
* @returns
* @memberof TaskService
*/
async updateFollowTask(userInfo: IUserInfo, activityInfo: IActivityInfo) {
const today = getToday()
let { _id, taskInfo = {}, follow } = userInfo
// 获取活动基本信息
const { tasks } = activityInfo
// 获取关注店铺奖励
const {
attentionStore: { value }
} = tasks || {}
// 更新follow信息
const followInfo: IFollowInfo = this.setNewFollowUserData(follow)
// 增加待领取次数
return await this.updateUser(_id, {
$set: {
follow: followInfo,
taskInfo
},
$inc: {
'remainTimes.follow': value
},
$push: {
[`taskInfo.${today}.follow`]: {
creatTime: Date.now()
}
}
})
}
/**
*
* 根据用户和任务完成情况,设置任务状态
*
* @param {IUserInfo} useInfo
* @param {string} taskType
* @param {number} taskRateType
* @param {number} [limitTimesEverday] 每天限制次数 任务频率为每天的时候必填
* @return {taskTatus} 1未完成 2 待领取 3 已完成
* @memberof TaskService
*/
setTaskStatus(useInfo: IUserInfo, taskType: string, taskRateType: number, limitTimesEveryday?: number): number {
const waitReceive = useInfo?.remainTimes?.[taskType] || 0
if (waitReceive) return TASK_STATUS.WAIT_RECEIVE
// 当天的完成次数
const { todayCompleteTimes } = this.getTodayCompleteTask(taskType, useInfo)
// 总共的完成次数
const completeTimes = this.getCompleteTaskByUserTaskInfo(taskType, useInfo).length
switch (taskRateType) {
case TASK_RATE_TYPE.FOREVER:
return completeTimes > 0 ? TASK_STATUS.DONE : TASK_STATUS.WAIT_DO
break
case TASK_RATE_TYPE.EVERYDAY:
return todayCompleteTimes >= limitTimesEveryday ? TASK_STATUS.DONE : TASK_STATUS.WAIT_DO
break
case TASK_RATE_TYPE.NOLIMIT:
return TASK_STATUS.WAIT_DO
break
}
}
/**
*
* 获取任务今天完成的次数
*
* @param {string} taskType 任务类型
* @param {IUserInfo} userInfo 用户信息
* @returns {number} todayTimes 今日任务完成次数 todayTaskInfo 今日对应任务完成详情
* @memberof TaskService
*/
getTodayCompleteTask(taskType: string, userInfo: IUserInfo) {
const today = getToday()
return {
todayCompleteTimes: userInfo?.taskInfo?.[today]?.[taskType]?.length || 0,
todayTaskInfo: userInfo?.taskInfo?.[today]?.[taskType] || []
}
}
/**
* 根据任务类型获取任务完成情况
*
* @param {IUserInfo} userInfo
* @param {string} taskType
* @returns {array}
* @memberof TaskService
*/
getCompleteTaskByUserTaskInfo(taskType: string, userInfo: IUserInfo) {
const { taskInfo = {} } = userInfo
let targetTaskList = []
Object.keys(taskInfo).forEach(day => {
if (taskInfo[day]?.[taskType]) {
const dayTaskInfo = Array.isArray(taskInfo[day]?.[taskType])
? taskInfo[day]?.[taskType]
: [taskInfo[day]?.[taskType]]
targetTaskList = [...targetTaskList, ...dayTaskInfo]
}
})
return targetTaskList
}
/**
*根据任务类型更新任务待领取次数和任务记录
*
* @param {string} taskType
* @param {number} rewards
* @param {IUserInfo} userInfo
* @param {object} [customRecord]
* @returns {boolean}
* @memberof TaskService
*/
async updateUserTaskRecord(
taskType: string,
rewards: number,
userInfo: IUserInfo,
customRecord?: object
): Promise<boolean> {
const { _id } = userInfo
const today = getToday()
const result = await this.updateUser(_id, {
$inc: {
[`remainTimes.${taskType}`]: rewards
},
$push: {
[`taskInfo.${today}.${taskType}`]: { createTime: Date.now(), ...customRecord }
}
})
return result === 1
}
/**
*
* 更新user表中,任务相关字段
*
* @param {string} id
* @param {object[]} needUpdateKeysArray
* @param {IUserInfo} userInfo
* @returns {IUserInfo | boolean} userInfo
* @memberof TaskService
*/
async updateTasks(id: string, needUpdateKeysArray: object[], userInfo: IUserInfo): Promise<false | IUserInfo> {
logger(needUpdateKeysArray)
const updateKeys: object = merge({}, ...needUpdateKeysArray)
logger(updateKeys)
await this.updateUser(id, updateKeys)
return await this.getUserInfo()
}
}
/**
* 用户相关方法
*
* @format
*/
import { BaseDao, TBAPIS } from '../sdk'
import BaseService from './base.service'
import { USER_DB_NAME } from '../db'
import { getToday, isUseVipMock } from '../utils'
import { VIP_MOCK } from '../vipMock'
class UserService extends BaseService {
userdao: IBaseDao
constructor(context: IContext<IParams>) {
super(context)
this.userdao = new BaseDao(context, USER_DB_NAME)
}
/**
* @desc 获取当前打开活动的用户详情
* @returns 若用户不存在,返回null; 用户存在,返回用户信息(object对象)
*/
async getUserInfo() {
let { openId, data } = this.context
let { activityId } = data
let record = await this.userdao.findOne({ openId, activityId })
return record
}
/**
* @desc 根据inviteId获取用户详情
* @desc 常用于助力分享码为用户openId, 被邀请人打开活动助力时需要获取邀请人的用户详情
* @param {邀请人的openId} inviteId
* @returns 若用户不存在,返回null; 用户存在,返回用户信息(object对象)
*/
async getUserInfoByOpenId(inviteId: string) {
let { activityId } = this.context.data
let record = await this.userdao.findOne({ openId: inviteId, activityId })
return record
}
/**
* @desc 获取是否是会员
* @param {调用淘宝接口的session} session
* @returns {isVip: boolean(是否是会员), url: string(入会链接) }
*/
async getShopVip(session: string, activityUserNick: string = '', callbackUrl: string = ''): Promise<IVipInfo> {
console.log(activityUserNick, 'activityUserNick')
if (isUseVipMock(this.context, activityUserNick)) {
return VIP_MOCK
}
const { activityId } = this.context.data
let result = {
result: {
member_info: ''
}
}
let shopUrl = {
result: {
result: ''
}
}
const cbUrl: string = `${callbackUrl}&query=activityId%3D${activityId}`
try {
result = await TBAPIS.queryVipinfo(this.context, session)
shopUrl = await TBAPIS.getShopVipUrl(
this.context,
session,
{
source: 'isvapp',
entrance: 'duiba'
},
cbUrl
)
} catch (e) {
console.log(e)
}
console.log(`result, shopUrl`, result, shopUrl)
return {
isVip: !!(result.result && result.result.member_info),
url: shopUrl.result && shopUrl.result.result
}
}
/**
* 初始化用户数据
*
* @param {IVipInfo} vipInfo
* @param {IActivityInfo} activityInfo
* @returns
* @memberof UserService
*/
async initUserData(vipInfo: IVipInfo, activityInfo: IActivityInfo) {
const { openId, data } = this.context
const { activityId, isFollow, avatar, inviteId, userNick } = data
const today = getToday()
console.log(`----------${today}----------`, today)
const { tasks } = activityInfo
const { attentionStore, beMembership } = tasks
const user: IUserInfo = {
activityId,
avatar,
inviteId,
userNick,
openId,
// 待领取次数初始化, 根据需自定义添加
remainTimes: {
follow: isFollow ? attentionStore.value : 0,
member: vipInfo.isVip ? beMembership.value : 0
},
member: {
flag: !!vipInfo.isVip
},
follow: {
flag: !!isFollow
},
login: {
[today]: 1
},
taskInfo: {
[today]: {}
},
createTime: Date.now(),
createDay: today,
updateTime: Date.now()
}
return await this.userdao.insertOne(user)
}
async updateUserData(vipInfo: IVipInfo, userInfo: IUserInfo, activityInfo: IActivityInfo) {
const { data } = this.context
const { isFollow } = data
const today = getToday()
let projection = {
$set: {
updateTime: Date.now()
},
$push: {},
$inc: {
[`login.${today}`]: 1
}
}
const { tasks } = activityInfo
const { attentionStore, beMembership } = tasks
// 老用户
// 之前进入活动未关注,现在进入关注,则视为新关注店铺用户
const followBefore = userInfo.follow.flag
const followNow = isFollow
if (!followBefore && followNow && !userInfo.follow.newFollow) {
// @ts-ignore
projection.$set.follow = this.setNewFollowUserData(userInfo.follow)
projection.$push[`taskInfo.${today}.follow`] = { createTime: Date.now() }
projection.$inc[`remainTimes.follow`] = attentionStore.value
}
// 之前进入活动非会员,现在进入会员,则视为新会员用户
const isNewVip = this.checkNewVipStatus(userInfo, vipInfo)
if (isNewVip && !userInfo.member.newMember) {
// @ts-ignore
projection.$set.member = this.setNewVipUserData(userInfo.member)
projection.$push[`taskInfo.${today}.member`] = { createTime: Date.now() }
projection.$inc[`remainTimes.member`] = beMembership.value
}
await this.updateUser(userInfo._id, projection)
}
/**
* @desc 更新用户表
* @param {用户的主键id} _id
* @param {更新的对象} document
* @returns 若更新成功,返回为1; 若更新失败,返回为 0 或系统直接报错
*/
async updateUser(_id: string, projection: object) {
projection['$set'] = projection['$set'] || {}
projection['$set'].updateTime = Date.now()
console.log(projection)
return await this.userdao.update({ _id }, projection)
}
/**
* @desc 根据用户主键id查找用户详情
* @param {用户的主键id} _id
* @returns 若用户不存在,返回null; 用户存在,返回用户信息(object对象)
*/
async getUserInfoById(_id: string) {
return await this.userdao.findOne({ _id })
}
/**
*判断是否新会员
*
* @param {IUserInfo} userInfo
* @param {IVipInfo} vipInfo
* @returns {boolean}
* @memberof UserService
*/
checkNewVipStatus(userInfo: IUserInfo, vipInfo: IVipInfo): boolean {
const {
member: { flag }
} = userInfo
const { isVip } = vipInfo
return !flag && isVip
}
setNewVipUserData(member: IMemberInfo): IMemberInfo {
const today = getToday()
return {
...member,
newMember: true,
bememberTime: Date.now(),
bememberDay: today
}
}
setNewFollowUserData(follow: IFollowInfo): IFollowInfo {
const today = getToday()
return {
...follow,
newFollow: true,
followTime: Date.now(),
followDay: today
}
}
}
export default UserService
/** @format */
interface IActivityInfo {
_id: string
openId: string
rule: string
startTime: number
endTime: number
title: string
deleteStatus: number
openPrizeStatus?: number
remark?: string
createTime: number
updateTime: number
awardReceiveExpiredTime?: number
tasks?: ITasks
}
interface ITasks {
attentionStore?: ITaskConfig
beMembership?: ITaskConfig
sign?: ITaskConfig
exchangeCredits?: ITaskConfig
browseGoods?: ITaskConfig
orderGoods?: ITaskConfig
collectGoods?: ITaskConfig
jumpLink?: ITaskConfig
inviteFriends?: ITaskConfig
}
interface ITaskConfig {
title?: string // 任务标题
value: number // 任奖奖励
times?: number // 任务为每日限次次数值
taskRateType?: number // 任务频率类型
link?: string // 任务链接
itemIds?: string // 任务商品
checked?: boolean // 是否选中(B端需勾选时)
}
interface IActivityPrize {
_id?: string
activityId?: string
ename?: string
prizeDataType: number
type: number
image: string
name: string
probability?: string | number
properiodto: number
properiodfrom: number
lockStatus?: number
switchStock?: number
rank?: string | number
credits?: string | number
useUrl?: string
stock: number
useStock: number
openId?: string
deleteStatus: number
createTime?: number
updateTime?: number
}
/** @format */
interface IAwards {
_id?: string
openId: string
activityId: string
prizeId: string
ename?: string
credits?: number
type: number
image: string
name: string
drawStatus: number
receiveName?: string
userNick?: string
phone?: string
address?: string
provice?: string
city?: string
area?: string
receiveTime?: number
shipStatus?: number
shipCompany?: string
shipNum?: string | number
remark: string
createTime?: number
updateTime?: number
awardsType?: string
}
/** @format */
interface IContext<T> {
appkey: string
sourceAppKey: string
userNick?: string
mixNick: string
miniappId: string
sourceMiniAppId: string
accessToken: string
openId: string
env: string
traceId: string
fcName: string
handler: string
appOwnerOpenId: string
fcInvokeId: string
cloud: any
data: T
}
interface IParams {
[params: string]: any
}
interface IControllerInfos {
userInfo: IUserInfo
vipInfo: IVipInfo
activityInfo?: IActivityInfo
session: string
activityUserNick: string // 活动创建账号昵称
noCatch?: boolean
}
interface IVipInfo {
isVip: boolean
url?: string
}
interface IBaseDao {
dbName: string
db: object
constructor(context: any, dbName: string)
/**
* 查询一条数据
* @param query
* @param projection
*/
findOne(query: object, projection?: object): Promise<any>
/**
* 查询多条数据
* @param query
* @param projection
*/
find(query: object, projection?: object): Promise<any>
/**
* 插入单条数据
* @param document
*/
insertOne(document: object): Promise<any>
/**
* 插入多条数据
* @param documents 插入对象
*/
insertMany(documents: object[]): Promise<any>
/**
* 更新数据
* @param query
* @param options
*/
update(query: object, options?: object): Promise<any>
/**
* 删除多条数据
* @param filter
*/
delete(filter: object): Promise<any>
/**
* 获取条目数
* @param query
* @param options
*/
count(query: object, options?: object): Promise<any>
/**
* 聚合查询
* @param query
* @param options
*/
aggregate(aggregateOperation: object | any[]): Promise<any>
}
/** @format */
interface ITaoBaoItems {
itemId: string
name: string
price: string
url: string
image: string
desc: string
}
/** @format */
interface IErrorResult {
success: false
code: string
message?: string
data?: object[] | object | number[] | string[] | boolean | string
}
interface ISuccessResult<T> {
success: true
data?: T
}
interface ICodeType {
code: string
defaultMsg?: string
}
type IResult<T> = IErrorResult | ISuccessResult<T>
/** @format */
interface IUserInfo {
_id?: string
activityId: string
avatar: string
userNick: string
openId: string
createTime: number
updateTime: number
createDay?: string
inviteId?: string
member?: IMemberInfo
follow?: IFollowInfo
remainTimes?: IRemainTimesInfo
taskInfo?: object
login?: object
}
interface IRemainTimesInfo {
invites?: number
browseGoods?: number
joinGroup?: number
member?: number
follow?: number
orderGoods?: number
collectGoods?: number
exchangeCredits?: number
jumpLink?: number
sign?: number
}
interface IMemberInfo {
flag: boolean
newMember?: boolean
bememberTime?: number
bememberDay?: string
}
interface IFollowInfo {
flag: boolean
newFollow?: boolean
followTime?: number
followDay?: string
}
/** @format */
// 获取商家session
export * from './package/getSession'
// 获取当天时间进行format
export * from './package/getToday'
// 发放淘宝奖品(权益/积分)
export * from './package/sendTBAward'
// 通用并发接口
export * from './package/lockUpdate'
export * from './package/logger'
export * from './package/rand'
export * from './package/getUserOrderlist'
export * from './package/isUseVipMock'
export * from './package/exportHandlers'
/** @format */
// 遍历Controller中的方法, 暴露出来
export const exportHandlers = (controllers: any[]) => {
const handlersMapper = controllers
.map(controller => {
const controllerInstance = new controller()
const handlersKeys = Object.getOwnPropertyNames(Object.getPrototypeOf(controllerInstance)).filter(
v => v !== 'constructor'
)
return handlersKeys.reduce((prev, current) => {
return {
...prev,
[current]: controllerInstance[current]
}
}, {})
})
.reduce((prev, current) => {
return {
...current,
...prev
}
}, {})
return handlersMapper
}
/**
* 获取商家session
*
* @format
*/
import { SELLER_INFO_DB_NAME, ACTIVITY_CONFIG_DB_NAME } from '../../db'
import { BaseDao } from '../../sdk'
export const getSellerSession = async (context: IContext<IParams>, activityId?: string) => {
if (!activityId) {
activityId = context.data.activityId
}
let activitydao: IBaseDao = new BaseDao(context, ACTIVITY_CONFIG_DB_NAME)
let sellerdao: IBaseDao = new BaseDao(context, SELLER_INFO_DB_NAME)
let activityConfigResult = await activitydao.findOne({ _id: activityId })
if (!activityConfigResult) return {}
let result = await sellerdao.findOne({
openId: activityConfigResult.openId
})
// console.log(`getSellerSession`, result)
if (!result) return {}
return {
session: result.accessToken,
userNick: result.userNick
}
}
/** @format */
import { transformBeijingDate, dateFormatter } from '../../sdk'
// 获取今天的时间
export const getToday = () => {
console.log(transformBeijingDate(Date.now()))
return dateFormatter(transformBeijingDate(Date.now()), 'yyyy/MM/dd')
}
/**
* 用户购买记录查询
*
* @format
*/
import * as dayjs from 'dayjs'
import { dateFormatter, transformBeijingDate, TBAPIS } from '../../sdk'
import { getSellerSession } from './getSession'
import { TAOBAO_SUCCESS_ORDER_STATUS } from '../../constants'
export const getUserOrderlist = async (context, queryStartTime, queryEndTime?, session?: string) => {
try {
let results = []
let currentTime = Date.now()
// 开始时间以Math.max(当前时间倒推3个月,queryStartTime)
let lastUpdateTime = dayjs().add(-3, 'month').valueOf()
console.log(`lastUpdateTime`, lastUpdateTime)
// 若倒推的3个月时间小于传入的查询开始时间, 则以查询开始时间作为最后更新时间
if (lastUpdateTime < queryStartTime) {
lastUpdateTime = queryStartTime
}
if (!session) {
session = (await getSellerSession(context)).session
}
// 获取用户在lastUpdateTime ~ currentTime区间的购买情况
let params = {
startTime: dateFormatter(transformBeijingDate(lastUpdateTime)),
endTime: dateFormatter(transformBeijingDate(queryEndTime || currentTime)),
openId: context.openId,
session
}
let orderResult = await TBAPIS.getBuyerOrderList(context, params)
if (orderResult.total_results > 0) {
const { trade } = orderResult.trades
trade.forEach(i => {
if (TAOBAO_SUCCESS_ORDER_STATUS.includes(i.status)) {
i.orders.order.forEach(s => {
results.push({
payTime: i.pay_time,
itemId: s.num_iid,
time: i.created,
price: s.price,
orderId: s.oid,
img: s.pic_path,
title: s.title,
tId: i.tid
})
})
}
})
}
console.log(`已支付的订单列表`, results)
return results
} catch (e) {
console.log(`错误`, e)
return []
}
}
/** @format */
// 测试环境 duib2账户mock数据
export const isUseVipMock = (context: IContext<IParams>, userNick: string) => {
const isTestEnv = context.env === 'test'
const isDuibaAccount = userNick.startsWith('duiba2')
return isTestEnv && isDuibaAccount
}
/** @format */
import { CODE_TYPES } from '../../constants'
/**
* 并发更新
* @param {接收数组或对象} daoqueryArr : [{dao: userdao, query:{id:_id}}, {dao: activityprizedao, query: {id:_id}}]
* @param {*} fn
* @param {*} times
*/
export const lockUpdate = async (daoqueryArr, fn, times = 5) => {
if (typeof daoqueryArr !== 'object' && !Array.isArray(daoqueryArr)) {
console.log(`lockUpdate 参数错误`)
return false
}
if (typeof daoqueryArr === 'object') {
daoqueryArr = [daoqueryArr]
}
let time = 0
console.log(`进入update并发处理次数`, times)
let success = false
try {
while (time++ < times && !success) {
// 依次锁住表
let updateRes = []
daoqueryArr.forEach(async daoquery => {
let canupdate = await daoquery.dao.update(daoquery.query, { $set: { lockStatus: 2 } })
updateRes.push(canupdate)
})
// 若都锁定成功了,执行内部调用
if (!daoqueryArr.includes(0)) {
const ret = await fn()
daoqueryArr.forEach(async daoquery => {
let ures = await daoquery.dao.update(daoquery.query, { $set: { lockStatus: 1 } })
console.log(`更新lockStatus为0`, ures)
})
success = true
return ret
} else {
console.log(`进入waitFor了,需等待30ms`)
await waitFor(30)
success = false
}
}
} catch (e) {
console.log(e)
daoqueryArr.forEach(async daoquery => {
let ures = await daoquery.dao.update(daoquery.query, { $set: { lockStatus: 1 } })
console.log(`更新lockStatus为0`, ures)
})
success = false
}
// 稍后重试
if (!success) {
daoqueryArr.forEach(async daoquery => {
let ures = await daoquery.dao.update(daoquery.query, { $set: { lockStatus: 1 } })
console.log(`操作${times}次后更新lockStatus为0`, ures)
})
return CODE_TYPES.ERROR_UPDATE_RETRY
}
function waitFor(ms) {
return new Promise(resolve => {
setTimeout(resolve, ms)
})
}
}
/**
* 调用示例
*/
// 扣库存
// let res = await lockUpdate({dao: this.activityprizedao, query: {_id}}, async ()=> {
// return await this.activityprizedao.update({_id}, {$set: {
// useStock: useStock + 1,
// updateTime: Date.now()
// }});
// });
// console.log(res);
// if (!res) {
// return CODE_TYPES.ERROR_UPDATE_RETRY;
// }
// return true;
/** @format */
import { BaseDao } from '../../sdk'
import { ERROR_LOG_DB_NAME } from '../../db'
import { getToday } from '../../utils'
export const logFn = (context: IContext<IParams>) => {
const data = JSON.stringify(context.data)
console.log(context)
console.log(
`---------函数: ${context.fcName || ''}.${
context?.cloud?.dataspace?.context?.handler || context.handler
}------------`
)
console.log(`---------请求参数: ${data}------------`)
}
// 记录错误日志
export const recordErrorLog = async (
context: IContext<IParams>,
baseInfos: IControllerInfos,
errorMsg: string,
stack: string
) => {
const { openId } = context
const { activityId } = context.data || {}
const { userInfo } = baseInfos
const { userNick } = userInfo || {}
const logdao: IBaseDao = new BaseDao(context, ERROR_LOG_DB_NAME)
const functionName: string = `${context.fcName || ''}.${
context?.cloud?.dataspace?.context?.handler || context.handler
}`
return await logdao.insertOne({
openId,
activityId,
errorMsg,
errorStack: stack,
functionName,
userNick,
fcInvokeId: context.fcInvokeId,
params: context.data,
createTime: Date.now(),
createDay: getToday(),
catchType: 1
})
}
// 本地mock 增加颜色辨识度
export const logger = (message: any) => {
console.log('\x1b[36m%s\x1b[0m', `-------------------日志----------------------------`)
console.log('\x1b[36m%s\x1b[0m', JSON.stringify(message, null, 2))
console.log('\x1b[36m%s\x1b[0m', `-------------------日志----------------------------`)
// console.log(`\033[42;30m 日志 \033[40;32m ${message} \033[0m`)
}
/** @format */
// 获取随机数
export const rand = (function () {
let seed = new Date().getTime()
function r() {
seed = (seed * 9301 + 49297) % 233280
return seed / 233280.0
}
return function (number: number) {
return Math.ceil(r() * number)
}
})()
export const signFigures = function (num: number, rank = 6) {
if (!num) return 0
const sign = num / Math.abs(num)
const number = num * sign
const temp = rank - 1 - Math.floor(Math.log10(number))
let ans
if (temp > 0) {
ans = parseFloat(number.toFixed(temp))
} else if (temp < 0) {
ans = Math.round(number / Math.pow(10, temp)) * temp
} else {
ans = Math.round(number)
}
return ans * sign
}
/** @format */
import { PRIZE_TYPE, DRAW_STATUS, C_APP_NAME, TBERROR, CODE_TYPES } from '../../constants'
import { TBAPIS, resultsModel } from '../../sdk'
import { CodeType } from 'taobao-mini-sdk/lib/utils/codetypes'
/**
* 发奖,包含权益,实物,积分
* @param {*} document 必须要有{ type, ename, _id }
* @param {*} session
* @param {*} context
*/
export const sendTBAward = async (
context: IContext<IParams>,
session: string,
document: IAwards
): Promise<IAwards | CodeType> => {
let { type, ename, _id, credits } = document
if (!type) {
return CODE_TYPES.PARAMS_ERROR
}
if (type === PRIZE_TYPE.OBJECT) {
return document
}
// 发奖
try {
console.log(`type`, type)
// 若中奖为权益
if (type === PRIZE_TYPE.ENAME) {
console.log(`中权益`)
let { drawStatus, remark } = await sendEname(ename, _id, session, context)
console.log(`drawStatus, remark`, drawStatus, remark)
document.drawStatus = drawStatus
document.remark = remark
} else if (type === PRIZE_TYPE.CREDITS) {
let { drawStatus, remark } = await sendCredits(credits, session, context)
document.drawStatus = drawStatus
document.remark = remark
}
return document
} catch (e) {
console.log(`发奖错误`, e)
return CODE_TYPES.PARAMS_ERROR
}
}
/**
* 发放积分
* @param {发放的积分数} credits
* @param {*} session
* @param {*} context
* @returns {drawStatus, remark}
*/
export const sendCredits = async (credits: number, session: string, context: IContext<IParams>) => {
let drawStatus = 0
let remark = ''
let result = await TBAPIS.changeCredits(context, session, {
quantity: credits,
change_type: 2,
opt_type: '0',
remark: `参与活动加积分`
})
if (result) {
drawStatus = DRAW_STATUS.SUCCESS
} else {
drawStatus = DRAW_STATUS.FAIL
remark = result.result_msg
}
return { drawStatus, remark }
}
/**
* @desc 发放权益
* @param {权益名称} ename
* @param {唯一key} uniqueId
* @param {*} session
* @param {*} context
* @returns { drawStatus, remark }
*/
export const sendEname = async (ename: string, uniqueId: string, session: string, context: IContext<IParams>) => {
let result = {
result_success: '',
result_code: '',
msg: '',
result_msg: '',
sub_msg: ''
}
try {
result = await TBAPIS.benefitSend(context, {
right_ename: ename,
receiver_id: context.openId,
unique_id: uniqueId,
app_name: C_APP_NAME,
session
})
} catch (e) {
console.log(`发放权益失败`, e)
result = e
}
let drawStatus = 0
let remark = ''
if (result.result_success) {
drawStatus = DRAW_STATUS.SUCCESS
} else {
let result_code = result.result_code
if (
[
'APPLY_SINGLE_COUPON_COUNT_EXCEED_LIMIT',
'APPLY_ONE_SELLER_COUNT_EXCEED_LIMIT',
'USER_PERMISSION_EXCEED_MAX_RIGHT_COUNT_IN_DAY'
].includes(result_code)
) {
drawStatus = DRAW_STATUS.RETRY
} else {
drawStatus = DRAW_STATUS.FAIL
}
remark = TBERROR[result_code || result.msg] || result.result_msg || result.sub_msg || `发放失败`
}
return { remark, drawStatus }
}
/** @format */
// 测试环境下 duiba2及其子账号自动开启VIP_MOCK, 返回数据可在此设置
export const VIP_MOCK = {
isVip: false,
url: '//taobao.com'
}
{
"compileOnSave": true,
"compilerOptions": {
"target": "es5",
"lib": [
"es6", "dom", "es7"
],
"typeRoots": ["./node_modules/@types/", "./src/typings/"],
"outDir": "./dist",
"sourceMap": true,
"module": "commonjs",
"watch": true,
"moduleResolution": "node",
"isolatedModules": false,
"declaration": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"suppressImplicitAnyIndexErrors": true
},
"include": [
"./src/**/*"
],
"exclude": [ "./src/mockServer/**/*"]
}
\ No newline at end of file
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@babel/code-frame@^7.0.0":
version "7.10.4"
resolved "https://registry.npm.taobao.org/@babel/code-frame/download/@babel/code-frame-7.10.4.tgz#168da1a36e90da68ae8d49c0f1b48c7c6249213a"
integrity sha1-Fo2ho26Q2miujUnA8bSMfGJJITo=
dependencies:
"@babel/highlight" "^7.10.4"
"@babel/helper-validator-identifier@^7.10.4":
version "7.10.4"
resolved "https://registry.npm.taobao.org/@babel/helper-validator-identifier/download/@babel/helper-validator-identifier-7.10.4.tgz#a78c7a7251e01f616512d31b10adcf52ada5e0d2"
integrity sha1-p4x6clHgH2FlEtMbEK3PUq2l4NI=
"@babel/highlight@^7.10.4":
version "7.10.4"
resolved "https://registry.npm.taobao.org/@babel/highlight/download/@babel/highlight-7.10.4.tgz?cache=0&sync_timestamp=1593521087106&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fhighlight%2Fdownload%2F%40babel%2Fhighlight-7.10.4.tgz#7d1bdfd65753538fabe6c38596cdb76d9ac60143"
integrity sha1-fRvf1ldTU4+r5sOFls23bZrGAUM=
dependencies:
"@babel/helper-validator-identifier" "^7.10.4"
chalk "^2.0.0"
js-tokens "^4.0.0"
"@types/bson@*":
version "4.0.2"
resolved "https://registry.npm.taobao.org/@types/bson/download/@types/bson-4.0.2.tgz?cache=0&sync_timestamp=1596838007251&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Fbson%2Fdownload%2F%40types%2Fbson-4.0.2.tgz#7accb85942fc39bbdb7515d4de437c04f698115f"
integrity sha1-esy4WUL8ObvbdRXU3kN8BPaYEV8=
dependencies:
"@types/node" "*"
"@types/color-name@^1.1.1":
version "1.1.1"
resolved "https://registry.npm.taobao.org/@types/color-name/download/@types/color-name-1.1.1.tgz?cache=0&sync_timestamp=1596837707987&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Fcolor-name%2Fdownload%2F%40types%2Fcolor-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0"
integrity sha1-HBJhu+qhCoBVu8XYq4S3sq/IRqA=
"@types/eslint-visitor-keys@^1.0.0":
version "1.0.0"
resolved "https://registry.npm.taobao.org/@types/eslint-visitor-keys/download/@types/eslint-visitor-keys-1.0.0.tgz#1ee30d79544ca84d68d4b3cdb0af4f205663dd2d"
integrity sha1-HuMNeVRMqE1o1LPNsK9PIFZj3S0=
"@types/json-schema@^7.0.3":
version "7.0.5"
resolved "https://registry.npm.taobao.org/@types/json-schema/download/@types/json-schema-7.0.5.tgz#dcce4430e64b443ba8945f0290fb564ad5bac6dd"
integrity sha1-3M5EMOZLRDuolF8CkPtWStW6xt0=
"@types/lodash@^4.14.160":
version "4.14.160"
resolved "https://registry.npm.taobao.org/@types/lodash/download/@types/lodash-4.14.160.tgz?cache=0&sync_timestamp=1598288460918&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Flodash%2Fdownload%2F%40types%2Flodash-4.14.160.tgz#2f1bba6500bc3cb9a732c6d66a083378fb0b0b29"
integrity sha1-Lxu6ZQC8PLmnMsbWaggzePsLCyk=
"@types/mongodb@^3.5.26":
version "3.5.26"
resolved "https://registry.npm.taobao.org/@types/mongodb/download/@types/mongodb-3.5.26.tgz#aa10315925ba10cdc7931ef280c0ff6f54fd37f3"
integrity sha1-qhAxWSW6EM3Hkx7ygMD/b1T9N/M=
dependencies:
"@types/bson" "*"
"@types/node" "*"
"@types/node@*":
version "14.6.2"
resolved "https://registry.npm.taobao.org/@types/node/download/@types/node-14.6.2.tgz?cache=0&sync_timestamp=1598656851627&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Fnode%2Fdownload%2F%40types%2Fnode-14.6.2.tgz#264b44c5a28dfa80198fc2f7b6d3c8a054b9491f"
integrity sha1-JktExaKN+oAZj8L3ttPIoFS5SR8=
"@types/node@^14.6.0":
version "14.6.0"
resolved "https://registry.npm.taobao.org/@types/node/download/@types/node-14.6.0.tgz?cache=0&sync_timestamp=1597673176468&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Fnode%2Fdownload%2F%40types%2Fnode-14.6.0.tgz#7d4411bf5157339337d7cff864d9ff45f177b499"
integrity sha1-fUQRv1FXM5M318/4ZNn/RfF3tJk=
"@typescript-eslint/eslint-plugin@^3.9.1":
version "3.9.1"
resolved "https://registry.npm.taobao.org/@typescript-eslint/eslint-plugin/download/@typescript-eslint/eslint-plugin-3.9.1.tgz#8cf27b6227d12d66dd8dc1f1a4b04d1daad51c2e"
integrity sha1-jPJ7YifRLWbdjcHxpLBNHarVHC4=
dependencies:
"@typescript-eslint/experimental-utils" "3.9.1"
debug "^4.1.1"
functional-red-black-tree "^1.0.1"
regexpp "^3.0.0"
semver "^7.3.2"
tsutils "^3.17.1"
"@typescript-eslint/experimental-utils@3.9.1":
version "3.9.1"
resolved "https://registry.npm.taobao.org/@typescript-eslint/experimental-utils/download/@typescript-eslint/experimental-utils-3.9.1.tgz?cache=0&sync_timestamp=1597682959833&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40typescript-eslint%2Fexperimental-utils%2Fdownload%2F%40typescript-eslint%2Fexperimental-utils-3.9.1.tgz#b140b2dc7a7554a44f8a86fb6fe7cbfe57ca059e"
integrity sha1-sUCy3Hp1VKRPiob7b+fL/lfKBZ4=
dependencies:
"@types/json-schema" "^7.0.3"
"@typescript-eslint/types" "3.9.1"
"@typescript-eslint/typescript-estree" "3.9.1"
eslint-scope "^5.0.0"
eslint-utils "^2.0.0"
"@typescript-eslint/parser@^3.9.1":
version "3.9.1"
resolved "https://registry.npm.taobao.org/@typescript-eslint/parser/download/@typescript-eslint/parser-3.9.1.tgz#ab7983abaea0ae138ff5671c7c7739d8a191b181"
integrity sha1-q3mDq66grhOP9WccfHc52KGRsYE=
dependencies:
"@types/eslint-visitor-keys" "^1.0.0"
"@typescript-eslint/experimental-utils" "3.9.1"
"@typescript-eslint/types" "3.9.1"
"@typescript-eslint/typescript-estree" "3.9.1"
eslint-visitor-keys "^1.1.0"
"@typescript-eslint/types@3.9.1":
version "3.9.1"
resolved "https://registry.npm.taobao.org/@typescript-eslint/types/download/@typescript-eslint/types-3.9.1.tgz?cache=0&sync_timestamp=1597682871503&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40typescript-eslint%2Ftypes%2Fdownload%2F%40typescript-eslint%2Ftypes-3.9.1.tgz#b2a6eaac843cf2f2777b3f2464fb1fbce5111416"
integrity sha1-sqbqrIQ88vJ3ez8kZPsfvOURFBY=
"@typescript-eslint/typescript-estree@3.9.1":
version "3.9.1"
resolved "https://registry.npm.taobao.org/@typescript-eslint/typescript-estree/download/@typescript-eslint/typescript-estree-3.9.1.tgz?cache=0&sync_timestamp=1597682960916&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40typescript-eslint%2Ftypescript-estree%2Fdownload%2F%40typescript-eslint%2Ftypescript-estree-3.9.1.tgz#fd81cada74bc8a7f3a2345b00897acb087935779"
integrity sha1-/YHK2nS8in86I0WwCJessIeTV3k=
dependencies:
"@typescript-eslint/types" "3.9.1"
"@typescript-eslint/visitor-keys" "3.9.1"
debug "^4.1.1"
glob "^7.1.6"
is-glob "^4.0.1"
lodash "^4.17.15"
semver "^7.3.2"
tsutils "^3.17.1"
"@typescript-eslint/visitor-keys@3.9.1":
version "3.9.1"
resolved "https://registry.npm.taobao.org/@typescript-eslint/visitor-keys/download/@typescript-eslint/visitor-keys-3.9.1.tgz?cache=0&sync_timestamp=1597682861568&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40typescript-eslint%2Fvisitor-keys%2Fdownload%2F%40typescript-eslint%2Fvisitor-keys-3.9.1.tgz#92af3747cdb71509199a8f7a4f00b41d636551d1"
integrity sha1-kq83R823FQkZmo96TwC0HWNlUdE=
dependencies:
eslint-visitor-keys "^1.1.0"
acorn-jsx@^5.2.0:
version "5.2.0"
resolved "https://registry.npm.taobao.org/acorn-jsx/download/acorn-jsx-5.2.0.tgz?cache=0&sync_timestamp=1582724149302&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Facorn-jsx%2Fdownload%2Facorn-jsx-5.2.0.tgz#4c66069173d6fdd68ed85239fc256226182b2ebe"
integrity sha1-TGYGkXPW/daO2FI5/CViJhgrLr4=
acorn@^7.3.1:
version "7.4.0"
resolved "https://registry.npm.taobao.org/acorn/download/acorn-7.4.0.tgz?cache=0&sync_timestamp=1597237468154&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Facorn%2Fdownload%2Facorn-7.4.0.tgz#e1ad486e6c54501634c6c397c5c121daa383607c"
integrity sha1-4a1IbmxUUBY0xsOXxcEh2qODYHw=
adler-32@~1.2.0:
version "1.2.0"
resolved "https://registry.npm.taobao.org/adler-32/download/adler-32-1.2.0.tgz#6a3e6bf0a63900ba15652808cb15c6813d1a5f25"
integrity sha1-aj5r8KY5ALoVZSgIyxXGgT0aXyU=
dependencies:
exit-on-epipe "~1.0.1"
printj "~1.1.0"
ajv@^6.10.0, ajv@^6.10.2:
version "6.12.4"
resolved "https://registry.npm.taobao.org/ajv/download/ajv-6.12.4.tgz?cache=0&sync_timestamp=1597480799381&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fajv%2Fdownload%2Fajv-6.12.4.tgz#0614facc4522127fa713445c6bfd3ebd376e2234"
integrity sha1-BhT6zEUiEn+nE0Rca/0+vTduIjQ=
dependencies:
fast-deep-equal "^3.1.1"
fast-json-stable-stringify "^2.0.0"
json-schema-traverse "^0.4.1"
uri-js "^4.2.2"
ansi-colors@^4.1.1:
version "4.1.1"
resolved "https://registry.npm.taobao.org/ansi-colors/download/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348"
integrity sha1-y7muJWv3UK8eqzRPIpqif+lLo0g=
ansi-regex@^4.1.0:
version "4.1.0"
resolved "https://registry.npm.taobao.org/ansi-regex/download/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997"
integrity sha1-i5+PCM8ay4Q3Vqg5yox+MWjFGZc=
ansi-regex@^5.0.0:
version "5.0.0"
resolved "https://registry.npm.taobao.org/ansi-regex/download/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75"
integrity sha1-OIU59VF5vzkznIGvMKZU1p+Hy3U=
ansi-styles@^3.2.0, ansi-styles@^3.2.1:
version "3.2.1"
resolved "https://registry.npm.taobao.org/ansi-styles/download/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d"
integrity sha1-QfuyAkPlCxK+DwS43tvwdSDOhB0=
dependencies:
color-convert "^1.9.0"
ansi-styles@^4.1.0:
version "4.2.1"
resolved "https://registry.npm.taobao.org/ansi-styles/download/ansi-styles-4.2.1.tgz#90ae75c424d008d2624c5bf29ead3177ebfcf359"
integrity sha1-kK51xCTQCNJiTFvynq0xd+v881k=
dependencies:
"@types/color-name" "^1.1.1"
color-convert "^2.0.1"
argparse@^1.0.7:
version "1.0.10"
resolved "https://registry.npm.taobao.org/argparse/download/argparse-1.0.10.tgz?cache=0&sync_timestamp=1597414399705&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fargparse%2Fdownload%2Fargparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911"
integrity sha1-vNZ5HqWuCXJeF+WtmIE0zUCz2RE=
dependencies:
sprintf-js "~1.0.2"
astral-regex@^1.0.0:
version "1.0.0"
resolved "https://registry.npm.taobao.org/astral-regex/download/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9"
integrity sha1-bIw/uCfdQ+45GPJ7gngqt2WKb9k=
balanced-match@^1.0.0:
version "1.0.0"
resolved "https://registry.npm.taobao.org/balanced-match/download/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c=
brace-expansion@^1.1.7:
version "1.1.11"
resolved "https://registry.npm.taobao.org/brace-expansion/download/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
integrity sha1-PH/L9SnYcibz0vUrlm/1Jx60Qd0=
dependencies:
balanced-match "^1.0.0"
concat-map "0.0.1"
buffer-from@^1.0.0, buffer-from@^1.1.0:
version "1.1.1"
resolved "https://registry.npm.taobao.org/buffer-from/download/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef"
integrity sha1-MnE7wCj3XAL9txDXx7zsHyxgcO8=
callsites@^3.0.0:
version "3.1.0"
resolved "https://registry.npm.taobao.org/callsites/download/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73"
integrity sha1-s2MKvYlDQy9Us/BRkjjjPNffL3M=
cfb@^1.1.2:
version "1.2.0"
resolved "https://registry.npm.taobao.org/cfb/download/cfb-1.2.0.tgz#6a4d0872b525ed60349e1ef51fb4b0bf73eca9a8"
integrity sha1-ak0IcrUl7WA0nh71H7Swv3Psqag=
dependencies:
adler-32 "~1.2.0"
crc-32 "~1.2.0"
printj "~1.1.2"
chalk@^2.0.0:
version "2.4.2"
resolved "https://registry.npm.taobao.org/chalk/download/chalk-2.4.2.tgz?cache=0&sync_timestamp=1591687076871&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fchalk%2Fdownload%2Fchalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424"
integrity sha1-zUJUFnelQzPPVBpJEIwUMrRMlCQ=
dependencies:
ansi-styles "^3.2.1"
escape-string-regexp "^1.0.5"
supports-color "^5.3.0"
chalk@^4.0.0:
version "4.1.0"
resolved "https://registry.npm.taobao.org/chalk/download/chalk-4.1.0.tgz?cache=0&sync_timestamp=1591687076871&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fchalk%2Fdownload%2Fchalk-4.1.0.tgz#4e14870a618d9e2edd97dd8345fd9d9dc315646a"
integrity sha1-ThSHCmGNni7dl92DRf2dncMVZGo=
dependencies:
ansi-styles "^4.1.0"
supports-color "^7.1.0"
codepage@~1.14.0:
version "1.14.0"
resolved "https://registry.npm.taobao.org/codepage/download/codepage-1.14.0.tgz#8cbe25481323559d7d307571b0fff91e7a1d2f99"
integrity sha1-jL4lSBMjVZ19MHVxsP/5HnodL5k=
dependencies:
commander "~2.14.1"
exit-on-epipe "~1.0.1"
color-convert@^1.9.0:
version "1.9.3"
resolved "https://registry.npm.taobao.org/color-convert/download/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8"
integrity sha1-u3GFBpDh8TZWfeYp0tVHHe2kweg=
dependencies:
color-name "1.1.3"
color-convert@^2.0.1:
version "2.0.1"
resolved "https://registry.npm.taobao.org/color-convert/download/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3"
integrity sha1-ctOmjVmMm9s68q0ehPIdiWq9TeM=
dependencies:
color-name "~1.1.4"
color-name@1.1.3:
version "1.1.3"
resolved "https://registry.npm.taobao.org/color-name/download/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25"
integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=
color-name@~1.1.4:
version "1.1.4"
resolved "https://registry.npm.taobao.org/color-name/download/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
integrity sha1-wqCah6y95pVD3m9j+jmVyCbFNqI=
commander@~2.14.1:
version "2.14.1"
resolved "https://registry.npm.taobao.org/commander/download/commander-2.14.1.tgz?cache=0&sync_timestamp=1595168214577&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcommander%2Fdownload%2Fcommander-2.14.1.tgz#2235123e37af8ca3c65df45b026dbd357b01b9aa"
integrity sha1-IjUSPjevjKPGXfRbAm29NXsBuao=
commander@~2.17.1:
version "2.17.1"
resolved "https://registry.npm.taobao.org/commander/download/commander-2.17.1.tgz?cache=0&sync_timestamp=1595168214577&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcommander%2Fdownload%2Fcommander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf"
integrity sha1-vXerfebelCBc6sxy8XFtKfIKd78=
concat-map@0.0.1:
version "0.0.1"
resolved "https://registry.npm.taobao.org/concat-map/download/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=
crc-32@~1.2.0:
version "1.2.0"
resolved "https://registry.npm.taobao.org/crc-32/download/crc-32-1.2.0.tgz#cb2db6e29b88508e32d9dd0ec1693e7b41a18208"
integrity sha1-yy224puIUI4y2d0OwWk+e0Ghggg=
dependencies:
exit-on-epipe "~1.0.1"
printj "~1.1.0"
cross-spawn@^7.0.2:
version "7.0.3"
resolved "https://registry.npm.taobao.org/cross-spawn/download/cross-spawn-7.0.3.tgz?cache=0&sync_timestamp=1590420971248&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcross-spawn%2Fdownload%2Fcross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
integrity sha1-9zqFudXUHQRVUcF34ogtSshXKKY=
dependencies:
path-key "^3.1.0"
shebang-command "^2.0.0"
which "^2.0.1"
dayjs@^1.8.28:
version "1.8.32"
resolved "https://registry.npm.taobao.org/dayjs/download/dayjs-1.8.32.tgz?cache=0&sync_timestamp=1596547169382&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fdayjs%2Fdownload%2Fdayjs-1.8.32.tgz#66c48b95c397d9f7907e89bd29f78b3d19d40294"
integrity sha1-ZsSLlcOX2feQfom9KfeLPRnUApQ=
debug@^4.0.1, debug@^4.1.1:
version "4.1.1"
resolved "https://registry.npm.taobao.org/debug/download/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791"
integrity sha1-O3ImAlUQnGtYnO4FDx1RYTlmR5E=
dependencies:
ms "^2.1.1"
deep-is@^0.1.3:
version "0.1.3"
resolved "https://registry.npm.taobao.org/deep-is/download/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34"
integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=
doctrine@^3.0.0:
version "3.0.0"
resolved "https://registry.npm.taobao.org/doctrine/download/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961"
integrity sha1-rd6+rXKmV023g2OdyHoSF3OXOWE=
dependencies:
esutils "^2.0.2"
emoji-regex@^7.0.1:
version "7.0.3"
resolved "https://registry.npm.taobao.org/emoji-regex/download/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156"
integrity sha1-kzoEBShgyF6DwSJHnEdIqOTHIVY=
enquirer@^2.3.5:
version "2.3.6"
resolved "https://registry.npm.taobao.org/enquirer/download/enquirer-2.3.6.tgz?cache=0&sync_timestamp=1593693257124&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fenquirer%2Fdownload%2Fenquirer-2.3.6.tgz#2a7fe5dd634a1e4125a975ec994ff5456dc3734d"
integrity sha1-Kn/l3WNKHkElqXXsmU/1RW3Dc00=
dependencies:
ansi-colors "^4.1.1"
escape-string-regexp@^1.0.5:
version "1.0.5"
resolved "https://registry.npm.taobao.org/escape-string-regexp/download/escape-string-regexp-1.0.5.tgz?cache=0&sync_timestamp=1587627107924&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fescape-string-regexp%2Fdownload%2Fescape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=
eslint-config-prettier@^6.11.0:
version "6.11.0"
resolved "https://registry.npm.taobao.org/eslint-config-prettier/download/eslint-config-prettier-6.11.0.tgz#f6d2238c1290d01c859a8b5c1f7d352a0b0da8b1"
integrity sha1-9tIjjBKQ0ByFmotcH301KgsNqLE=
dependencies:
get-stdin "^6.0.0"
eslint-plugin-prettier@^3.1.4:
version "3.1.4"
resolved "https://registry.npm.taobao.org/eslint-plugin-prettier/download/eslint-plugin-prettier-3.1.4.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Feslint-plugin-prettier%2Fdownload%2Feslint-plugin-prettier-3.1.4.tgz#168ab43154e2ea57db992a2cd097c828171f75c2"
integrity sha1-Foq0MVTi6lfbmSos0JfIKBcfdcI=
dependencies:
prettier-linter-helpers "^1.0.0"
eslint-scope@^5.0.0, eslint-scope@^5.1.0:
version "5.1.0"
resolved "https://registry.npm.taobao.org/eslint-scope/download/eslint-scope-5.1.0.tgz#d0f971dfe59c69e0cada684b23d49dbf82600ce5"
integrity sha1-0Plx3+WcaeDK2mhLI9Sdv4JgDOU=
dependencies:
esrecurse "^4.1.0"
estraverse "^4.1.1"
eslint-utils@^2.0.0, eslint-utils@^2.1.0:
version "2.1.0"
resolved "https://registry.npm.taobao.org/eslint-utils/download/eslint-utils-2.1.0.tgz?cache=0&sync_timestamp=1592222029130&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Feslint-utils%2Fdownload%2Feslint-utils-2.1.0.tgz#d2de5e03424e707dc10c74068ddedae708741b27"
integrity sha1-0t5eA0JOcH3BDHQGjd7a5wh0Gyc=
dependencies:
eslint-visitor-keys "^1.1.0"
eslint-visitor-keys@^1.1.0, eslint-visitor-keys@^1.3.0:
version "1.3.0"
resolved "https://registry.npm.taobao.org/eslint-visitor-keys/download/eslint-visitor-keys-1.3.0.tgz?cache=0&sync_timestamp=1597435587476&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Feslint-visitor-keys%2Fdownload%2Feslint-visitor-keys-1.3.0.tgz#30ebd1ef7c2fdff01c3a4f151044af25fab0523e"
integrity sha1-MOvR73wv3/AcOk8VEESvJfqwUj4=
eslint@^7.7.0:
version "7.7.0"
resolved "https://registry.npm.taobao.org/eslint/download/eslint-7.7.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Feslint%2Fdownload%2Feslint-7.7.0.tgz#18beba51411927c4b64da0a8ceadefe4030d6073"
integrity sha1-GL66UUEZJ8S2TaCozq3v5AMNYHM=
dependencies:
"@babel/code-frame" "^7.0.0"
ajv "^6.10.0"
chalk "^4.0.0"
cross-spawn "^7.0.2"
debug "^4.0.1"
doctrine "^3.0.0"
enquirer "^2.3.5"
eslint-scope "^5.1.0"
eslint-utils "^2.1.0"
eslint-visitor-keys "^1.3.0"
espree "^7.2.0"
esquery "^1.2.0"
esutils "^2.0.2"
file-entry-cache "^5.0.1"
functional-red-black-tree "^1.0.1"
glob-parent "^5.0.0"
globals "^12.1.0"
ignore "^4.0.6"
import-fresh "^3.0.0"
imurmurhash "^0.1.4"
is-glob "^4.0.0"
js-yaml "^3.13.1"
json-stable-stringify-without-jsonify "^1.0.1"
levn "^0.4.1"
lodash "^4.17.19"
minimatch "^3.0.4"
natural-compare "^1.4.0"
optionator "^0.9.1"
progress "^2.0.0"
regexpp "^3.1.0"
semver "^7.2.1"
strip-ansi "^6.0.0"
strip-json-comments "^3.1.0"
table "^5.2.3"
text-table "^0.2.0"
v8-compile-cache "^2.0.3"
espree@^7.2.0:
version "7.2.0"
resolved "https://registry.npm.taobao.org/espree/download/espree-7.2.0.tgz?cache=0&sync_timestamp=1595033738897&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fespree%2Fdownload%2Fespree-7.2.0.tgz#1c263d5b513dbad0ac30c4991b93ac354e948d69"
integrity sha1-HCY9W1E9utCsMMSZG5OsNU6UjWk=
dependencies:
acorn "^7.3.1"
acorn-jsx "^5.2.0"
eslint-visitor-keys "^1.3.0"
esprima@^4.0.0:
version "4.0.1"
resolved "https://registry.npm.taobao.org/esprima/download/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71"
integrity sha1-E7BM2z5sXRnfkatph6hpVhmwqnE=
esquery@^1.2.0:
version "1.3.1"
resolved "https://registry.npm.taobao.org/esquery/download/esquery-1.3.1.tgz?cache=0&sync_timestamp=1587061209806&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fesquery%2Fdownload%2Fesquery-1.3.1.tgz#b78b5828aa8e214e29fb74c4d5b752e1c033da57"
integrity sha1-t4tYKKqOIU4p+3TE1bdS4cAz2lc=
dependencies:
estraverse "^5.1.0"
esrecurse@^4.1.0:
version "4.2.1"
resolved "https://registry.npm.taobao.org/esrecurse/download/esrecurse-4.2.1.tgz#007a3b9fdbc2b3bb87e4879ea19c92fdbd3942cf"
integrity sha1-AHo7n9vCs7uH5IeeoZyS/b05Qs8=
dependencies:
estraverse "^4.1.0"
estraverse@^4.1.0, estraverse@^4.1.1:
version "4.3.0"
resolved "https://registry.npm.taobao.org/estraverse/download/estraverse-4.3.0.tgz?cache=0&sync_timestamp=1596641261331&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Festraverse%2Fdownload%2Festraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d"
integrity sha1-OYrT88WiSUi+dyXoPRGn3ijNvR0=
estraverse@^5.1.0:
version "5.2.0"
resolved "https://registry.npm.taobao.org/estraverse/download/estraverse-5.2.0.tgz?cache=0&sync_timestamp=1596641261331&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Festraverse%2Fdownload%2Festraverse-5.2.0.tgz#307df42547e6cc7324d3cf03c155d5cdb8c53880"
integrity sha1-MH30JUfmzHMk088DwVXVzbjFOIA=
esutils@^2.0.2:
version "2.0.3"
resolved "https://registry.npm.taobao.org/esutils/download/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64"
integrity sha1-dNLrTeC42hKTcRkQ1Qd1ubcQ72Q=
exit-on-epipe@~1.0.1:
version "1.0.1"
resolved "https://registry.npm.taobao.org/exit-on-epipe/download/exit-on-epipe-1.0.1.tgz#0bdd92e87d5285d267daa8171d0eb06159689692"
integrity sha1-C92S6H1ShdJn2qgXHQ6wYVlolpI=
fast-deep-equal@^3.1.1:
version "3.1.3"
resolved "https://registry.npm.taobao.org/fast-deep-equal/download/fast-deep-equal-3.1.3.tgz?cache=0&sync_timestamp=1591599651635&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ffast-deep-equal%2Fdownload%2Ffast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525"
integrity sha1-On1WtVnWy8PrUSMlJE5hmmXGxSU=
fast-diff@^1.1.2:
version "1.2.0"
resolved "https://registry.npm.taobao.org/fast-diff/download/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03"
integrity sha1-c+4RmC2Gyq95WYKNUZz+kn+sXwM=
fast-json-stable-stringify@^2.0.0:
version "2.1.0"
resolved "https://registry.npm.taobao.org/fast-json-stable-stringify/download/fast-json-stable-stringify-2.1.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ffast-json-stable-stringify%2Fdownload%2Ffast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633"
integrity sha1-h0v2nG9ATCtdmcSBNBOZ/VWJJjM=
fast-levenshtein@^2.0.6:
version "2.0.6"
resolved "https://registry.npm.taobao.org/fast-levenshtein/download/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917"
integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=
file-entry-cache@^5.0.1:
version "5.0.1"
resolved "https://registry.npm.taobao.org/file-entry-cache/download/file-entry-cache-5.0.1.tgz#ca0f6efa6dd3d561333fb14515065c2fafdf439c"
integrity sha1-yg9u+m3T1WEzP7FFFQZcL6/fQ5w=
dependencies:
flat-cache "^2.0.1"
flat-cache@^2.0.1:
version "2.0.1"
resolved "https://registry.npm.taobao.org/flat-cache/download/flat-cache-2.0.1.tgz#5d296d6f04bda44a4630a301413bdbc2ec085ec0"
integrity sha1-XSltbwS9pEpGMKMBQTvbwuwIXsA=
dependencies:
flatted "^2.0.0"
rimraf "2.6.3"
write "1.0.3"
flatted@^2.0.0:
version "2.0.2"
resolved "https://registry.npm.taobao.org/flatted/download/flatted-2.0.2.tgz#4575b21e2bcee7434aa9be662f4b7b5f9c2b5138"
integrity sha1-RXWyHivO50NKqb5mL0t7X5wrUTg=
frac@~1.1.2:
version "1.1.2"
resolved "https://registry.npm.taobao.org/frac/download/frac-1.1.2.tgz#3d74f7f6478c88a1b5020306d747dc6313c74d0b"
integrity sha1-PXT39keMiKG1AgMG10fcYxPHTQs=
fs.realpath@^1.0.0:
version "1.0.0"
resolved "https://registry.npm.taobao.org/fs.realpath/download/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8=
functional-red-black-tree@^1.0.1:
version "1.0.1"
resolved "https://registry.npm.taobao.org/functional-red-black-tree/download/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327"
integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=
get-stdin@^6.0.0:
version "6.0.0"
resolved "https://registry.npm.taobao.org/get-stdin/download/get-stdin-6.0.0.tgz#9e09bf712b360ab9225e812048f71fde9c89657b"
integrity sha1-ngm/cSs2CrkiXoEgSPcf3pyJZXs=
glob-parent@^5.0.0:
version "5.1.1"
resolved "https://registry.npm.taobao.org/glob-parent/download/glob-parent-5.1.1.tgz?cache=0&sync_timestamp=1584836110944&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fglob-parent%2Fdownload%2Fglob-parent-5.1.1.tgz#b6c1ef417c4e5663ea498f1c45afac6916bbc229"
integrity sha1-tsHvQXxOVmPqSY8cRa+saRa7wik=
dependencies:
is-glob "^4.0.1"
glob@^7.1.3, glob@^7.1.6:
version "7.1.6"
resolved "https://registry.npm.taobao.org/glob/download/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6"
integrity sha1-FB8zuBp8JJLhJVlDB0gMRmeSeKY=
dependencies:
fs.realpath "^1.0.0"
inflight "^1.0.4"
inherits "2"
minimatch "^3.0.4"
once "^1.3.0"
path-is-absolute "^1.0.0"
globals@^12.1.0:
version "12.4.0"
resolved "https://registry.npm.taobao.org/globals/download/globals-12.4.0.tgz?cache=0&sync_timestamp=1596711099974&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fglobals%2Fdownload%2Fglobals-12.4.0.tgz#a18813576a41b00a24a97e7f815918c2e19925f8"
integrity sha1-oYgTV2pBsAokqX5/gVkYwuGZJfg=
dependencies:
type-fest "^0.8.1"
has-flag@^3.0.0:
version "3.0.0"
resolved "https://registry.npm.taobao.org/has-flag/download/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd"
integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0=
has-flag@^4.0.0:
version "4.0.0"
resolved "https://registry.npm.taobao.org/has-flag/download/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b"
integrity sha1-lEdx/ZyByBJlxNaUGGDaBrtZR5s=
ignore@^4.0.6:
version "4.0.6"
resolved "https://registry.npm.taobao.org/ignore/download/ignore-4.0.6.tgz?cache=0&sync_timestamp=1590809289115&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fignore%2Fdownload%2Fignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc"
integrity sha1-dQ49tYYgh7RzfrrIIH/9HvJ7Jfw=
import-fresh@^3.0.0:
version "3.2.1"
resolved "https://registry.npm.taobao.org/import-fresh/download/import-fresh-3.2.1.tgz?cache=0&sync_timestamp=1573665028675&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fimport-fresh%2Fdownload%2Fimport-fresh-3.2.1.tgz#633ff618506e793af5ac91bf48b72677e15cbe66"
integrity sha1-Yz/2GFBueTr1rJG/SLcmd+FcvmY=
dependencies:
parent-module "^1.0.0"
resolve-from "^4.0.0"
imurmurhash@^0.1.4:
version "0.1.4"
resolved "https://registry.npm.taobao.org/imurmurhash/download/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"
integrity sha1-khi5srkoojixPcT7a21XbyMUU+o=
inflight@^1.0.4:
version "1.0.6"
resolved "https://registry.npm.taobao.org/inflight/download/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=
dependencies:
once "^1.3.0"
wrappy "1"
inherits@2:
version "2.0.4"
resolved "https://registry.npm.taobao.org/inherits/download/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
integrity sha1-D6LGT5MpF8NDOg3tVTY6rjdBa3w=
is-extglob@^2.1.1:
version "2.1.1"
resolved "https://registry.npm.taobao.org/is-extglob/download/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2"
integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=
is-fullwidth-code-point@^2.0.0:
version "2.0.0"
resolved "https://registry.npm.taobao.org/is-fullwidth-code-point/download/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f"
integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=
is-glob@^4.0.0, is-glob@^4.0.1:
version "4.0.1"
resolved "https://registry.npm.taobao.org/is-glob/download/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc"
integrity sha1-dWfb6fL14kZ7x3q4PEopSCQHpdw=
dependencies:
is-extglob "^2.1.1"
isexe@^2.0.0:
version "2.0.0"
resolved "https://registry.npm.taobao.org/isexe/download/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=
js-tokens@^4.0.0:
version "4.0.0"
resolved "https://registry.npm.taobao.org/js-tokens/download/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
integrity sha1-GSA/tZmR35jjoocFDUZHzerzJJk=
js-yaml@^3.13.1:
version "3.14.0"
resolved "https://registry.npm.taobao.org/js-yaml/download/js-yaml-3.14.0.tgz?cache=0&sync_timestamp=1590172246873&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fjs-yaml%2Fdownload%2Fjs-yaml-3.14.0.tgz#a7a34170f26a21bb162424d8adacb4113a69e482"
integrity sha1-p6NBcPJqIbsWJCTYray0ETpp5II=
dependencies:
argparse "^1.0.7"
esprima "^4.0.0"
json-schema-traverse@^0.4.1:
version "0.4.1"
resolved "https://registry.npm.taobao.org/json-schema-traverse/download/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660"
integrity sha1-afaofZUTq4u4/mO9sJecRI5oRmA=
json-stable-stringify-without-jsonify@^1.0.1:
version "1.0.1"
resolved "https://registry.npm.taobao.org/json-stable-stringify-without-jsonify/download/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651"
integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=
levn@^0.4.1:
version "0.4.1"
resolved "https://registry.npm.taobao.org/levn/download/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade"
integrity sha1-rkViwAdHO5MqYgDUAyaN0v/8at4=
dependencies:
prelude-ls "^1.2.1"
type-check "~0.4.0"
lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20:
version "4.17.20"
resolved "https://registry.npm.taobao.org/lodash/download/lodash-4.17.20.tgz?cache=0&sync_timestamp=1597336053864&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Flodash%2Fdownload%2Flodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52"
integrity sha1-tEqbYpe8tpjxxRo1RaKzs2jVnFI=
minimatch@^3.0.4:
version "3.0.4"
resolved "https://registry.npm.taobao.org/minimatch/download/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
integrity sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=
dependencies:
brace-expansion "^1.1.7"
minimist@^1.2.5:
version "1.2.5"
resolved "https://registry.npm.taobao.org/minimist/download/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602"
integrity sha1-Z9ZgFLZqaoqqDAg8X9WN9OTpdgI=
mkdirp@^0.5.1:
version "0.5.5"
resolved "https://registry.npm.taobao.org/mkdirp/download/mkdirp-0.5.5.tgz?cache=0&sync_timestamp=1587535418745&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fmkdirp%2Fdownload%2Fmkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def"
integrity sha1-2Rzv1i0UNsoPQWIOJRKI1CAJne8=
dependencies:
minimist "^1.2.5"
ms@^2.1.1:
version "2.1.2"
resolved "https://registry.npm.taobao.org/ms/download/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
integrity sha1-0J0fNXtEP0kzgqjrPM0YOHKuYAk=
natural-compare@^1.4.0:
version "1.4.0"
resolved "https://registry.npm.taobao.org/natural-compare/download/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7"
integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=
node-xlsx@^0.15.0:
version "0.15.0"
resolved "https://registry.npm.taobao.org/node-xlsx/download/node-xlsx-0.15.0.tgz#1f1b0d7adce5c706e86bfd96a5aa0005bf8a9dc3"
integrity sha1-HxsNetzlxwboa/2WpaoABb+KncM=
dependencies:
buffer-from "^1.1.0"
xlsx "^0.14.1"
once@^1.3.0:
version "1.4.0"
resolved "https://registry.npm.taobao.org/once/download/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E=
dependencies:
wrappy "1"
optionator@^0.9.1:
version "0.9.1"
resolved "https://registry.npm.taobao.org/optionator/download/optionator-0.9.1.tgz?cache=0&sync_timestamp=1585966238288&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Foptionator%2Fdownload%2Foptionator-0.9.1.tgz#4f236a6373dae0566a6d43e1326674f50c291499"
integrity sha1-TyNqY3Pa4FZqbUPhMmZ09QwpFJk=
dependencies:
deep-is "^0.1.3"
fast-levenshtein "^2.0.6"
levn "^0.4.1"
prelude-ls "^1.2.1"
type-check "^0.4.0"
word-wrap "^1.2.3"
parent-module@^1.0.0:
version "1.0.1"
resolved "https://registry.npm.taobao.org/parent-module/download/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2"
integrity sha1-aR0nCeeMefrjoVZiJFLQB2LKqqI=
dependencies:
callsites "^3.0.0"
path-is-absolute@^1.0.0:
version "1.0.1"
resolved "https://registry.npm.taobao.org/path-is-absolute/download/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18=
path-key@^3.1.0:
version "3.1.1"
resolved "https://registry.npm.taobao.org/path-key/download/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375"
integrity sha1-WB9q3mWMu6ZaDTOA3ndTKVBU83U=
prelude-ls@^1.2.1:
version "1.2.1"
resolved "https://registry.npm.taobao.org/prelude-ls/download/prelude-ls-1.2.1.tgz?cache=0&sync_timestamp=1585868608597&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fprelude-ls%2Fdownload%2Fprelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396"
integrity sha1-3rxkidem5rDnYRiIzsiAM30xY5Y=
prettier-linter-helpers@^1.0.0:
version "1.0.0"
resolved "https://registry.npm.taobao.org/prettier-linter-helpers/download/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b"
integrity sha1-0j1B/hN1ZG3i0BBNNFSjAIgCz3s=
dependencies:
fast-diff "^1.1.2"
prettier@^2.0.5:
version "2.0.5"
resolved "https://registry.npm.taobao.org/prettier/download/prettier-2.0.5.tgz#d6d56282455243f2f92cc1716692c08aa31522d4"
integrity sha1-1tVigkVSQ/L5LMFxZpLAiqMVItQ=
printj@~1.1.0, printj@~1.1.2:
version "1.1.2"
resolved "https://registry.npm.taobao.org/printj/download/printj-1.1.2.tgz#d90deb2975a8b9f600fb3a1c94e3f4c53c78a222"
integrity sha1-2Q3rKXWoufYA+zoclOP0xTx4oiI=
progress@^2.0.0:
version "2.0.3"
resolved "https://registry.npm.taobao.org/progress/download/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8"
integrity sha1-foz42PW48jnBvGi+tOt4Vn1XLvg=
punycode@^2.1.0:
version "2.1.1"
resolved "https://registry.npm.taobao.org/punycode/download/punycode-2.1.1.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fpunycode%2Fdownload%2Fpunycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec"
integrity sha1-tYsBCsQMIsVldhbI0sLALHv0eew=
regexpp@^3.0.0, regexpp@^3.1.0:
version "3.1.0"
resolved "https://registry.npm.taobao.org/regexpp/download/regexpp-3.1.0.tgz#206d0ad0a5648cffbdb8ae46438f3dc51c9f78e2"
integrity sha1-IG0K0KVkjP+9uK5GQ489xRyfeOI=
resolve-from@^4.0.0:
version "4.0.0"
resolved "https://registry.npm.taobao.org/resolve-from/download/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6"
integrity sha1-SrzYUq0y3Xuqv+m0DgCjbbXzkuY=
rimraf@2.6.3:
version "2.6.3"
resolved "https://registry.npm.taobao.org/rimraf/download/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab"
integrity sha1-stEE/g2Psnz54KHNqCYt04M8bKs=
dependencies:
glob "^7.1.3"
semver@^7.2.1, semver@^7.3.2:
version "7.3.2"
resolved "https://registry.npm.taobao.org/semver/download/semver-7.3.2.tgz?cache=0&sync_timestamp=1586886267748&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsemver%2Fdownload%2Fsemver-7.3.2.tgz#604962b052b81ed0786aae84389ffba70ffd3938"
integrity sha1-YElisFK4HtB4aq6EOJ/7pw/9OTg=
shebang-command@^2.0.0:
version "2.0.0"
resolved "https://registry.npm.taobao.org/shebang-command/download/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea"
integrity sha1-zNCvT4g1+9wmW4JGGq8MNmY/NOo=
dependencies:
shebang-regex "^3.0.0"
shebang-regex@^3.0.0:
version "3.0.0"
resolved "https://registry.npm.taobao.org/shebang-regex/download/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172"
integrity sha1-rhbxZE2HPsrYQ7AwexQzYtTEIXI=
slice-ansi@^2.1.0:
version "2.1.0"
resolved "https://registry.npm.taobao.org/slice-ansi/download/slice-ansi-2.1.0.tgz#cacd7693461a637a5788d92a7dd4fba068e81636"
integrity sha1-ys12k0YaY3pXiNkqfdT7oGjoFjY=
dependencies:
ansi-styles "^3.2.0"
astral-regex "^1.0.0"
is-fullwidth-code-point "^2.0.0"
source-map-support@^0.5.19:
version "0.5.19"
resolved "https://registry.npm.taobao.org/source-map-support/download/source-map-support-0.5.19.tgz?cache=0&sync_timestamp=1587719289626&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsource-map-support%2Fdownload%2Fsource-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61"
integrity sha1-qYti+G3K9PZzmWSMCFKRq56P7WE=
dependencies:
buffer-from "^1.0.0"
source-map "^0.6.0"
source-map@^0.6.0:
version "0.6.1"
resolved "https://registry.npm.taobao.org/source-map/download/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
integrity sha1-dHIq8y6WFOnCh6jQu95IteLxomM=
sprintf-js@~1.0.2:
version "1.0.3"
resolved "https://registry.npm.taobao.org/sprintf-js/download/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=
ssf@~0.10.2:
version "0.10.3"
resolved "https://registry.npm.taobao.org/ssf/download/ssf-0.10.3.tgz#8eae1fc29c90a552e7921208f81892d6f77acb2b"
integrity sha1-jq4fwpyQpVLnkhII+BiS1vd6yys=
dependencies:
frac "~1.1.2"
string-width@^3.0.0:
version "3.1.0"
resolved "https://registry.npm.taobao.org/string-width/download/string-width-3.1.0.tgz#22767be21b62af1081574306f69ac51b62203961"
integrity sha1-InZ74htirxCBV0MG9prFG2IgOWE=
dependencies:
emoji-regex "^7.0.1"
is-fullwidth-code-point "^2.0.0"
strip-ansi "^5.1.0"
strip-ansi@^5.1.0:
version "5.2.0"
resolved "https://registry.npm.taobao.org/strip-ansi/download/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae"
integrity sha1-jJpTb+tq/JYr36WxBKUJHBrZwK4=
dependencies:
ansi-regex "^4.1.0"
strip-ansi@^6.0.0:
version "6.0.0"
resolved "https://registry.npm.taobao.org/strip-ansi/download/strip-ansi-6.0.0.tgz#0b1571dd7669ccd4f3e06e14ef1eed26225ae532"
integrity sha1-CxVx3XZpzNTz4G4U7x7tJiJa5TI=
dependencies:
ansi-regex "^5.0.0"
strip-json-comments@^3.1.0:
version "3.1.1"
resolved "https://registry.npm.taobao.org/strip-json-comments/download/strip-json-comments-3.1.1.tgz?cache=0&sync_timestamp=1594567543744&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fstrip-json-comments%2Fdownload%2Fstrip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006"
integrity sha1-MfEoGzgyYwQ0gxwxDAHMzajL4AY=
supports-color@^5.3.0:
version "5.5.0"
resolved "https://registry.npm.taobao.org/supports-color/download/supports-color-5.5.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsupports-color%2Fdownload%2Fsupports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f"
integrity sha1-4uaaRKyHcveKHsCzW2id9lMO/I8=
dependencies:
has-flag "^3.0.0"
supports-color@^7.1.0:
version "7.1.0"
resolved "https://registry.npm.taobao.org/supports-color/download/supports-color-7.1.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsupports-color%2Fdownload%2Fsupports-color-7.1.0.tgz#68e32591df73e25ad1c4b49108a2ec507962bfd1"
integrity sha1-aOMlkd9z4lrRxLSRCKLsUHliv9E=
dependencies:
has-flag "^4.0.0"
table@^5.2.3:
version "5.4.6"
resolved "https://registry.npm.taobao.org/table/download/table-5.4.6.tgz#1292d19500ce3f86053b05f0e8e7e4a3bb21079e"
integrity sha1-EpLRlQDOP4YFOwXw6Ofko7shB54=
dependencies:
ajv "^6.10.2"
lodash "^4.17.14"
slice-ansi "^2.1.0"
string-width "^3.0.0"
taobao-mini-sdk@^0.2.1:
version "0.2.1"
resolved "https://registry.npm.taobao.org/taobao-mini-sdk/download/taobao-mini-sdk-0.2.1.tgz#cbaaa5a2ca96437ca2a0e7c81eaf31f043d243ef"
integrity sha1-y6qlosqWQ3yioOfIHq8x8EPSQ+8=
dependencies:
"@types/mongodb" "^3.5.26"
text-table@^0.2.0:
version "0.2.0"
resolved "https://registry.npm.taobao.org/text-table/download/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4"
integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=
tslib@^1.8.1:
version "1.13.0"
resolved "https://registry.npm.taobao.org/tslib/download/tslib-1.13.0.tgz?cache=0&sync_timestamp=1596752024863&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ftslib%2Fdownload%2Ftslib-1.13.0.tgz#c881e13cc7015894ed914862d276436fa9a47043"
integrity sha1-yIHhPMcBWJTtkUhi0nZDb6mkcEM=
tsutils@^3.17.1:
version "3.17.1"
resolved "https://registry.npm.taobao.org/tsutils/download/tsutils-3.17.1.tgz#ed719917f11ca0dee586272b2ac49e015a2dd759"
integrity sha1-7XGZF/EcoN7lhicrKsSeAVot11k=
dependencies:
tslib "^1.8.1"
type-check@^0.4.0, type-check@~0.4.0:
version "0.4.0"
resolved "https://registry.npm.taobao.org/type-check/download/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1"
integrity sha1-B7ggO/pwVsBlcFDjzNLDdzC6uPE=
dependencies:
prelude-ls "^1.2.1"
type-fest@^0.8.1:
version "0.8.1"
resolved "https://registry.npm.taobao.org/type-fest/download/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d"
integrity sha1-CeJJ696FHTseSNJ8EFREZn8XuD0=
typescript@^3.9.7:
version "3.9.7"
resolved "https://registry.npm.taobao.org/typescript/download/typescript-3.9.7.tgz?cache=0&sync_timestamp=1597733591530&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ftypescript%2Fdownload%2Ftypescript-3.9.7.tgz#98d600a5ebdc38f40cb277522f12dc800e9e25fa"
integrity sha1-mNYApevcOPQMsndSLxLcgA6eJfo=
uri-js@^4.2.2:
version "4.2.2"
resolved "https://registry.npm.taobao.org/uri-js/download/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0"
integrity sha1-lMVA4f93KVbiKZUHwBCupsiDjrA=
dependencies:
punycode "^2.1.0"
v8-compile-cache@^2.0.3:
version "2.1.1"
resolved "https://registry.npm.taobao.org/v8-compile-cache/download/v8-compile-cache-2.1.1.tgz?cache=0&sync_timestamp=1590871613090&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fv8-compile-cache%2Fdownload%2Fv8-compile-cache-2.1.1.tgz#54bc3cdd43317bca91e35dcaf305b1a7237de745"
integrity sha1-VLw83UMxe8qR413K8wWxpyN950U=
which@^2.0.1:
version "2.0.2"
resolved "https://registry.npm.taobao.org/which/download/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1"
integrity sha1-fGqN0KY2oDJ+ELWckobu6T8/UbE=
dependencies:
isexe "^2.0.0"
word-wrap@^1.2.3:
version "1.2.3"
resolved "https://registry.npm.taobao.org/word-wrap/download/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c"
integrity sha1-YQY29rH3A4kb00dxzLF/uTtHB5w=
wrappy@1:
version "1.0.2"
resolved "https://registry.npm.taobao.org/wrappy/download/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=
write@1.0.3:
version "1.0.3"
resolved "https://registry.npm.taobao.org/write/download/write-1.0.3.tgz#0800e14523b923a387e415123c865616aae0f5c3"
integrity sha1-CADhRSO5I6OH5BUSPIZWFqrg9cM=
dependencies:
mkdirp "^0.5.1"
xlsx@^0.14.1:
version "0.14.5"
resolved "https://registry.npm.taobao.org/xlsx/download/xlsx-0.14.5.tgz?cache=0&sync_timestamp=1596167131125&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fxlsx%2Fdownload%2Fxlsx-0.14.5.tgz#3637e914d791bdca7382816e173f7d725ed0e0d2"
integrity sha1-NjfpFNeRvcpzgoFuFz99cl7Q4NI=
dependencies:
adler-32 "~1.2.0"
cfb "^1.1.2"
codepage "~1.14.0"
commander "~2.17.1"
crc-32 "~1.2.0"
exit-on-epipe "~1.0.1"
ssf "~0.10.2"
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