Commit 22c51efa authored by qinhaitao's avatar qinhaitao

feat: 🎸 回调地址优化

parent 0d074ef4
......@@ -2,6 +2,6 @@
Object.defineProperty(exports, "__esModule", { value: true });
exports.cfg = void 0;
exports.cfg = {
vipCallBackUrl: "\u5730\u5740"
vipCallBackUrl: "\u5BA2\u6237\u7AEF\u751F\u6210\u7684\u9884\u89C8\u5730\u5740(C\u7AEF\u5BA2\u6237\u7AEF\u5F00\u53D1\u63D0\u4F9B)"
};
//# sourceMappingURL=test.js.map
\ No newline at end of file
{"version":3,"file":"test.js","sourceRoot":"","sources":["../../src/config/test.ts"],"names":[],"mappings":";;;AAGa,QAAA,GAAG,GAAY;IAC1B,cAAc,EAAE,cAAI;CACrB,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,cAAc,EAAE,iHAAuB;CACxC,CAAA"}
\ No newline at end of file
......@@ -2,7 +2,7 @@
import { UserService, AccessService } from '../service';
export interface IVipParams {
activityId: string;
callbackUrl?: string;
inviteId?: string;
}
export interface ILoginParams {
activityId: string;
......
......@@ -95,15 +95,17 @@ var User = /** @class */ (function () {
var session = _a.session, activityUserNick = _a.activityUserNick;
var userService = _b[0];
return __awaiter(this, void 0, void 0, function () {
var _c, callbackUrl, activityId, vipCallBackUrl, result;
return __generator(this, function (_d) {
switch (_d.label) {
var _c, activityId, _d, inviteId, vipCallBackUrl, query, callbackUrl, result;
return __generator(this, function (_e) {
switch (_e.label) {
case 0:
_c = context.data, callbackUrl = _c.callbackUrl, activityId = _c.activityId;
_c = context.data, activityId = _c.activityId, _d = _c.inviteId, inviteId = _d === void 0 ? '' : _d;
vipCallBackUrl = config_1.getConfig(context).vipCallBackUrl;
return [4 /*yield*/, userService.getShopVip(session, activityUserNick, callbackUrl || vipCallBackUrl)];
query = "activityId=" + activityId + "&inviteId=" + inviteId;
callbackUrl = vipCallBackUrl + "&query=" + encodeURIComponent(query);
return [4 /*yield*/, userService.getShopVip(session, activityUserNick, callbackUrl)];
case 1:
result = _d.sent();
result = _e.sent();
return [2 /*return*/, sdk_1.resultsModel.success(result)];
}
});
......
{"version":3,"file":"user.controller.js","sourceRoot":"","sources":["../../src/controller/user.controller.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEd,0CAAuE;AAEvE,8BAAqC;AACrC,sCAAuD;AACvD,oCAAqC;AAYrC;IAAA;IA6CA,CAAC;IA5CC;;OAEG;IAIG,oBAAK,GAAX,UACE,OAA+B,EAC/B,EAAqD,EACrD,EAA0D;YADxD,QAAQ,cAAA,EAAE,OAAO,aAAA,EAAE,YAAY,kBAAA;YAChC,WAAW,QAAA,EAAE,aAAa,QAAA;;;;;;wBAEnB,MAAM,GAAK,OAAO,OAAZ,CAAY;wBAElB,QAAQ,GAAK,OAAO,CAAC,IAAI,SAAjB,CAAiB;6BAE7B,CAAC,QAAQ,EAAT,wBAAS;wBACX,qBAAM,WAAW,CAAC,YAAY,CAAC,OAAO,EAAE,YAAY,CAAC,EAAA;;wBAArD,SAAqD,CAAA;;4BAErD,qBAAM,WAAW,CAAC,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE,YAAY,CAAC,EAAA;;wBAAjE,SAAiE,CAAA;;;oBAGnE,UAAU;oBACV,qBAAM,aAAa,CAAC,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC,EAAA;;wBADtD,UAAU;wBACV,SAAsD,CAAA;wBAEtD,sBAAO,kBAAY,CAAC,OAAO,CAAC;gCAC1B,MAAM,QAAA;6BACP,CAAC,EAAA;;;;KACH;IACD;;OAEG;IAGG,yBAAU,GAAhB,UACE,OAA6B,EAC7B,EAA+C,EAC/C,EAA4B;YAD1B,OAAO,aAAA,EAAE,gBAAgB,sBAAA;YAC1B,WAAW,QAAA;;;;;;wBAEN,KAA8B,OAAO,CAAC,IAAI,EAAxC,WAAW,iBAAA,EAAE,UAAU,gBAAA,CAAiB;wBACxC,cAAc,GAAK,kBAAS,CAAC,OAAO,CAAC,eAAvB,CAAuB;wBAC9B,qBAAM,WAAW,CAAC,UAAU,CAAC,OAAO,EAAE,gBAAgB,EAAE,WAAW,IAAI,cAAc,CAAC,EAAA;;wBAA/F,MAAM,GAAG,SAAsF;wBAErG,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
{"version":3,"file":"user.controller.js","sourceRoot":"","sources":["../../src/controller/user.controller.ts"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEd,0CAAuE;AAEvE,8BAAqC;AACrC,sCAAuD;AACvD,oCAAqC;AAYrC;IAAA;IAkDA,CAAC;IAjDC;;OAEG;IAIG,oBAAK,GAAX,UACE,OAA+B,EAC/B,EAAqD,EACrD,EAA0D;YADxD,QAAQ,cAAA,EAAE,OAAO,aAAA,EAAE,YAAY,kBAAA;YAChC,WAAW,QAAA,EAAE,aAAa,QAAA;;;;;;wBAEnB,MAAM,GAAK,OAAO,OAAZ,CAAY;wBAElB,QAAQ,GAAK,OAAO,CAAC,IAAI,SAAjB,CAAiB;6BAE7B,CAAC,QAAQ,EAAT,wBAAS;wBACX,qBAAM,WAAW,CAAC,YAAY,CAAC,OAAO,EAAE,YAAY,CAAC,EAAA;;wB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IACH,WAAC;CAAA,AAlDD,IAkDC;kBAlDoB,IAAI"}
\ No newline at end of file
......@@ -2,8 +2,7 @@ export declare const paramsCheck: (params: string[]) => (target: Object, name: s
export declare const userCheck: ({ intercept }: {
intercept?: boolean;
}) => (target: any, name: string, descriptor: PropertyDescriptor) => void;
export declare const vipCheck: ({ intercept, callbackUrl }: {
export declare const vipCheck: ({ intercept }: {
intercept?: boolean;
callbackUrl?: string;
}) => (target: any, name: string, descriptor: PropertyDescriptor) => void;
export declare const activityTimeCheck: (target: any, name: string, descriptor: PropertyDescriptor) => void;
......@@ -105,7 +105,7 @@ exports.userCheck = function (_a) {
};
// 是否是会员
exports.vipCheck = function (_a) {
var _b = _a.intercept, intercept = _b === void 0 ? true : _b, _c = _a.callbackUrl, callbackUrl = _c === void 0 ? '' : _c;
var _b = _a.intercept, intercept = _b === void 0 ? true : _b;
return function (target, name, descriptor) {
var method = descriptor.value;
descriptor.value = function () {
......@@ -114,19 +114,22 @@ exports.vipCheck = function (_a) {
args[_i] = arguments[_i];
}
return __awaiter(this, void 0, void 0, function () {
var context, _a, otherArgs, vipCallBackUrl, userService, session, vipInfo;
return __generator(this, function (_b) {
switch (_b.label) {
var context, _a, otherArgs, _b, activityId, _c, inviteId, vipCallBackUrl, query, callbackUrl, userService, session, vipInfo;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
context = args[0], _a = args[1], otherArgs = _a === void 0 ? {} : _a;
_b = context.data, activityId = _b.activityId, _c = _b.inviteId, inviteId = _c === void 0 ? '' : _c;
vipCallBackUrl = config_1.getConfig(context).vipCallBackUrl;
query = "activityId=" + activityId + "&inviteId=" + inviteId;
callbackUrl = vipCallBackUrl + "&query=" + encodeURIComponent(query);
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 || vipCallBackUrl)];
session = (_d.sent()).session;
return [4 /*yield*/, userService.getShopVip(session, callbackUrl)];
case 2:
vipInfo = _b.sent();
vipInfo = _d.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 })])];
......
{"version":3,"file":"check.js","sourceRoot":"","sources":["../../src/decorator/check.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,cAAc;AACd,8BAAqC;AACrC,0CAAyC;AACzC,sCAAqD;AACrD,kCAA2C;AAC3C,oCAAqC;AACrC,WAAW;AACE,QAAA,WAAW,GAAG,UAAC,MAAgB;IAC1C,OAAO,UAAU,MAAc,EAAE,IAAY,EAAE,UAA8B;QAC3E,IAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAA;QAE/B,UAAU,CAAC,KAAK,GAAG;YAAU,cAAc;iBAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;gBAAd,yBAAc;;YAClC,IAAA,OAAO,GAAoB,IAAI,GAAxB,EAAE,KAAkB,IAAI,GAAR,EAAd,SAAS,mBAAG,EAAE,KAAA,CAAQ;YACtC,IAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;YAC1C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACtC,IAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAA;gBACvB,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC;oBAAE,OAAO,kBAAY,CAAC,KAAK,CAAC,sBAAU,CAAC,YAAY,EAAE,iBAAK,KAAK,iBAAI,CAAC,CAAA;aAClG;YACD,OAAO,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,OAAO,eAAO,SAAS,EAAG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AAC,sBAAsB,EAAE,gCAAO,CAAC,EAAA;yBACtE;wBACD,IAAI,WAAW,GAAG,OAAO,EAAE;4BACzB,sBAAO,kBAAY,CAAC,KAAK,CAAC,sBAAU,CAAC,mBAAmB,EAAE,gCAAO,CAAC,EAAA;yBACnE;wBACD,sBAAO,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
......@@ -127,11 +127,10 @@ var UserService = /** @class */ (function (_super) {
if (activityUserNick === void 0) { activityUserNick = ''; }
if (callbackUrl === void 0) { callbackUrl = ''; }
return __awaiter(this, void 0, void 0, function () {
var activityId, result, shopUrl, cbUrl, e_1;
var activityId, result, shopUrl, e_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
console.log(activityUserNick, 'activityUserNick');
if (utils_1.isUseVipMock(this.context, activityUserNick)) {
return [2 /*return*/, vipMock_1.VIP_MOCK];
}
......@@ -146,7 +145,6 @@ var UserService = /** @class */ (function (_super) {
result: ''
}
};
cbUrl = callbackUrl + "&query=activityId%3D" + activityId;
_a.label = 1;
case 1:
_a.trys.push([1, 4, , 5]);
......@@ -156,7 +154,7 @@ var UserService = /** @class */ (function (_super) {
return [4 /*yield*/, sdk_1.TBAPIS.getShopVipUrl(this.context, session, {
source: 'isvapp',
entrance: 'duiba'
}, cbUrl)];
}, callbackUrl)];
case 3:
shopUrl = _a.sent();
return [3 /*break*/, 5];
......
This diff is collapsed.
......@@ -2,5 +2,5 @@
import { IConfig } from './index'
export const cfg: IConfig = {
vipCallBackUrl: `地址`
vipCallBackUrl: `客户端生成的预览地址(C端客户端开发提供)`
}
......@@ -7,7 +7,7 @@ import { UserService, AccessService } from '../service'
import { getConfig } from '../config'
export interface IVipParams {
activityId: string
callbackUrl?: string
inviteId?: string // 需要助力回调时请求该接口
}
export interface ILoginParams {
activityId: string
......@@ -55,9 +55,14 @@ export default class User {
{ session, activityUserNick }: IControllerInfos,
[userService]: [UserService]
): Promise<IResult<IVipInfo>> {
const { callbackUrl, activityId } = context.data
const { vipCallBackUrl } = getConfig(context)
const result = await userService.getShopVip(session, activityUserNick, callbackUrl || vipCallBackUrl)
const { activityId, inviteId = '' } = context.data
let { vipCallBackUrl } = getConfig(context)
// 拼接回调参数
let query = `activityId=${activityId}&inviteId=${inviteId}`
let callbackUrl: string = `${vipCallBackUrl}&query=${encodeURIComponent(query)}`
const result = await userService.getShopVip(session, activityUserNick, callbackUrl)
return resultsModel.success(result)
}
......
......@@ -40,17 +40,20 @@ export const userCheck = ({ intercept = true }) => {
}
// 是否是会员
export const vipCheck = ({ intercept = true, callbackUrl = '' }) => {
export const vipCheck = ({ intercept = true }) => {
return function (target: any, name: string, descriptor: PropertyDescriptor) {
const method = descriptor.value
descriptor.value = async function (...args: any[]) {
const [context, otherArgs = {}] = args
const { activityId, inviteId = '' } = context.data
const { vipCallBackUrl } = getConfig(context)
// 拼接回调参数
let query = `activityId=${activityId}&inviteId=${inviteId}`
let callbackUrl: string = `${vipCallBackUrl}&query=${encodeURIComponent(query)}`
const userService = new UserService(context)
const { session } = await getSellerSession(context)
const vipInfo = await userService.getShopVip(session, callbackUrl || vipCallBackUrl)
const vipInfo = await userService.getShopVip(session, callbackUrl)
if (!vipInfo.isVip && intercept) return resultsModel.error(CODE_TYPES.ERROR_NO_VIP, '非店铺会员', vipInfo)
return method.apply(target, [context, { ...otherArgs, vipInfo, session }])
......
......@@ -45,7 +45,6 @@ class UserService extends BaseService {
* @returns {isVip: boolean(是否是会员), url: string(入会链接) }
*/
async getShopVip(session: string, activityUserNick: string = '', callbackUrl: string = ''): Promise<IVipInfo> {
console.log(activityUserNick, 'activityUserNick')
if (isUseVipMock(this.context, activityUserNick)) {
return VIP_MOCK
}
......@@ -61,7 +60,6 @@ class UserService extends BaseService {
}
}
const cbUrl: string = `${callbackUrl}&query=activityId%3D${activityId}`
try {
result = await TBAPIS.queryVipinfo(this.context, session)
......@@ -72,7 +70,7 @@ class UserService extends BaseService {
source: 'isvapp',
entrance: 'duiba'
},
cbUrl
callbackUrl
)
} catch (e) {
console.log(e)
......
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