Commit ab63138c authored by qinhaitao's avatar qinhaitao

refactor: 💡 config 优化

parent 6b5e9f9c
/** @format */
export interface Iconfig {
export interface IConfig {
generateVipCallBackUrl(activityId?: string): string;
}
export declare const getConfig: (context: IContext<{}>) => Iconfig;
export declare const getConfig: (context: IContext<{}>) => IConfig;
......@@ -5,9 +5,9 @@ exports.getConfig = void 0;
var online_1 = require("./online");
var test_1 = require("./test");
var configs = {
online: online_1.default,
test: test_1.default,
mock: test_1.default
online: online_1.cfg,
test: test_1.cfg,
mock: test_1.cfg
};
// 根据服务环境获取配置
exports.getConfig = function (context) {
......
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":";AAAA,cAAc;;;AAEd,mCAA6B;AAC7B,+BAAyB;AAMzB,IAAM,OAAO,GAAG;IACd,MAAM,kBAAA;IACN,IAAI,gBAAA;IACJ,IAAI,EAAE,cAAI;CACX,CAAA;AAED,aAAa;AACA,QAAA,SAAS,GAAG,UAAC,OAAqB;IAC7C,IAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAA;IACvB,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,MAAM,CAAA;AACvC,CAAC,CAAA"}
\ No newline at end of file
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":";AAAA,cAAc;;;AAEd,mCAAwC;AACxC,+BAAoC;AAMpC,IAAM,OAAO,GAAG;IACd,MAAM,cAAA;IACN,IAAI,YAAA;IACJ,IAAI,EAAE,UAAI;CACX,CAAA;AAED,aAAa;AACA,QAAA,SAAS,GAAG,UAAC,OAAqB;IAC7C,IAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAA;IACvB,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,MAAM,CAAA;AACvC,CAAC,CAAA"}
\ No newline at end of file
/** @format */
declare const _default: {
generateVipCallBackUrl(activityId: string): string;
};
export default _default;
import { IConfig } from './index';
export declare const cfg: IConfig;
"use strict";
/** @format */
Object.defineProperty(exports, "__esModule", { value: true });
exports.cfg = void 0;
var constants_1 = require("../constants");
exports.default = {
exports.cfg = {
generateVipCallBackUrl: function (activityId) {
return "https://m.duanqu.com/?_ariver_appid=" + constants_1.appId + "&query=activityId%3D" + activityId;
}
......
{"version":3,"file":"online.js","sourceRoot":"","sources":["../../src/config/online.ts"],"names":[],"mappings":";AAAA,cAAc;;AAEd,0CAAoC;AAEpC,kBAAe;IACb,sBAAsB,EAAtB,UAAuB,UAAkB;QACvC,OAAO,yCAAuC,iBAAK,4BAAuB,UAAY,CAAA;IACxF,CAAC;CACF,CAAA"}
\ No newline at end of file
{"version":3,"file":"online.js","sourceRoot":"","sources":["../../src/config/online.ts"],"names":[],"mappings":";AAAA,cAAc;;;AAEd,0CAAoC;AAGvB,QAAA,GAAG,GAAY;IAC1B,sBAAsB,EAAtB,UAAuB,UAAkB;QACvC,OAAO,yCAAuC,iBAAK,4BAAuB,UAAY,CAAA;IACxF,CAAC;CACF,CAAA"}
\ No newline at end of file
declare const _default: {
generateVipCallBackUrl(): string;
};
/** @format */
export default _default;
import { IConfig } from './index';
export declare const cfg: IConfig;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/** @format */
exports.default = {
exports.cfg = void 0;
exports.cfg = {
generateVipCallBackUrl: function () {
return "\u5BA2\u6237\u7AEF\u751F\u6210\u7684\u9884\u89C8\u5730\u5740";
}
......
{"version":3,"file":"test.js","sourceRoot":"","sources":["../../src/config/test.ts"],"names":[],"mappings":";;AAAA,cAAc;AACd,kBAAe;IACb,sBAAsB;QACpB,OAAO,8DAAY,CAAA;IACrB,CAAC;CACF,CAAA"}
\ No newline at end of file
{"version":3,"file":"test.js","sourceRoot":"","sources":["../../src/config/test.ts"],"names":[],"mappings":";;;AAGa,QAAA,GAAG,GAAY;IAC1B,sBAAsB;QACpB,OAAO,8DAAY,CAAA;IACrB,CAAC;CACF,CAAA"}
\ No newline at end of file
......@@ -30,7 +30,7 @@ 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<IAwards | CodeType, true>>;
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>>;
/**
* 概率抽奖
*/
......
......@@ -9,5 +9,5 @@ export default class StatController {
/**
* 统计数据
*/
getStats(context: IContext<IStatsParams>): Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<string | boolean | object | object[] | number[] | string[], false> | import("taobao-mini-sdk/lib/utils/resultmodel").Result<any[], true>>;
getStats(context: IContext<IStatsParams>): 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>>;
}
......@@ -13,7 +13,7 @@ declare const _default: {
}>, {}: {}, [baseService]: [import("./service").BaseService]) => Promise<IResult<IActivityInfo>>;
getMyPrizeList: (context: IContext<import("./controller/awards.controller").IPrizeListParams>, {}: {}, [awardSer]: [import("./service").AwardsService]) => Promise<IResult<IAwards[]>>;
receiveObjectPrize: (context: IContext<import("./controller/awards.controller").IReceiveOjectParams>, {}: {}, [awardSer]: [import("./service").AwardsService]) => Promise<IResult<boolean>>;
receiveEnamePrize: (context: IContext<import("./controller/awards.controller").IReceiveEnameParams>, {}: {}, [awardSer]: [import("./service").AwardsService]) => Promise<import("taobao-mini-sdk/lib/utils/resultmodel").Result<string | boolean | object | string[] | object[] | number[], false> | import("taobao-mini-sdk/lib/utils/resultmodel").Result<IAwards | import("taobao-mini-sdk/lib/utils/codetypes").CodeType, 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 | string[] | object[] | number[], 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>>;
getStats: (context: IContext<import("./controller/stat.controller").IStatsParams>) => 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>>;
};
......
/** @format */
import online from './online'
import test from './test'
import { cfg as online } from './online'
import { cfg as test } from './test'
export interface Iconfig {
export interface IConfig {
generateVipCallBackUrl(activityId?: string): string
}
......@@ -14,7 +14,7 @@ const configs = {
}
// 根据服务环境获取配置
export const getConfig = (context: IContext<{}>): Iconfig => {
export const getConfig = (context: IContext<{}>): IConfig => {
const env = context.env
return configs[env] || configs.online
}
/** @format */
import { appId } from '../constants'
import { IConfig } from './index'
export default {
export const cfg: IConfig = {
generateVipCallBackUrl(activityId: string) {
return `https://m.duanqu.com/?_ariver_appid=${appId}&query=activityId%3D${activityId}`
}
......
/** @format */
export default {
import { IConfig } from './index'
export const cfg: IConfig = {
generateVipCallBackUrl() {
return `客户端生成的预览地址`
}
......
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