Commit 0d074ef4 authored by qinhaitao's avatar qinhaitao

refactor: 💡 B C端任务字段统一

parent 2c9db784
...@@ -30,11 +30,11 @@ export default class AwardsController { ...@@ -30,11 +30,11 @@ export default class AwardsController {
/** /**
* 权益重新领取 * 权益重新领取
*/ */
receiveEnamePrize(context: IContext<IReceiveEnameParams>, {}: {}, [awardSer]: [AwardsService]): Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<string | boolean | object | string[] | object[] | number[], false> | import("taobao-mini-sdk/lib/utils/resultmodel").Result<CodeType | IAwards, true>>; receiveEnamePrize(context: IContext<IReceiveEnameParams>, {}: {}, [awardSer]: [AwardsService]): Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<string | boolean | object | object[] | number[] | string[], false> | import("taobao-mini-sdk/lib/utils/resultmodel").Result<CodeType | IAwards, true>>;
/** /**
* 概率抽奖 * 概率抽奖
*/ */
drawLotteryPrize(context: IContext<IParams>, { userInfo }: IControllerInfos, [awardSer]: [AwardsService]): Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<string | boolean | object | string[] | object[] | number[], false> | import("taobao-mini-sdk/lib/utils/resultmodel").Result<{ drawLotteryPrize(context: IContext<IParams>, { userInfo }: IControllerInfos, [awardSer]: [AwardsService]): Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<string | boolean | object | object[] | number[] | string[], false> | import("taobao-mini-sdk/lib/utils/resultmodel").Result<{
data: { data: {
type: number; type: number;
name: string; name: string;
......
...@@ -83,7 +83,7 @@ var Share = /** @class */ (function () { ...@@ -83,7 +83,7 @@ var Share = /** @class */ (function () {
return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.ERROR_AREADY_INVITE_SUCCESS)]; return [2 /*return*/, sdk_1.resultsModel.error(constants_1.CODE_TYPES.ERROR_AREADY_INVITE_SUCCESS)];
} }
tasks = activityInfo.tasks; tasks = activityInfo.tasks;
value = (tasks || {}).inviteFriends.value; value = (tasks || {}).invites.value;
isNewVip = userService.checkNewVip(userInfo, vipInfo); isNewVip = userService.checkNewVip(userInfo, vipInfo);
isValidShare = [isNewVip].every(function (v) { return !!v; }); isValidShare = [isNewVip].every(function (v) { return !!v; });
today = utils_1.getToday(); today = utils_1.getToday();
......
{"version":3,"file":"share.controller.js","sourceRoot":"","sources":["../../src/controller/share.controller.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEd,4CAA2C;AAC3C,4CAA8E;AAC9E,kDAAgD;AAEhD,8BAAqC;AACrC,kCAAmC;AACnC,sCAAoE;AAEpE;IAAA;IAyDA,CAAC;IAxDC;;OAEG;IAIG,sBAAM,GAAZ,UACE,OAA0B,EAC1B,EAAqD,EACrD,EAAoF;YADlF,QAAQ,cAAA,EAAE,OAAO,aAAA,EAAE,YAAY,kBAAA;YAChC,WAAW,QAAA,EAAE,WAAW,QAAA,EAAE,aAAa,QAAA;;;;;;;wBAEhC,QAAQ,GAAK,OAAO,CAAC,IAAI,SAAjB,CAAiB;wBACzB,MAAM,GAAK,OAAO,OAAZ,CAAY;wBAEQ,qBAAM,WAAW,CAAC,mBAAmB,CAAC,QAAQ,CAAC;4BACjF,iCAAiC;0BADgD;;wBAA3E,cAAc,GAAc,SAA+C;wBACjF,iCAAiC;wBACjC,IAAI,CAAC,cAAc;4BAAE,sBAAO,kBAAY,CAAC,KAAK,CAAC,sBAAU,CAAC,uBAAuB,CAAC,EAAA;wBAE5E,kBAAkB,GAAG,WAAW,CAAC,6BAA6B,CAAC,SAAS,EAAE,cAAc,CAAC,CAAA;wBAE/F,eAAe;wBACf,IAAI,kBAAkB,CAAC,IAAI,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,MAAM,KAAK,MAAM,EAAnB,CAAmB,CAAC,EAAE;4BACrD,sBAAO,kBAAY,CAAC,KAAK,CAAC,sBAAU,CAAC,2BAA2B,CAAC,EAAA;yBAClE;wBAKO,KAAK,GAAK,YAAY,MAAjB,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AC,YAAY,EAAE;gCACzC,IAAI,EAAE;oCACJ,qBAAqB,EAAE,KAAK;iCAC7B;gCACD,KAAK;oCACH,GAAC,cAAY,KAAK,aAAU,IAAG,EAAE,MAAM,QAAA,EAAE,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE;uCAClE;6BACF,CAAC,EAAA;;wBARF,mBAAmB;wBACnB,SAOE,CAAA;;4BAGJ,sBAAO,kBAAY,CAAC,OAAO,CAAC,IAAI,CAAC,EAAA;;;;KAClC;IAjDD;QAHC,mBAAW,CAAC,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;QACvC,yBAAiB;QACjB,mBAAQ,CAAC,CAAC,qBAAW,EAAE,qBAAW,EAAE,uBAAa,CAAC,CAAC;;;;uCAkDnD;IACH,YAAC;CAAA,AAzDD,IAyDC;kBAzDoB,KAAK"}
\ No newline at end of file \ No newline at end of file
...@@ -18,5 +18,5 @@ export default class StatController { ...@@ -18,5 +18,5 @@ export default class StatController {
/** /**
* 统计数据 * 统计数据
*/ */
getStats(context: IContext<IGetStatsParams>): Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<string | boolean | object | string[] | object[] | number[], false> | import("taobao-mini-sdk/lib/utils/resultmodel").Result<any[], true>>; getStats(context: IContext<IGetStatsParams>): Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<string | boolean | object | object[] | number[] | string[], false> | import("taobao-mini-sdk/lib/utils/resultmodel").Result<any[], true>>;
} }
...@@ -13,8 +13,8 @@ declare const _default: { ...@@ -13,8 +13,8 @@ declare const _default: {
}>, {}: {}, [baseService]: [import("./service").BaseService]) => Promise<IResult<IActivityInfo>>; }>, {}: {}, [baseService]: [import("./service").BaseService]) => Promise<IResult<IActivityInfo>>;
getMyPrizeList: (context: IContext<import("./controller/awards.controller").IPrizeListParams>, {}: {}, [awardSer]: [import("./service").AwardsService]) => Promise<IResult<IAwards[]>>; getMyPrizeList: (context: IContext<import("./controller/awards.controller").IPrizeListParams>, {}: {}, [awardSer]: [import("./service").AwardsService]) => Promise<IResult<IAwards[]>>;
receiveObjectPrize: (context: IContext<import("./controller/awards.controller").IReceiveOjectParams>, {}: {}, [awardSer]: [import("./service").AwardsService]) => Promise<IResult<boolean>>; receiveObjectPrize: (context: IContext<import("./controller/awards.controller").IReceiveOjectParams>, {}: {}, [awardSer]: [import("./service").AwardsService]) => Promise<IResult<boolean>>;
receiveEnamePrize: (context: IContext<import("./controller/awards.controller").IReceiveEnameParams>, {}: {}, [awardSer]: [import("./service").AwardsService]) => Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<string | boolean | object | string[] | object[] | number[], false> | import("taobao-mini-sdk/lib/utils/resultmodel").Result<import("taobao-mini-sdk/lib/utils/codetypes").CodeType | IAwards, true>>; receiveEnamePrize: (context: IContext<import("./controller/awards.controller").IReceiveEnameParams>, {}: {}, [awardSer]: [import("./service").AwardsService]) => Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<string | boolean | object | object[] | number[] | string[], false> | import("taobao-mini-sdk/lib/utils/resultmodel").Result<import("taobao-mini-sdk/lib/utils/codetypes").CodeType | IAwards, true>>;
doHelp: (context: IContext<IParams>, { userInfo, vipInfo, activityInfo }: IControllerInfos, [userService, taskService, accessService]: [import("./service/user.service").default, import("./service").TaskService, import("./service").AccessService]) => Promise<IResult<boolean>>; doHelp: (context: IContext<IParams>, { userInfo, vipInfo, activityInfo }: IControllerInfos, [userService, taskService, accessService]: [import("./service/user.service").default, import("./service").TaskService, import("./service").AccessService]) => Promise<IResult<boolean>>;
getStats: (context: IContext<import("./controller/stat.controller").IGetStatsParams>) => Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<string | boolean | object | string[] | object[] | number[], false> | import("taobao-mini-sdk/lib/utils/resultmodel").Result<any[], true>>; getStats: (context: IContext<import("./controller/stat.controller").IGetStatsParams>) => Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<string | boolean | object | object[] | number[] | string[], false> | import("taobao-mini-sdk/lib/utils/resultmodel").Result<any[], true>>;
}; };
export default _default; export default _default;
...@@ -84,7 +84,7 @@ var TaskService = /** @class */ (function (_super) { ...@@ -84,7 +84,7 @@ var TaskService = /** @class */ (function (_super) {
TaskService.prototype.initVipTask = function (userInfo, vipInfo, tasks) { TaskService.prototype.initVipTask = function (userInfo, vipInfo, tasks) {
var remainTimes = userInfo.remainTimes; var remainTimes = userInfo.remainTimes;
// 后台配置奖励 // 后台配置奖励
var value = tasks.beMembership.value; var value = tasks.member.value;
return { return {
taskType: "member", taskType: "member",
title: "\u52A0\u5165\u4F1A\u5458", title: "\u52A0\u5165\u4F1A\u5458",
...@@ -177,7 +177,7 @@ var TaskService = /** @class */ (function (_super) { ...@@ -177,7 +177,7 @@ var TaskService = /** @class */ (function (_super) {
}; };
// 初始化邀请任务 // 初始化邀请任务
TaskService.prototype.initInvitesTask = function (userInfo, tasks) { TaskService.prototype.initInvitesTask = function (userInfo, tasks) {
var _a = tasks.inviteFriends, value = _a.value, taskRateType = _a.taskRateType, times = _a.times; var _a = tasks.invites, value = _a.value, taskRateType = _a.taskRateType, times = _a.times;
var remainTimes = userInfo.remainTimes; var remainTimes = userInfo.remainTimes;
var todayCompleteTimes = this.getTodayCompleteTask('invites', userInfo).todayCompleteTimes; var todayCompleteTimes = this.getTodayCompleteTask('invites', userInfo).todayCompleteTimes;
var invitesCompleteList = this.getCompleteTaskByUserTaskInfo('invites', userInfo); var invitesCompleteList = this.getCompleteTaskByUserTaskInfo('invites', userInfo);
...@@ -196,7 +196,7 @@ var TaskService = /** @class */ (function (_super) { ...@@ -196,7 +196,7 @@ var TaskService = /** @class */ (function (_super) {
}; };
// 关注店铺 // 关注店铺
TaskService.prototype.initFollowTask = function (userInfo, tasks) { TaskService.prototype.initFollowTask = function (userInfo, tasks) {
var value = tasks.attentionStore.value; var value = tasks.follow.value;
var remainTimes = userInfo.remainTimes; var remainTimes = userInfo.remainTimes;
var followCompleteList = this.getCompleteTaskByUserTaskInfo('follow', userInfo); var followCompleteList = this.getCompleteTaskByUserTaskInfo('follow', userInfo);
return { return {
...@@ -249,7 +249,7 @@ var TaskService = /** @class */ (function (_super) { ...@@ -249,7 +249,7 @@ var TaskService = /** @class */ (function (_super) {
var newMember = member.newMember; var newMember = member.newMember;
var today = utils_1.getToday(); var today = utils_1.getToday();
var isNewVip = this.checkNewVip(userInfo, vipInfo); var isNewVip = this.checkNewVip(userInfo, vipInfo);
var value = tasks.beMembership.value; var value = tasks.member.value;
var projection = { var projection = {
$set: {}, $set: {},
$inc: {}, $inc: {},
...@@ -356,7 +356,7 @@ var TaskService = /** @class */ (function (_super) { ...@@ -356,7 +356,7 @@ var TaskService = /** @class */ (function (_super) {
today = utils_1.getToday(); today = utils_1.getToday();
_id = userInfo._id, _a = userInfo.taskInfo, taskInfo = _a === void 0 ? {} : _a, follow = userInfo.follow; _id = userInfo._id, _a = userInfo.taskInfo, taskInfo = _a === void 0 ? {} : _a, follow = userInfo.follow;
tasks = activityInfo.tasks; tasks = activityInfo.tasks;
value = (tasks || {}).attentionStore.value; value = (tasks || {}).follow.value;
followInfo = this.setNewFollowUserData(follow); followInfo = this.setNewFollowUserData(follow);
return [4 /*yield*/, this.updateUser(_id, { return [4 /*yield*/, this.updateUser(_id, {
$set: { $set: {
......
This diff is collapsed.
...@@ -184,7 +184,7 @@ var UserService = /** @class */ (function (_super) { ...@@ -184,7 +184,7 @@ var UserService = /** @class */ (function (_super) {
*/ */
UserService.prototype.initUserData = function (vipInfo, activityInfo) { UserService.prototype.initUserData = function (vipInfo, activityInfo) {
return __awaiter(this, void 0, void 0, function () { return __awaiter(this, void 0, void 0, function () {
var _a, openId, data, activityId, isFollow, avatar, inviteId, userNick, today, tasks, attentionStore, beMembership, user; var _a, openId, data, activityId, isFollow, avatar, inviteId, userNick, today, tasks, follow, member, user;
var _b, _c; var _b, _c;
return __generator(this, function (_d) { return __generator(this, function (_d) {
switch (_d.label) { switch (_d.label) {
...@@ -194,7 +194,7 @@ var UserService = /** @class */ (function (_super) { ...@@ -194,7 +194,7 @@ var UserService = /** @class */ (function (_super) {
today = utils_1.getToday(); today = utils_1.getToday();
console.log("----------" + today + "----------", today); console.log("----------" + today + "----------", today);
tasks = activityInfo.tasks; tasks = activityInfo.tasks;
attentionStore = tasks.attentionStore, beMembership = tasks.beMembership; follow = tasks.follow, member = tasks.member;
user = { user = {
activityId: activityId, activityId: activityId,
avatar: avatar, avatar: avatar,
...@@ -203,8 +203,8 @@ var UserService = /** @class */ (function (_super) { ...@@ -203,8 +203,8 @@ var UserService = /** @class */ (function (_super) {
openId: openId, openId: openId,
// 待领取次数初始化, 根据需自定义添加 // 待领取次数初始化, 根据需自定义添加
remainTimes: { remainTimes: {
follow: isFollow ? attentionStore.value : 0, follow: isFollow ? follow.value : 0,
member: vipInfo.isVip ? beMembership.value : 0 member: vipInfo.isVip ? member.value : 0
}, },
member: { member: {
flag: !!vipInfo.isVip flag: !!vipInfo.isVip
...@@ -230,7 +230,7 @@ var UserService = /** @class */ (function (_super) { ...@@ -230,7 +230,7 @@ var UserService = /** @class */ (function (_super) {
}; };
UserService.prototype.updateUserData = function (vipInfo, userInfo, activityInfo) { UserService.prototype.updateUserData = function (vipInfo, userInfo, activityInfo) {
return __awaiter(this, void 0, void 0, function () { return __awaiter(this, void 0, void 0, function () {
var data, isFollow, today, projection, tasks, attentionStore, beMembership, followBefore, followNow, isNewVip; var data, isFollow, today, projection, tasks, follow, member, followBefore, followNow, isNewVip;
var _a; var _a;
return __generator(this, function (_b) { return __generator(this, function (_b) {
switch (_b.label) { switch (_b.label) {
...@@ -248,21 +248,21 @@ var UserService = /** @class */ (function (_super) { ...@@ -248,21 +248,21 @@ var UserService = /** @class */ (function (_super) {
_a) _a)
}; };
tasks = activityInfo.tasks; tasks = activityInfo.tasks;
attentionStore = tasks.attentionStore, beMembership = tasks.beMembership; follow = tasks.follow, member = tasks.member;
followBefore = userInfo.follow.flag; followBefore = userInfo.follow.flag;
followNow = isFollow; followNow = isFollow;
if (!followBefore && followNow && !userInfo.follow.newFollow) { if (!followBefore && followNow && !userInfo.follow.newFollow) {
// @ts-ignore // @ts-ignore
projection.$set.follow = this.setNewFollowUserData(userInfo.follow); projection.$set.follow = this.setNewFollowUserData(userInfo.follow);
projection.$push["taskInfo." + today + ".follow"] = { createTime: Date.now() }; projection.$push["taskInfo." + today + ".follow"] = { createTime: Date.now() };
projection.$inc["remainTimes.follow"] = attentionStore.value; projection.$inc["remainTimes.follow"] = follow.value;
} }
isNewVip = this.checkNewVip(userInfo, vipInfo); isNewVip = this.checkNewVip(userInfo, vipInfo);
if (isNewVip && !userInfo.member.newMember) { if (isNewVip && !userInfo.member.newMember) {
// @ts-ignore // @ts-ignore
projection.$set.member = this.setNewVipUserData(userInfo.member); projection.$set.member = this.setNewVipUserData(userInfo.member);
projection.$push["taskInfo." + today + ".member"] = { createTime: Date.now() }; projection.$push["taskInfo." + today + ".member"] = { createTime: Date.now() };
projection.$inc["remainTimes.member"] = beMembership.value; projection.$inc["remainTimes.member"] = member.value;
} }
return [4 /*yield*/, this.updateUser(userInfo._id, projection)]; return [4 /*yield*/, this.updateUser(userInfo._id, projection)];
case 1: case 1:
......
This diff is collapsed.
...@@ -40,7 +40,7 @@ export default class Share { ...@@ -40,7 +40,7 @@ export default class Share {
const { tasks } = activityInfo const { tasks } = activityInfo
// 获取分享奖励 // 获取分享奖励
const { const {
inviteFriends: { value } invites: { value }
}: ITasks = tasks || {} }: ITasks = tasks || {}
// 新会员 // 新会员
......
...@@ -32,7 +32,7 @@ export default class TaskService extends UserService { ...@@ -32,7 +32,7 @@ export default class TaskService extends UserService {
// 后台配置奖励 // 后台配置奖励
const { const {
beMembership: { value } member: { value }
} = tasks } = tasks
return { return {
...@@ -146,7 +146,7 @@ export default class TaskService extends UserService { ...@@ -146,7 +146,7 @@ export default class TaskService extends UserService {
// 初始化邀请任务 // 初始化邀请任务
initInvitesTask(userInfo: IUserInfo, tasks: ITasks): ITaskInfo { initInvitesTask(userInfo: IUserInfo, tasks: ITasks): ITaskInfo {
const { const {
inviteFriends: { value, taskRateType, times } invites: { value, taskRateType, times }
} = tasks } = tasks
const { remainTimes } = userInfo const { remainTimes } = userInfo
...@@ -171,7 +171,7 @@ export default class TaskService extends UserService { ...@@ -171,7 +171,7 @@ export default class TaskService extends UserService {
// 关注店铺 // 关注店铺
initFollowTask(userInfo: IUserInfo, tasks: ITasks): ITaskInfo { initFollowTask(userInfo: IUserInfo, tasks: ITasks): ITaskInfo {
const { const {
attentionStore: { value } follow: { value }
} = tasks } = tasks
const { remainTimes } = userInfo const { remainTimes } = userInfo
...@@ -241,7 +241,7 @@ export default class TaskService extends UserService { ...@@ -241,7 +241,7 @@ export default class TaskService extends UserService {
const isNewVip = this.checkNewVip(userInfo, vipInfo) const isNewVip = this.checkNewVip(userInfo, vipInfo)
const { const {
beMembership: { value } member: { value }
} = tasks } = tasks
let projection = { let projection = {
...@@ -359,7 +359,7 @@ export default class TaskService extends UserService { ...@@ -359,7 +359,7 @@ export default class TaskService extends UserService {
const { tasks } = activityInfo const { tasks } = activityInfo
// 获取关注店铺奖励 // 获取关注店铺奖励
const { const {
attentionStore: { value } follow: { value }
} = tasks || {} } = tasks || {}
// 更新follow信息 // 更新follow信息
......
...@@ -97,7 +97,7 @@ class UserService extends BaseService { ...@@ -97,7 +97,7 @@ class UserService extends BaseService {
const today = getToday() const today = getToday()
console.log(`----------${today}----------`, today) console.log(`----------${today}----------`, today)
const { tasks } = activityInfo const { tasks } = activityInfo
const { attentionStore, beMembership } = tasks const { follow, member } = tasks
const user: IUserInfo = { const user: IUserInfo = {
activityId, activityId,
avatar, avatar,
...@@ -106,8 +106,8 @@ class UserService extends BaseService { ...@@ -106,8 +106,8 @@ class UserService extends BaseService {
openId, openId,
// 待领取次数初始化, 根据需自定义添加 // 待领取次数初始化, 根据需自定义添加
remainTimes: { remainTimes: {
follow: isFollow ? attentionStore.value : 0, follow: isFollow ? follow.value : 0,
member: vipInfo.isVip ? beMembership.value : 0 member: vipInfo.isVip ? member.value : 0
}, },
member: { member: {
flag: !!vipInfo.isVip flag: !!vipInfo.isVip
...@@ -145,7 +145,7 @@ class UserService extends BaseService { ...@@ -145,7 +145,7 @@ class UserService extends BaseService {
} }
const { tasks } = activityInfo const { tasks } = activityInfo
const { attentionStore, beMembership } = tasks const { follow, member } = tasks
// 老用户 // 老用户
// 之前进入活动未关注,现在进入关注,则视为新关注店铺用户 // 之前进入活动未关注,现在进入关注,则视为新关注店铺用户
...@@ -155,7 +155,7 @@ class UserService extends BaseService { ...@@ -155,7 +155,7 @@ class UserService extends BaseService {
// @ts-ignore // @ts-ignore
projection.$set.follow = this.setNewFollowUserData(userInfo.follow) projection.$set.follow = this.setNewFollowUserData(userInfo.follow)
projection.$push[`taskInfo.${today}.follow`] = { createTime: Date.now() } projection.$push[`taskInfo.${today}.follow`] = { createTime: Date.now() }
projection.$inc[`remainTimes.follow`] = attentionStore.value projection.$inc[`remainTimes.follow`] = follow.value
} }
// 之前进入活动非会员,现在进入会员,则视为新会员用户 // 之前进入活动非会员,现在进入会员,则视为新会员用户
...@@ -164,7 +164,7 @@ class UserService extends BaseService { ...@@ -164,7 +164,7 @@ class UserService extends BaseService {
// @ts-ignore // @ts-ignore
projection.$set.member = this.setNewVipUserData(userInfo.member) projection.$set.member = this.setNewVipUserData(userInfo.member)
projection.$push[`taskInfo.${today}.member`] = { createTime: Date.now() } projection.$push[`taskInfo.${today}.member`] = { createTime: Date.now() }
projection.$inc[`remainTimes.member`] = beMembership.value projection.$inc[`remainTimes.member`] = member.value
} }
await this.updateUser(userInfo._id, projection) await this.updateUser(userInfo._id, projection)
......
...@@ -16,15 +16,15 @@ interface IActivityInfo { ...@@ -16,15 +16,15 @@ interface IActivityInfo {
} }
interface ITasks { interface ITasks {
attentionStore?: ITaskConfig follow?: ITaskConfig
beMembership?: ITaskConfig member?: ITaskConfig
sign?: ITaskConfig sign?: ITaskConfig
exchangeCredits?: ITaskConfig exchangeCredits?: ITaskConfig
browseGoods?: ITaskConfig browseGoods?: ITaskConfig
orderGoods?: ITaskConfig orderGoods?: ITaskConfig
collectGoods?: ITaskConfig collectGoods?: ITaskConfig
jumpLink?: ITaskConfig jumpLink?: ITaskConfig
inviteFriends?: ITaskConfig invites?: ITaskConfig
} }
interface ITaskConfig { interface ITaskConfig {
......
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