Commit 485286a9 authored by qinhaitao's avatar qinhaitao

fix: 🐛 session

parent 5253e683
......@@ -55,34 +55,41 @@ var vip_1 = require("../utils/package/vip");
function initBaseInfo(context, baseInfos, needInfos) {
var _a, _b, _c;
return __awaiter(this, void 0, void 0, function () {
var handler, userService, userInfo, _d, session, userNick, vipInfo;
return __generator(this, function (_e) {
switch (_e.label) {
var handler, userService, userInfo, _d, session, userNick, _e, session, userNick, vipInfo;
return __generator(this, function (_f) {
switch (_f.label) {
case 0:
handler = (_c = (_b = (_a = context === null || context === void 0 ? void 0 : context.cloud) === null || _a === void 0 ? void 0 : _a.dataspace) === null || _b === void 0 ? void 0 : _b.context) === null || _c === void 0 ? void 0 : _c.handler;
userService = new service_1.UserService(context);
if (!(needInfos.includes('userInfo') && !baseInfos.userInfo)) return [3 /*break*/, 2];
return [4 /*yield*/, userService.getUserInfo()];
case 1:
userInfo = _e.sent();
userInfo = _f.sent();
baseInfos.userInfo = userInfo;
_e.label = 2;
_f.label = 2;
case 2:
if (!(needInfos.includes('session') && !baseInfos.session)) return [3 /*break*/, 4];
return [4 /*yield*/, utils_1.getSellerSession(context)];
case 3:
_d = _e.sent(), session = _d.session, userNick = _d.userNick;
_d = _f.sent(), session = _d.session, userNick = _d.userNick;
baseInfos.session = session;
baseInfos.activityUserNick = userNick;
_e.label = 4;
_f.label = 4;
case 4:
if (!(needInfos.includes('vipInfo') && !baseInfos.vipInfo && handler !== 'getVipInfo')) return [3 /*break*/, 6];
return [4 /*yield*/, userService.getShopVip(baseInfos.session, vip_1.formatVipCbUrl(context), baseInfos.activityUserNick)];
if (!(needInfos.includes('vipInfo') && !baseInfos.vipInfo && handler !== 'getVipInfo')) return [3 /*break*/, 8];
if (!!baseInfos.session) return [3 /*break*/, 6];
return [4 /*yield*/, utils_1.getSellerSession(context)];
case 5:
vipInfo = _e.sent();
_e = _f.sent(), session = _e.session, userNick = _e.userNick;
baseInfos.session = session;
baseInfos.activityUserNick = userNick;
_f.label = 6;
case 6: return [4 /*yield*/, userService.getShopVip(baseInfos.session, vip_1.formatVipCbUrl(context), baseInfos.activityUserNick)];
case 7:
vipInfo = _f.sent();
baseInfos.vipInfo = vipInfo;
_e.label = 6;
case 6: return [2 /*return*/, baseInfos];
_f.label = 8;
case 8: return [2 /*return*/, baseInfos];
}
});
});
......
{"version":3,"file":"registeInfos.js","sourceRoot":"","sources":["../../src/decorator/registeInfos.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,cAAc;AACd,sCAAwC;AACxC,kCAAkE;AAGlE,4CAAqD;AAIrD,SAAe,YAAY,CAAC,OAA0B,EAAE,SAA2B,EAAE,SAAkB;;;;;;;oBAC/F,OAAO,qBAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,0CAAE,SAAS,0CAAE,OAAO,0CAAE,OAAO,CAAA;oBACrD,WAAW,GAAG,IAAI,qBAAW,CAAC,OAAO,CAAC,CAAA;yBAExC,CAAA,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAA,EAArD,wBAAqD;oBACtC,qBAAM,WAAW,CAAC,WAAW,EAAE,EAAA;;oBAA1C,QAAQ,GAAG,SAA+B;oBAChD,SAAS,CAAC,QAAQ,GAAG,QAAQ,CAAA;;;yBAG3B,CAAA,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAA,EAAnD,wBAAmD;oBACvB,qBAAM,wBAAgB,CAAC,OAAO,CAAC,EAAA;;oBAAvD,KAAwB,SAA+B,EAArD,OAAO,aAAA,EAAE,QAAQ,cAAA;oBACzB,SAAS,CAAC,OAAO,GAAG,OAAO,CAAA;oBAC3B,SAAS,CAAC,gBAAgB,GAAG,QAAQ,CAAA;;;yBAGnC,CAAA,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,IAAI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C,SAAkB;IAC7C,OAAO,UAAU,MAAW,EAAE,IAAY,EAAE,UAA8B;QACxE,IAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAA;QAC/B,UAAU,CAAC,KAAK,GAAG;YAAgB,cAAc;iBAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;gBAAd,yBAAc;;;;;;;4BACxC,OAAO,GAAoB,IAAI,GAAxB,EAAE,KAAkB,IAAI,GAAR,EAAd,SAAS,mBAAG,EAAE,KAAA,CAAQ;4BAErB,qBAAM,YAAY,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS,CAAC,EAAA;;4BAA5D,QAAQ,GAAG,SAAiD;4BAElE,sBAAO,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,OAAO,eAAO,QAAQ,EAAG,CAAC,EAAA;;;;SACxD,CAAA;IACH,CAAC,CAAA;AACH,CAAC,CAAA"}
\ No newline at end of file
......@@ -23,6 +23,11 @@ async function initBaseInfo(context: IContext<IParams>, baseInfos: IControllerIn
}
if (needInfos.includes('vipInfo') && !baseInfos.vipInfo && handler !== 'getVipInfo') {
if (!baseInfos.session) {
const { session, userNick } = await getSellerSession(context)
baseInfos.session = session
baseInfos.activityUserNick = userNick
}
const vipInfo = await userService.getShopVip(baseInfos.session, formatVipCbUrl(context), baseInfos.activityUserNick)
baseInfos.vipInfo = vipInfo
}
......
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