Commit d0237f22 authored by qinhaitao's avatar qinhaitao

init: ts

parent a6d6a813
No preview for this file type
......@@ -8,10 +8,5 @@ module.exports = [
type: 'input',
name: 'description',
message: 'description?',
},
{
type: 'input',
name: 'consumerId',
message: '消费端id?',
}
]
\ No newline at end of file
{
"cloud": {
"type": "CLOUDAPP"
}
}
{
"templates": [
{
"name": "c_server",
"branch": "c_server",
"name": "c_server_ts",
"branch": "c_server_ts",
"tags": [
{
"desc": "通用模板",
"version": "v1.0"
"version": "2.0"
}
]
}
]
}
\ No newline at end of file
}
const { pipeActivityInfo } = require('./base.controller');
const UserService = require('../service/user.service');
const AwardsService = require('../service/awards.service');
const { CODE_TYPES } = require('../constants');
const { ResultsModel } = require('../sdk');
let resultModel = new ResultsModel();
/**
* 我的奖品列表
* @param {*} context
*/
const getMyPrizeList = async (context) => {
// 判断活动
let pipeRes = await pipeActivityInfo(context);
// 活动结束可以查看我的奖品
if (pipeRes.code && pipeRes.code !== CODE_TYPES.ERROR_ACTIVITY_OVER.code) {
return pipeRes;
}
let awardSer = new AwardsService(context);
let result = await awardSer.getMyPrizeList({openId: context.openId, activityId: context.data.activityId});
return resultModel.success(result);
}
/**
* 领取实物
* @param {*} context
*/
const receiveObjectPrize = async(context) => {
// 判断活动
let pipeRes = await pipeActivityInfo(context);
// 活动结束可以领取实物
if (pipeRes.code && pipeRes.code !== CODE_TYPES.ERROR_ACTIVITY_OVER.code) {
return pipeRes;
}
let { provice, city, area, addressdetail, _id, name, phone, activityId } = context.data;
if (!_id) {
return resultModel.error(CODE_TYPES.PARAMS_ERROR, `缺少_id`)
}
if (!name) {
return resultModel.error(CODE_TYPES.PARAMS_ERROR, `缺少name`)
}
if (!phone) {
return resultModel.error(CODE_TYPES.PARAMS_ERROR, `缺少phone`)
}
if (!provice) {
return resultModel.error(CODE_TYPES.PARAMS_ERROR, `缺少provice`)
}
if (!city) {
return resultModel.error(CODE_TYPES.PARAMS_ERROR, `缺少city`)
}
if (!area) {
return resultModel.error(CODE_TYPES.PARAMS_ERROR, `缺少area`)
}
if (!addressdetail) {
return resultModel.error(CODE_TYPES.PARAMS_ERROR, `缺少addressdetail`)
}
let awardSer = new AwardsService(context);
let result = await awardSer.recieveObjectPrize(_id, {activityId, provice, city, area, addressdetail, name, phone});
if (result.code) {
return resultModel.error(result);
}
return resultModel.success(result);
}
/**
* 权益重新领取
* @param {*} context
*/
const receiveEnamePrize = async(context) => {
let pipeRes = await pipeActivityInfo(context);
// 活动结束可以领取权益
if (pipeRes.code && pipeRes.code !== CODE_TYPES.ERROR_ACTIVITY_OVER.code) {
return pipeRes;
}
let {_id} = context.data;
if (!_id) {
return resultModel.error(CODE_TYPES.PARAMS_ERROR, `缺少_id`)
}
let awardsSer = new AwardsService(context);
let result = await awardsSer.recieveEnamePrize(_id, pipeRes._id);
if (result.code) {
return resultModel.error(result);
}
if (result.remark) {
return resultModel.error(result, result.remark);
}
return resultModel.success(result);
}
module.exports = {
getMyPrizeList,
receiveObjectPrize,
receiveEnamePrize
}
\ No newline at end of file
const BaseService = require('../service/base.service');
const { CODE_TYPES, ACTIVITY_STATUS } = require('../constants');
const { ResultsModel } = require('../sdk');
let resultModel = new ResultsModel();
// 活动判断
const pipeActivityInfo = async (context) => {
let activitySer = new BaseService(context);
let { activityId } = context.data;
// 参数校验
if (!activityId) {
return resultModel.error(CODE_TYPES.PARAMS_ERROR, `activityId必填`);
}
// 活动基本情况
let activityInfo = await activitySer.getBaseInfo(activityId);
// 活动不存在
if (!activityInfo || activityInfo.deleteStatus === ACTIVITY_STATUS.DELETE) {
return resultModel.error(CODE_TYPES.ERROR_NO_ACTIVITY);
}
let { startTime, endTime } = activityInfo;
let currentTime = Date.now();
if (currentTime < startTime) {
return resultModel.error(CODE_TYPES.ERROR_ACTIVITY_NOSTART, `活动未开始`);
}
if (currentTime > endTime) {
return resultModel.error(CODE_TYPES.ERROR_ACTIVITY_OVER, `活动已结束`);
}
return activityInfo;
}
// 活动基本信息
const getActivityBaseInfoById = async(context) => {
let activitySer = new BaseService(context);
let { activityId } = context.data;
// 参数校验
if (!activityId) {
return resultModel.error(CODE_TYPES.PARAMS_ERROR, `activityId必填`);
}
// 活动基本情况
let activityInfo = await activitySer.getBaseInfo(activityId);
return resultModel.success(activityInfo);
}
module.exports = {
pipeActivityInfo,
getActivityBaseInfoById
}
\ No newline at end of file
const ACCESS_DB_NAME = 'c_user_access';
const USER_DB_NAME = 'c_user';
const AWARDS_DB_NAME = 'c_awards_info';
const ERROR_LOG_DB_NAME = 'error_log';
const SELLER_INFO_DB_NAME = 'a_seller_info';
const PRIZE_CONFIG_DB_NAME = 'b_prize_config';
const ACTIVITY_CONFIG_DB_NAME = 'b_activity_config';
module.exports = {
ACCESS_DB_NAME,
USER_DB_NAME,
AWARDS_DB_NAME,
ERROR_LOG_DB_NAME,
SELLER_INFO_DB_NAME,
PRIZE_CONFIG_DB_NAME,
ACTIVITY_CONFIG_DB_NAME
}
const {
getActivityBaseInfoById
} = require('./controller/base.controller');
const {
getMyPrizeList,
receiveObjectPrize,
receiveEnamePrize
} = require('./controller/awards.controller');
module.exports = {
getActivityBaseInfoById,
getMyPrizeList,
receiveObjectPrize,
receiveEnamePrize
}
\ No newline at end of file
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;
}
}
module.exports = BaseDao;
\ No newline at end of file
{
"name": "<%=projectName%>",
"version": "1.0.0",
"description": "<%=description%>",
"main": "index.js",
"author": "<%=author%>",
"license": "ISC",
"sdkVersion": "*",
"dependencies": {
"node-xlsx": "^0.15.0",
"taobao-mini-sdk": "0.1.2",
"dayjs": "^1.8.28"
},
"config": {
"notNeedLogin": [
]
}
}
// 特别注意以下的引用方式,需要.default
const { BaseDao, TBAPI, Utils } = require('taobao-mini-sdk/lib/index').default;
const { DEFAULT_CODE_TYPES, dateFormatter,transformBeijingDate,getStartTimestamp,getEndTimestamp, ResultsModel} = Utils.default;
const TBAPIS = TBAPI.default;
let default_sdk = {
DEFAULT_CODE_TYPES,
ResultsModel,
dateFormatter,
getStartTimestamp,
getEndTimestamp
};
let Config
let mock = process.argv[2];
console.log(`mock`, mock);
// 云函数环境
if (mock !== 'mock') {
Config = Object.assign({}, default_sdk, {
BaseDao,
TBAPIS,
transformBeijingDate
});
}
// 本地环境
else {
let MockConfig = require('./mockServer/sdk');
Config = Object.assign({}, default_sdk, MockConfig);
console.log(Config);
}
module.exports = Config;
/**
* 用户相关方法
*/
const { BaseDao, TBAPIS } = require('../sdk');
const BaseService = require('./base.service');
const { USER_DB_NAME } = require('../db');
class UserService extends BaseService{
constructor(context) {
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) {
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) {
// 会员mock,当传递的参数有vipmock: true,则表示已经是会员
let { vipmock = false} = this.context.data;
if (vipmock) {
return {
isvip: true
}
}
let result = {}
let shopUrl = {};
try{
result = await TBAPIS.queryVipinfo(this.context, session);
shopUrl = await TBAPIS.getShopVipUrl(this.context, session, {
"source": "isvapp", "entrance": "duiba"
});
}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
}
}
/**
* @desc 更新用户表
* @param {用户的主键id} _id
* @param {更新的对象} document
* @returns 若更新成功,返回为1; 若更新失败,返回为 0 或系统直接报错
*/
async updateUser(_id, document) {
console.log(document);
return await this.userdao.update({_id}, {$set: {
...document,
updateTime: Date.now()
}});
}
/**
* @desc 根据用户主键id查找用户详情
* @param {用户的主键id} _id
* @returns 若用户不存在,返回null; 用户存在,返回用户信息(object对象)
*/
async getUserInfoById(_id) {
return await this.userdao.findOne({_id});
}
}
module.exports = UserService;
\ No newline at end of file
// 获取商家session
const getSellerSession = require('./package/getSession');
// 获取当天时间进行format
const getToday = require('./package/getToday');
// 发放淘宝奖品(权益/积分)
const sendTBAward = require('./package/sendTBAward');
// 通用并发接口
const lockUpdate = require('./package/lockUpdate');
// 用户订单
const getUserOrderlist = require('./package/getUserOrderlist');
module.exports = {
getSellerSession,
getToday,
sendTBAward,
lockUpdate,
getUserOrderlist
}
/**
* 获取商家session
*/
const { SELLER_INFO_DB_NAME, ACTIVITY_CONFIG_DB_NAME } = require('../../db');
const { BaseDao } = require('../../sdk')
const getSellerSession = async (context, activityId) => {
if (!activityId) {
activityId = context.data.activityId;
}
let activitydao = new BaseDao(context, ACTIVITY_CONFIG_DB_NAME)
let sellerdao = new BaseDao(context, SELLER_INFO_DB_NAME)
let activityConfigResult = await activitydao.find({ _id: activityId });
if (!activityConfigResult || !activityConfigResult[0]) return {};
let result = await sellerdao.find({
openId: activityConfigResult[0].openId
});
console.log(`getSellerSession`, result);
if (!result || !result[0]) return {};
return {
session: result[0].accessToken
};
}
module.exports = getSellerSession;
\ No newline at end of file
const { transformBeijingDate, dateFormatter } = require('../../sdk');
// 获取今天的时间
const getToday = ()=> {
return dateFormatter(transformBeijingDate(), 'yyyy/MM/dd');
}
module.exports = getToday;
\ No newline at end of file
const {CODE_TYPES} = require('../../constants');
/**
* 并发更新
* @param {接收数组或对象} daoqueryArr : [{dao: userdao, query:{_id:_id}}, {dao: activityprizedao, query: {userNick, status ...}}]
* @param {*} fn
* @param {*} times
*/
const lockUpdate = async(daoqueryArr, fn, times=5) => {
if (typeof daoqueryArr !=='object') {
console.log(`lockUpdate 参数错误`);
return false;
}
if (!daoqueryArr instanceof Array) {
daoqueryArr = [daoqueryArr];
}
let time = 0;
console.log(`进入update并发处理次数`, times);
let success = false;
try{
while (time++ < times && !success) {
// 依次锁住表
let updateRes = [];
let error = false
for(let i = 0; i < daoqueryArr.length; i++) {
let daoquery = daoqueryArr[i];
if (!daoquery.dao || !daoquery.query) {
success = true;
error = true
console.log(`daoquery`, daoquery)
break
}else {
console.log(`daoquery`, daoquery)
let canupdate = await daoquery.dao.update(daoquery.query, {$set: {lockStatus: 2}});
updateRes.push(canupdate);
}
}
if (error) {
return `调用lockUpdate方法参数不符合规范`
}
console.log(`updateRes`, updateRes)
// 若都锁定成功了,执行内部调用
if (updateRes.every((v) => v === 1)) {
const ret = await fn();
console.log(`完成调用,解锁操作执行--------------`);
daoqueryArr.forEach(async daoquery => {
console.log(daoquery)
let ures = await daoquery.dao.update(daoquery.query, {$set: {lockStatus: 1}});
console.log(`更新lockStatus为1`, 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为1`, ures);
});
success = false;
}
console.log(`daoqueryArr`, daoqueryArr)
// 稍后重试
if (!success) {
daoqueryArr.forEach(async daoquery => {
console.log(daoquery)
let ures = await daoquery.dao.update(daoquery.query, {$set: {lockStatus: 1}});
console.log(`操作${times}次后更新lockStatus为1`, ures);
});
return CODE_TYPES.ERROR_UPDATE_RETRY;
}
function waitFor(ms) {
return new Promise(resolve => {
setTimeout(resolve, ms)
});
}
}
module.exports = lockUpdate;
/**
* 调用示例
*/
// let res = await lockUpdate({dao: this.activityprizedao, query: {_id}}, async ()=> {
// TODO...
// });
// console.log(res);
// if (!res) {
// return CODE_TYPES.ERROR_UPDATE_RETRY;
// }
// return true;
const { PRIZE_TYPE, DRAW_STATUS, C_APP_NAME, TBERROR, CODE_TYPES } = require('../../constants');
const { TBAPIS } = require('../../sdk');
/**
* 发奖,包含权益,实物,积分
* @param {*} document 必须要有{ type, ename, _id }
* @param {*} session
* @param {*} context
*/
const sendTBAward = async (context, session, document) => {
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.SYSTEM_ERROR;
}
}
/**
* 发放积分
* @param {发放的积分数} credits
* @param {*} session
* @param {*} context
* @returns {drawStatus, remark}
*/
const sendCredits = async (credits, session, context) => {
let drawStatus = '';
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 }
*/
const sendEname = async (ename, uniqueId, session, context) => {
let result = {};
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 = '';
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};
}
module.exports = sendTBAward;
\ No newline at end of file
/** @format */
module.exports = {
parser: '@typescript-eslint/parser',
extends: ['prettier/@typescript-eslint', 'plugin:prettier/recommended'],
parserOptions: {
ecmaVersion: 2019,
sourceType: 'module'
},
env: {
browser: true,
node: true
}
}
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
cnpm install
```
```bash
cd mockServer
```
```bash
cnpm install
```
```bash
➜ mockServer npm run start
```
# 通用模板
## 库表规范
http://cf.dui88.com/pages/viewpage.action?pageId=63937755
......@@ -20,3 +6,4 @@ http://cf.dui88.com/pages/viewpage.action?pageId=63937755
## sdk 接口文档说明
http://cf.dui88.com/pages/viewpage.action?pageId=66194323
## 模板说明
/** @format */
interface Iconfig {
VIP_CALLBACK_URL: string;
}
export declare const getConfig: (context: Context) => 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
};
exports.getConfig = function (context) {
var env = context.env;
return configs[env] || configs.test;
};
//# 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;CACL,CAAA;AAEY,QAAA,SAAS,GAAG,UAAC,OAAgB;IACxC,IAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAA;IACvB,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,IAAI,CAAA;AACrC,CAAC,CAAA"}
\ No newline at end of file
/** @format */
declare const _default: {
VIP_CALLBACK_URL: string;
};
export default _default;
"use strict";
/** @format */
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = {
VIP_CALLBACK_URL: 'testUrl'
};
//# 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,kBAAe;IACb,gBAAgB,EAAE,SAAS;CAC5B,CAAA"}
\ No newline at end of file
declare const _default: {
VIP_CALLBACK_URL: string;
};
/** @format */
export default _default;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/** @format */
exports.default = {
VIP_CALLBACK_URL: 'onlineUrl'
};
//# 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,gBAAgB,EAAE,WAAW;CAC9B,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_NEEDMEMBER_DOHELP: {
code: string;
defaultMsg: string;
};
ERROR_NO_VIP: {
code: string;
defaultMsg: string;
};
ERROR_TASK_ALREADYRECEIVE: {
code: string;
defaultMsg: string;
};
ERROR_TASK_COMPLETE: {
code: string;
defaultMsg: string;
};
ERROR_TASK_NORECEIVE: {
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_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_NEEDMEMBER_DOHELP: {
code: string;
defaultMsg: string;
};
ERROR_NO_VIP: {
code: string;
defaultMsg: string;
};
ERROR_TASK_ALREADYRECEIVE: {
code: string;
defaultMsg: string;
};
ERROR_TASK_COMPLETE: {
code: string;
defaultMsg: string;
};
ERROR_TASK_NORECEIVE: {
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_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 PRIZE_TYPE: {
ENAME: number;
CREDITS: number;
OBJECT: number;
THANKS: number;
};
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 TASK_RATE_TYPE: {
FOREVER: number;
EVERYDAY: number;
NOLIMIT: number;
};
export declare const RECORD_TYPE: {
FOLLOW_TASK: {
type: number;
name: string;
};
SIGN_TASK: {
type: number;
name: string;
};
RECEIVE_INVITE: {
type: number;
name: string;
};
INVITE_SUCCESS: {
type: number;
name: string;
};
};
"use strict";
/** @format */
Object.defineProperty(exports, "__esModule", { value: true });
exports.RECORD_TYPE = exports.TASK_RATE_TYPE = exports.TAOBAO_SUCCESS_ORDER_STATUS = exports.C_APP_NAME = exports.PRIZE_TYPE = 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_NEEDMEMBER_DOHELP: {
code: "310004",
defaultMsg: '需要成为会员才能助力哦'
},
// 非店铺会员
ERROR_NO_VIP: {
code: "310005",
defaultMsg: '非店铺会员'
},
// 任务奖励已领取
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_TASK_NORECEIVE: {
code: "430003",
defaultMsg: "\u6682\u65E0\u6B21\u6570\u53EF\u9886\u53D6"
},
ERROR_INVALID_INVITE_ID: {
code: "430004",
defaultMsg: "\u9080\u8BF7\u7801\u65E0\u6548"
},
ERROR_NO_CREDITS: {
code: "430005",
defaultMsg: "\u79EF\u5206\u4E0D\u8DB3"
},
ERROR_TASK_LIMIT: {
code: "430006",
defaultMsg: "\u4ECA\u65E5\u5B8C\u6210\u8BE5\u4EFB\u52A1\u6B21\u6570\u8D85\u9650"
},
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.PRIZE_TYPE = {
ENAME: 1,
CREDITS: 2,
OBJECT: 3,
THANKS: 5
};
// C端的APP NAME
exports.C_APP_NAME = 'promotioncenter-${需要补充}';
// 订单状态
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.RECORD_TYPE = {
FOLLOW_TASK: { type: 1, name: '关注店铺任务' },
SIGN_TASK: { type: 2, name: '签到任务' },
RECEIVE_INVITE: { type: 3, name: '接受邀请' },
INVITE_SUCCESS: { type: 4, name: '邀请成功' }
};
//# 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,QAAA,aAAa,GAAG;IAC3B,iBAAiB;IACjB,kBAAkB,EAAE;QAClB,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,0BAAM;KACnB;IACD,QAAQ;IACR,iBAAiB,EAAE;QACjB,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,gCAAO;KACpB;IACD,QAAQ;IACR,sBAAsB,EAAE;QACtB,IAAI,EAAE,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EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE;IACpC,cAAc,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE;IACzC,cAAc,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE;CAC1C,CAAA"}
\ No newline at end of file
/** @format */
import { AwardsService, BaseService } from '../service';
export default class AwardsController {
/**
* 我的奖品列表
*/
getMyPrizeList(context: Context, {}: {}, [awardSer]: [AwardsService]): Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result>;
/**
* 领取实物
*/
receiveObjectPrize(context: Context, {}: {}, [awardSer]: [AwardsService]): Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result>;
/**
* 权益重新领取
*/
receiveEnamePrize(context: Context, {}: {}, [awardSer, baseService]: [AwardsService, BaseService]): Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result>;
}
"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 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 result;
return __generator(this, function (_c) {
switch (_c.label) {
case 0: return [4 /*yield*/, awardSer.getMyPrizeList({ openId: context.openId, activityId: context.data.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
})
//@ts-ignore
];
case 1:
result = _d.sent();
//@ts-ignore
if (result.code) {
//@ts-ignore
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], baseService = _b[1];
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)];
}
});
});
};
__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, service_1.BaseService]),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object, Array]),
__metadata("design:returntype", Promise)
], AwardsController.prototype, "receiveEnamePrize", 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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGd,0CAA+D;AAE/D,8BAAqC;AACrC,sCAAuD;AACvD;IAAA;IA4DA,CAAC;IA3DC;;OAEG;IAIG,yCAAc,GAApB,UAAqB,OAAgB,EAAE,EAAE,EAAE,EAA2B;YAA1B,QAAQ,QAAA;;;;;4BACrC,qBAAM,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,EAAA;;wBAAvG,MAAM,GAAG,SAA8F;wBAC3G,sBAAO,kBAAY,CAAC,OAAO,CAAC,MAAM,CAAC,EAAA;;;;KACpC;IAED;;OAEG;IAIG,6CAAkB,GAAxB,UAAyB,OAAgB,EAAE,EAAE,EAAE,EAA2B;YAA1B,QAAQ,QAAA;;;;;;wBAClD,KAAwE,OAAO,CAAC,IAAI,EAAlF,QAAQ,cAAA,EAAE,IAAI,UAAA,EAAE,IAAI,UAAA,EAAE,aAAa,mBAAA,EAAE,GAAG,SAAA,EAAE,IAAI,UAAA,EAAE,KAAK,WAA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AC9B,oBAAQ,CAAC,CAAC,uBAAa,CAAC,CAAC;;;;0DAIzB;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;;;;8DAmBzB;IAQD;QAHC,uBAAW,CAAC,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;QAClC,qBAAS,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;QAC9B,oBAAQ,CAAC,CAAC,uBAAa,EAAE,qBAAW,CAAC,CAAC;;;;6DAgBtC;IACH,uBAAC;CAAA,AA5DD,IA4DC;kBA5DoB,gBAAgB"}
\ No newline at end of file
/** @format */
import { BaseService } from '../service';
export default class BaseController {
/**
* 活动基本信息
*/
getActivityBaseInfoById(context: Context, {}: {}, [baseService]: [BaseService]): Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result>;
}
"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)];
}
});
});
};
__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);
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;AACrC,sCAAwC;AACxC;IAAA;IAgBA,CAAC;IAfC;;OAEG;IAGG,gDAAuB,GAA7B,UAA8B,OAAgB,EAAE,EAAE,EAAE,EAA4B;YAA3B,WAAW,QAAA;;;;;;wBACtD,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;IATD;QAFC,uBAAW,CAAC,CAAC,YAAY,CAAC,CAAC;QAC3B,oBAAQ,CAAC,CAAC,qBAAW,CAAC,CAAC;;;;iEAUvB;IACH,qBAAC;CAAA,AAhBD,IAgBC;kBAhBoB,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;
This diff is collapsed.
{"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,IAAM,YAAY,GAAG,IAAI,kBAAY,EAAE,CAAC;AAE3B,QAAA,WAAW,GAAG,sBAAU,CACnC;IACE,uBAAW,CAAC,CAAC,YAAY,CAAC,CAAC;IAC3B,qBAAS,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IAC9B,oBAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;CAC/B,EACD,CAAE,qBAAW,EAAE,uBAAa,EAAE,uBAAa,EAAE,uBAAa,CAAE,CAC7D,CAAC,UACA,OAAgB,EAChB,EAAqB,EACrB,EAA0H;QADxH,QAAQ,cAAA,EAAE,OAAO,aAAA;QACjB,WAAW,QAAA,EAAE,aAAa,QAAA,EAAE,aAAa,QAAA,EAAE,aAAa,QAAA;;;;;;oBAGlD,MAAM,GAA2B,OAAO,OAAlC,EAAU,UAAU,GAAO,OAAO,gBAAd,CAAe;oBAEzC,WAAW,GAA+E,QAAQ,YAAvF,EAAE,WAAW,GAAkE,QAAQ,YAA1E,EAAE,UAAU,GAAsD,QAAQ,WAA9D,EAAE,GAAG,GAAiD,QAAQ,IAAzD,EAAE,cAAc,GAAiC,QAAQ,eAAzC,EAAE,0BAA0B,GAAK,QAAQ,2BAAb,CAAc;oBAEnG,iBAAiB,GAAuC,4BAAg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AAK,OAAA;wBACL,QAAQ,UAAA;qBACT,CAAC,EAAA;;;;CAEH,CAAC,CAAA;AAEW,QAAA,cAAc,GAAG,sBAAU,CACtC,EAAE,CACH,CAAC;;;QAEM,QAAQ,GAAG,IAAI,IAAI,CAAC,+BAAmB,CAAC,CAAC,OAAO,EAAE,CAAC;QAEzD,sBAAO,YAAY,CAAC,OAAO,CAAC;gBAC1B,MAAM,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,QAAQ;aAC/B,CAAC,EAAA;;KAEH,CAAC,CAAA;AAGW,QAAA,gBAAgB,GAAG,sBAAU,CACxC,EAAE,CACH,CAAC,UAAO,OAAgB;;;;oBAEH,qBAAM,OAAO,CAAC,KAAK,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, BaseService, AccessService } from '../service';
export default class Share {
/**
* 完成分享
*/
insertShareRecord(context: Context, { userInfo, vipInfo, activityInfo }: IControllerInfos, [userService, baseService, accessService]: [UserService, BaseService, AccessService]): Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result>;
}
"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");
// {
// "handler": "doFollowTask",
// "data": {
// "activityId": "5f213791964f9706aa59b192"
// }
// }
var Share = /** @class */ (function () {
function Share() {
}
/**
* 完成分享
*/
Share.prototype.insertShareRecord = function (context, _a, _b) {
var userInfo = _a.userInfo, vipInfo = _a.vipInfo, activityInfo = _a.activityInfo;
var userService = _b[0], baseService = _b[1], accessService = _b[2];
return __awaiter(this, void 0, void 0, function () {
var _c, activityId, inviteId, openId, inviteUserInfo, isFirstLogin, isValidShare, tasks, value, today, inviteUserId;
var _d;
return __generator(this, function (_e) {
switch (_e.label) {
case 0:
_c = context.data, activityId = _c.activityId, inviteId = _c.inviteId;
openId = context.openId;
return [4 /*yield*/, userService.getUserInfoByOpenId(inviteId)
// inviteId的用户信息查询不到, 则inviteId无效
];
case 1:
inviteUserInfo = _e.sent();
// inviteId的用户信息查询不到, 则inviteId无效
if (!inviteUserInfo)
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.ERROR_INVALID_INVITE_ID)];
return [4 /*yield*/, accessService.getAccessCount()];
case 2:
isFirstLogin = (_e.sent()) === 1;
isValidShare = [isFirstLogin].every(function (v) { return !!v; });
tasks = activityInfo.tasks;
value = (tasks || {}).inviteFriends.value;
today = utils_1.getToday();
if (!isValidShare) return [3 /*break*/, 4];
inviteUserId = inviteUserInfo._id;
// 增加邀请人的待领取次数和邀请记录
return [4 /*yield*/, userService.updateUser(inviteUserId, {
$inc: {
'remainTimes.invites': value
},
$push: (_d = {},
_d["taskInfo." + today + ".invites"] = { openId: openId, createTime: Date.now() },
_d)
})];
case 3:
// 增加邀请人的待领取次数和邀请记录
_e.sent();
_e.label = 4;
case 4: 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.BaseService, service_1.AccessService]),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object, Array]),
__metadata("design:returntype", Promise)
], Share.prototype, "insertShareRecord", 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,kCAAqD;AACrD,sCAAoE;AAEpE,IAAI;AACJ,+BAA+B;AAC/B,cAAc;AACd,+CAA+C;AAC/C,MAAM;AACN,IAAI;AACJ;IAAA;IAoDA,CAAC;IAnDC;;OAEG;IAIG,iCAAiB,GAAvB,UACE,OAAgB,EAChB,EAAqD,EACrD,EAAoF;YADlF,QAAQ,cAAA,EAAE,OAAO,aAAA,EAAE,YAAY,kBAAA;YAChC,WAAW,QAAA,EAAE,WAAW,QAAA,EAAE,aAAa,QAAA;;;;;;;wBAElC,KAA2B,OAAO,CAAC,IAAI,EAArC,UAAU,gBAAA,EAAE,QAAQ,cAAA,CAAiB;wBACrC,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;wBAEnD,qBAAM,aAAa,CAAC,cAAc,EAAE,EAAA;;wBAA7D,YAAY,GAAY,CAAC,SAAoC,CAAC,KAAK,CAAC;wBAMpE,YAAY,GAAG,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,CAAC,EAAH,CAAG,CAAC,CAAA;wBAG3C,KAAK,GAAK,YAAY,MAAjB,CAAiB;wBAGX,KAAK,GACZ,CAAA,KAAK,IAAI,EAAE,CAAA,oBADC,CACD;wBAIjB,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;IA5CD;QAHC,mBAAW,CAAC,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;QACvC,yBAAiB;QACjB,mBAAQ,CAAC,CAAC,qBAAW,EAAE,qBAAW,EAAE,uBAAa,CAAC,CAAC;;;;kDA6CnD;IACH,YAAC;CAAA,AApDD,IAoDC;kBApDoB,KAAK"}
\ No newline at end of file
/** @format */
/** @format */
export default class StatController {
/**
* 统计数据
*/
getStats(context: Context): Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result>;
}
This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AAO,CAAC,MAAM,CAAC,GAAG,CAAC,EAAA;;;wBAEvC,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,AAzKD,IAyKC"}
\ 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,OAAO,CAAC,EAAE,CAAC,EAAA;;;KAChC;IAED;;OAEG;IAIG,2BAAY,GAAlB,UACE,OAAgB,EAChB,EAA8B,EAC9B,EAAsD;YADpD,QAAQ,cAAA;YACT,WAAW,QAAA,EAAE,WAAW,QAAA;;;;;;wBAEjB,UAAU,GAAK,OAAO,CAAC,IAAI,WAAjB,CAAiB;wBAE7B,WAAW,GAA4B,QAAQ,YAApC,EAAE,GAAG,GAAuB,QAAQ,IAA/B,EAAE,QAAQ,GAAa,QAAQ,SAArB,EAAE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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 { UserService, TaskService } from '../service';
export default class Task {
/**
* 任务列表
*/
getTaskList(context: Context, { userInfo, vipInfo, activityInfo, session }: IControllerInfos, [taskService]: [TaskService]): Promise<Result>;
/**
* 完成关注店铺任务
*/
doFollowTask(context: Context, { userInfo, activityInfo }: IControllerInfos, [TaskService]: [TaskService]): Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result>;
/**
* 积分兑换次数
*/
doExchangeCreditsTask(context: Context, { userInfo, activityInfo, session }: IControllerInfos, [userService, taskService]: [UserService, TaskService]): Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result>;
/**
* 浏览商品
*/
doBrowseGoodsTask(context: Context, { userInfo, activityInfo }: IControllerInfos, [taskService]: [TaskService]): Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result>;
}
This diff is collapsed.
{"version":3,"file":"task.controller.js","sourceRoot":"","sources":["../../src/controller/task.controller.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEd,4CAA2D;AAC3D,0CAA2F;AAE3F,8BAA6C;AAC7C,kCAAqD;AACrD,sCAAkE;AAElE,IAAI;AACJ,8BAA8B;AAC9B,cAAc;AACd,+CAA+C;AAC/C,MAAM;AACN,IAAI;AACJ;IAAA;IAgKA,CAAC;IA/JC;;OAEG;IAKG,0BAAW,GAAjB,UACE,OAAgB,EAChB,EAA8D,EAC9D,EAA4B;YAD1B,QAAQ,cAAA,EAAE,OAAO,aAAA,E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C,YAAY,EAAE,SAAS,CAAC,CAAC;QACtC,qBAAS,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;QAC9B,6BAAiB;QACjB,oBAAQ,CAAC,CAAC,qBAAW,EAAE,qBAAW,CAAC,CAAC;;;;qDA6CpC;IASD;QAJC,uBAAW,CAAC,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QACrC,qBAAS,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;QAC9B,6BAAiB;QACjB,oBAAQ,CAAC,CAAC,qBAAW,CAAC,CAAC;;;;iDA0CvB;IACH,WAAC;CAAA,AAhKD,IAgKC;kBAhKoB,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';
interface IVipContext extends Context {
data: {
activityId: string;
callbackUrl?: string;
};
}
interface ILoginContext extends Context {
data: {
activityId: string;
userNick: string;
avatar: string;
isFollow: boolean;
inviteId?: string;
};
}
export default class User {
/**
* 登录接口, 初始化/更新用户信息
*/
login(context: ILoginContext, { userInfo, vipInfo, activityInfo }: IControllerInfos, [userService, accessService]: [UserService, AccessService]): Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result>;
/**
* 获取会员信息
*/
getVipInfo(context: IVipContext, { session, activityUserNick }: IControllerInfos, [userService]: [UserService]): Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result>;
}
export {};
"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)];
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 callbackUrl, VIP_CALLBACK_URL, result;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
callbackUrl = context.data.callbackUrl;
VIP_CALLBACK_URL = config_1.getConfig(context).VIP_CALLBACK_URL;
return [4 /*yield*/, userService.getShopVip(session, activityUserNick, callbackUrl || VIP_CALLBACK_URL)];
case 1:
result = _c.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,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EvG,sBAAO,kBAAY,CAAC,OAAO,CAAC,MAAM,CAAC,EAAA;;;;KACpC;IArCD;QAHC,uBAAW,CAAC,CAAC,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;QAC7D,6BAAiB;QACjB,oBAAQ,CAAC,CAAC,qBAAW,EAAE,uBAAa,CAAC,CAAC;;;;qCAsBtC;IAMD;QAFC,uBAAW,CAAC,CAAC,YAAY,CAAC,CAAC;QAC3B,oBAAQ,CAAC,CAAC,qBAAW,CAAC,CAAC;;;;0CAWvB;IACH,WAAC;CAAA,AA7CD,IA6CC;kBA7CoB,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 RECORD_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.RECORD_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.RECORD_DB_NAME = "c_user_record";
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,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");
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, userService, session, vipInfo;
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*/, utils_1.getSellerSession(context)];
case 1:
session = (_b.sent()).session;
return [4 /*yield*/, userService.getShopVip(session, callbackUrl)];
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();
console.log(activityInfo, 'activityInfo');
// 活动不存在
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;AAE9B,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;YAA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AAO,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,OAAO,wBAAO,SAAS,KAAE,YAAY,cAAA,IAAG,CAAC,EAAA;;;;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.logger(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,kCAAmE;AACnE,8BAAqC;AACrC,0CAAyC;AACzC,SAAe,YAAY,CAAC,OAAgB,EAAE,SAA2B;;;;;;oBACjE,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,CAA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6BACpE;;;;4BAGC,cAAM,CAAC,OAAO,CAAC,CAAA;4BACT,qBAAM,MAAM,CAAC,KAAK,CAAC,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: {};
export default _default;
"use strict";
/** @format */
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = require("./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");
exports.default = utils_1.exportHandlers([user_controller_1.default, task_controller_1.default, base_controller_1.default, awards_controller_1.default, share_controller_1.default]);
//# 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,iCAAwC;AACxC,gEAAyD;AACzD,gEAAyD;AACzD,gEAAyD;AACzD,oEAA6D;AAC7D,kEAA2D;AAE3D,kBAAe,sBAAc,CAAC,CAAC,yBAAc,EAAE,yBAAc,EAAE,yBAAc,EAAE,2BAAgB,EAAE,0BAAe,CAAC,CAAC,CAAA"}
\ 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
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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