Commit ba81485e authored by mqf_0707's avatar mqf_0707

优化capiFn

parent 26e43341
......@@ -111,6 +111,11 @@ var tornadoAPIFn = function (tornadoAPI, nickName, handle, loading, params) { re
return [2 /*return*/, tbFn_1.getAuthUserInfo().catch(function (err) {
console.log('未授权成功', err);
}).then(function (res) {
var _a = (res || {}).nickName, nickName = _a === void 0 ? '' : _a;
if (!nickName) {
console.warn('请先登录!');
return false;
}
return exports.tornadoAPICb(params_, res, loading, tornadoAPI);
})];
}
......
{"version":3,"file":"requestFn.js","sourceRoot":"","sources":["../../src/helpers/requestFn.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAA+C;AAC/C,iCAA0C;AAC1C,iCAAmC;AACnC,IAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAA;AACvC,IAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;AAChC;;;GAGG;AACI,IAAM,GAAG,GAAG,UAAC,IAAS;IACzB,IAAI,GAAG,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC;IAC3B,IAAI,GAAG,GAAG,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACjC,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAC3E,CAAC,CAAA;AAJY,QAAA,GAAG,OAIf;AACD;;;;;;GAMG;AACI,IAAM,YAAY,GAAG,UAAO,MAAW,EAAE,GAAQ,EAAE,OAAgB,EAAE,UAAkB;;;;;gBAClF,QAAQ,GAAK,GAAG,SAAR,CAAQ;gBACxB,MAAM,CAAC,MAAM,GAAG,WAAG,CAAC,QAAQ,CAAC,CAAA;gBACvB,OAAO,GAAG;oBACZ,GAAG,EAAE,UAAU;oBACf,MAAM,EAAE,MAA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AAM,EAAE,aAAa,EAAE,MAAM,CAAC,EAAA;oBAA9E,sBAAO,SAAuE,EAAA;;gBAE5E,aAAa,GAAG,OAAO,IAAI,aAAa,CAAC,WAAW,CAAC,CAAC;gBACtD,OAAO,GAAG;oBACZ,GAAG,EAAE,aAAa,GAAG,SAAS,GAAG,GAAG,GAAG,MAAM;oBAC7C,MAAM,EAAE,KAAK;oBACb,IAAI,EAAE,MAAM;oBACZ,QAAQ,EAAE,MAAM;iBACnB,CAAA;gBACM,qBAAM,iBAAS,CAAC,OAAO,EAAE,aAAa,CAAC,EAAA;oBAA9C,sBAAO,SAAuC,EAAA;;;KACjD,CAAA;AAfY,QAAA,WAAW,eAevB"}
\ No newline at end of file
......@@ -33,10 +33,10 @@ declare const _default: {
};
};
capiFn: (apiList: any, request: any) => {
receiveObjectPrize(params: any, failMessage: any, successMessage: any): Promise<boolean>;
receiveObjectPrize(params: any): Promise<false | void>;
getVipInfo(params: any): Promise<any>;
receiveEnamePrize(params: any, failMessage: any, successMessage: any): Promise<boolean>;
addStat(type: string | number, param?: {}): Promise<boolean>;
receiveEnamePrize(params: any): Promise<boolean>;
addStat(activityId: string, type: string | number): Promise<boolean>;
};
tb: {
getUserAddress: (opts?: {}) => Promise<unknown>;
......
declare const capiFn: (apiList: any, request: any) => {
receiveObjectPrize(params: any, failMessage: any, successMessage: any): Promise<boolean>;
receiveObjectPrize(params: any): Promise<false | void>;
getVipInfo(params: any): Promise<any>;
receiveEnamePrize(params: any, failMessage: any, successMessage: any): Promise<boolean>;
addStat(type: number | string, param?: {}): Promise<boolean>;
receiveEnamePrize(params: any): Promise<boolean>;
addStat(activityId: string, type: number | string): Promise<boolean>;
};
export default capiFn;
......@@ -53,22 +53,21 @@ var utils_1 = require("../utils");
// 通用API封装方法
var capiFn = function (apiList, request) {
return {
receiveObjectPrize: function (params, failMessage, successMessage) {
receiveObjectPrize: function (params) {
return __awaiter(this, void 0, void 0, function () {
var _a, handle, method, ext, userAddress, _b, name, telNumber, provinceName, cityName, cityCode, countyName, detailInfo, streetName;
return __generator(this, function (_c) {
switch (_c.label) {
var _a, handle, method, ext, userAddress, _b, name, telNumber, provinceName, cityName, cityCode, countyName, detailInfo, streetName, confirmResult, _c;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
_a = utils_1.getRequestParams(apiList['receiveObjectPrize']), handle = _a.handle, method = _a.method, ext = _a.ext;
return [4 /*yield*/, tbFn_1.getUserAddress().catch(function (err) {
tb_1.commonToast(err.errorMessage);
})];
case 1:
userAddress = _c.sent();
if (!userAddress)
return [2 /*return*/, false];
userAddress = _d.sent();
_b = userAddress || {}, name = _b.name, telNumber = _b.telNumber, provinceName = _b.provinceName, cityName = _b.cityName, cityCode = _b.cityCode, countyName = _b.countyName, detailInfo = _b.detailInfo, streetName = _b.streetName;
params = __assign({ name: name, phone: telNumber, addressDetail: detailInfo, cityCode: cityCode, city: cityName, province: provinceName, area: countyName, streetName: streetName }, params);
if (!userAddress) return [3 /*break*/, 3];
return [4 /*yield*/, tb_1.commonConfirm('提示', '确认使用该收货地址:' + name + telNumber + userAddress.duibaAddress.address, function () {
return __awaiter(this, void 0, void 0, function () {
var result;
......@@ -79,22 +78,23 @@ var capiFn = function (apiList, request) {
})];
case 1:
result = _a.sent();
if (result && !result.success) {
tb_1.commonToast(failMessage || '领取失败,前去“我的奖品”查看原因');
return [2 /*return*/, true];
}
if (result && result.success) {
successMessage && tb_1.commonToast(successMessage);
return [2 /*return*/, true];
}
return [2 /*return*/];
return [2 /*return*/, false];
}
});
});
})];
case 2:
_c.sent();
return [2 /*return*/, false];
_c = (_d.sent());
return [3 /*break*/, 4];
case 3:
_c = false;
_d.label = 4;
case 4:
confirmResult = _c;
return [2 /*return*/, confirmResult];
}
});
});
......@@ -120,7 +120,7 @@ var capiFn = function (apiList, request) {
});
});
},
receiveEnamePrize: function (params, failMessage, successMessage) {
receiveEnamePrize: function (params) {
return __awaiter(this, void 0, void 0, function () {
var _a, handle, method, ext, result;
return __generator(this, function (_b) {
......@@ -132,12 +132,7 @@ var capiFn = function (apiList, request) {
})];
case 1:
result = _b.sent();
if (result && !result.success) {
tb_1.commonToast(failMessage || '领取失败,前去“我的奖品”查看原因');
return [2 /*return*/, true];
}
if (result && result.success) {
successMessage && tb_1.commonToast(successMessage);
return [2 /*return*/, true];
}
return [2 /*return*/, false];
......@@ -145,15 +140,17 @@ var capiFn = function (apiList, request) {
});
});
},
addStat: function (type, param) {
if (param === void 0) { param = {}; }
addStat: function (activityId, type) {
return __awaiter(this, void 0, void 0, function () {
var _a, handle, method, ext, result;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
_a = utils_1.getRequestParams(apiList['addStat']), handle = _a.handle, method = _a.method, ext = _a.ext;
return [4 /*yield*/, request(handle, method, __assign({ type: type }, param), ext).catch(function (res) {
return [4 /*yield*/, request(handle, method, {
activityId: activityId,
type: type
}, ext).catch(function (res) {
tb_1.commonToast(res && res.message);
})];
case 1:
......
{"version":3,"file":"capiFn.js","sourceRoot":"","sources":["../../src/request/capiFn.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAwD;AACxD,qCAA8C;AAC9C,kCAA4C;AAE5C,YAAY;AACZ,IAAM,MAAM,GAAG,UAAC,OAAO,EAAE,OAAO;IAC9B,OAAO;QACC,kBAAkB,EAAxB,UAAyB,MAAM,EAAC,WAAW,EAAC,cAAc;;;;;;4BAClD,KAA0B,wBAAgB,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,EAAvE,MAAM,YAAA,EAAE,MAAM,YAAA,EAAE,GAAG,SAAA,CAAqD;4BAClD,qBAAM,qBAAc,EAAE,CAAC,KAAK,CAAC,UAAA,GAAG;oCAC5D,gBAAW,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;gCAChC,CAAC,CAAC,EAAA;;4BAFI,WAAW,GAAa,SAE5B;4BACF,IAAG,CAAC,WAAW;gCAAE,sBAAO,KAAK,EAAA;4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No newline at end of file
......@@ -65,5 +65,9 @@ export declare const formatTimeStamp: (ms: number) => string;
* @param endTime
* @param noCheck
*/
export declare const validateActivityStatus: (startTime: number, endTime: number, noCheck: boolean) => Promise<unknown>;
export declare const validateActivityStatus: (checkParam: {
startTime: number;
endTime: number;
noCheck: boolean;
}) => Promise<unknown>;
export {};
......@@ -154,13 +154,6 @@ var generateAPI = function (apiList, request) {
};
});
return api;
// return Object.keys(apiList).reduce((prev, curr) => {
// const { handle, method, ext, defaultParams } = getRequestParams(apiList[curr]);
// return {
// ...prev,
// [curr]: params => request(handle, method, Object.assign({}, defaultParams, params) , ext)
// }
// }, {})
};
exports.generateAPI = generateAPI;
/**
......@@ -214,6 +207,10 @@ var checkIsMember = function (sellerId) { return __awaiter(void 0, void 0, void
var memberPlugin;
return __generator(this, function (_a) {
memberPlugin = requirePlugin("cemMember");
if (!memberPlugin) {
console.log('会员检查失败 :>> 请先申请入会插件');
return [2 /*return*/, false];
}
return [2 /*return*/, new Promise(function (resolve, reject) {
memberPlugin.checkMember({
sellerId: sellerId,
......@@ -251,13 +248,16 @@ exports.formatTimeStamp = formatTimeStamp;
* @param endTime
* @param noCheck
*/
var validateActivityStatus = function (startTime, endTime, noCheck) { return __awaiter(void 0, void 0, void 0, function () {
var nowTime;
var validateActivityStatus = function (checkParam) { return __awaiter(void 0, void 0, void 0, function () {
var nowTime, startTime, endTime, noCheck;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, tb_1.getServerTime()];
case 1:
nowTime = _a.sent();
startTime = checkParam.startTime, endTime = checkParam.endTime, noCheck = checkParam.noCheck;
if (!startTime || !endTime)
return [2 /*return*/, false];
return [2 /*return*/, new Promise(function (resolve, reject) {
if (nowTime < startTime) {
tb_1.commonToast('活动未开始');
......
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,OAAO,SAAI,OAAS,CAAA;AAC3C,CAAC,CAAA;AARY,QAAA,eAAe,mBAQ3B;AACD;;;;;GAKG;AACI,IAAM,sBAAsB,GAAG,UAAO,UAAoE;;;;oBAC/F,qBAAM,kBAAa,EAAE,EAAA;;gBAA/B,OAAO,GAAG,SAAqB;gBAC7B,SAAS,GAAuB,UAAU,UAAjC,EAAE,OAAO,GAAc,UAAU,QAAxB,EAAE,OAAO,GAAK,UAAU,QAAf,CAAe;gBAClD,IAAG,CAAC,SAAS,IAAI,CAAC,OAAO;oBAAE,sBAAO,KAAK,EAAA;gBACvC,sBAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAC,MAAM;wBAChC,IAAG,OAAO,GAAG,SAAS,EAAG;4BACvB,gBAAW,CAAC,OAAO,CAAC,CAAA;4BACpB,OAAO,CAAC,KAAK,CAAC,CAAA;yBACf;6BACI,IAAG,OAAO,GAAG,OAAO,IAAI,CAAC,OAAO,EAAE;4BACrC,gBAAW,CAAC,OAAO,CAAC,CAAA;4BACpB,OAAO,CAAC,KAAK,CAAC,CAAA;yBACf;6BACI;4BACH,OAAO,CAAC,IAAI,CAAC,CAAA;yBACd;oBACH,CAAC,CAAC,EAAA;;;KACH,CAAA;AAjBY,QAAA,sBAAsB,0BAiBlC"}
\ No newline at end of file
......@@ -61,7 +61,12 @@ export const tornadoAPIFn = async (tornadoAPI: string, nickName: string, handle:
if (!nickName) {
return getAuthUserInfo().catch(err => {
console.log('未授权成功', err);
}).then(res=> {
}).then((res: { nickName: string, avatar: string }) => {
const { nickName = '' } = res || {}
if(!nickName) {
console.warn('请先登录!')
return false
}
return tornadoAPICb(params_, res, loading, tornadoAPI)
})
}
......
......@@ -5,12 +5,12 @@ import { getRequestParams } from '../utils';
// 通用API封装方法
const capiFn = (apiList, request) => {
return {
async receiveObjectPrize(params,failMessage,successMessage) {
async receiveObjectPrize(params) {
const { handle, method, ext } = getRequestParams(apiList['receiveObjectPrize']);
const userAddress: IAddress = await getUserAddress().catch(err => {
commonToast(err.errorMessage);
});
if(!userAddress) return false
// if(!userAddress) return false
const { name, telNumber, provinceName, cityName, cityCode, countyName, detailInfo, streetName } = userAddress || {};
params = {
name,
......@@ -23,20 +23,16 @@ const capiFn = (apiList, request) => {
streetName,
...params
}
await commonConfirm('提示', '确认使用该收货地址:' + name + telNumber + userAddress.duibaAddress.address, async function() {
const confirmResult = userAddress ? (await commonConfirm('提示', '确认使用该收货地址:' + name + telNumber + userAddress.duibaAddress.address, async function() {
const result = await request(handle, method, params, ext).catch(res => {
commonToast(res && res.message);
});
if (result && !result.success) {
commonToast(failMessage || '领取失败,前去“我的奖品”查看原因');
return true;
}
if (result && result.success) {
successMessage && commonToast(successMessage)
return true;
}
})
return false
return false
})) : false
return confirmResult
},
async getVipInfo(params) {
......@@ -51,27 +47,22 @@ const capiFn = (apiList, request) => {
return false;
},
async receiveEnamePrize(params,failMessage,successMessage) {
async receiveEnamePrize(params) {
const { handle, method, ext } = getRequestParams(apiList['receiveEnamePrize']);
const result = await request(handle, method, params, ext).catch(res => {
commonToast(res && res.message);
});
if (result && !result.success) {
commonToast(failMessage || '领取失败,前去“我的奖品”查看原因');
return true;
}
if (result && result.success) {
successMessage && commonToast(successMessage)
return true;
}
return false;
},
async addStat(type: number | string, param = {}) {
async addStat(activityId: string, type: number | string) {
const { handle, method, ext } = getRequestParams(apiList['addStat']);
const result = await request(handle, method, {
type,
...param
activityId,
type
}, ext).catch(res => {
commonToast(res && res.message);
});
......
......@@ -98,13 +98,6 @@ export const generateAPI = <T, K extends Function>(apiList: T, request: K): IApi
});
return api;
// return Object.keys(apiList).reduce((prev, curr) => {
// const { handle, method, ext, defaultParams } = getRequestParams(apiList[curr]);
// return {
// ...prev,
// [curr]: params => request(handle, method, Object.assign({}, defaultParams, params) , ext)
// }
// }, {})
};
/**
* 函数节流,普通防连点
......@@ -144,6 +137,10 @@ export const getImgShareUrl = async (fileId: string | Array<string>) => {
export const checkIsMember = async (sellerId: number) => {
// @ts-ignore
const memberPlugin = requirePlugin("cemMember");
if(!memberPlugin) {
console.log('会员检查失败 :>> 请先申请入会插件')
return false
}
return new Promise((resolve,reject) => {
memberPlugin.checkMember({
sellerId,
......@@ -179,8 +176,10 @@ export const formatTimeStamp = (ms: number) => {
* @param endTime
* @param noCheck
*/
export const validateActivityStatus = async (startTime: number, endTime: number, noCheck: boolean) => {
export const validateActivityStatus = async (checkParam: { startTime: number, endTime: number, noCheck: boolean }) => {
const nowTime = await getServerTime()
const { startTime, endTime, noCheck } = checkParam
if(!startTime || !endTime) return false
return new Promise((resolve,reject) => {
if(nowTime < startTime ) {
commonToast('活动未开始')
......
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