Commit 09ae4bcf authored by qinhaitao's avatar qinhaitao

fix: 🐛 bug

parent f3173bd8
...@@ -140,7 +140,7 @@ var checkShopFavoredStatus = function (sellerId) { return __awaiter(void 0, void ...@@ -140,7 +140,7 @@ var checkShopFavoredStatus = function (sellerId) { return __awaiter(void 0, void
return [4 /*yield*/, helpers_1.promisifyApiToTb('checkShopFavoredStatus', { id: +sellerId })]; return [4 /*yield*/, helpers_1.promisifyApiToTb('checkShopFavoredStatus', { id: +sellerId })];
case 1: case 1:
result = _a.sent(); result = _a.sent();
if (result === null || result === void 0 ? void 0 : result.isFavor) if ((result === null || result === void 0 ? void 0 : result.isFavor) !== undefined)
return [2 /*return*/, result.isFavor]; return [2 /*return*/, result.isFavor];
if (result === 'checkShopFavoredStatus 仅支持真机调用,请在手机淘宝中运行') if (result === 'checkShopFavoredStatus 仅支持真机调用,请在手机淘宝中运行')
return [2 /*return*/, true]; return [2 /*return*/, true];
......
This diff is collapsed.
...@@ -220,10 +220,15 @@ exports.uploadImage = uploadImage; ...@@ -220,10 +220,15 @@ exports.uploadImage = uploadImage;
*/ */
var getAuthUserInfo = function () { var getAuthUserInfo = function () {
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
// @ts-ignore my.getAuthUserInfo({
success: function (userInfo) {
resolve(userInfo);
},
fail: function (err) {
my.authorize({ my.authorize({
scopes: 'scope.userInfo', scopes: 'scope.userInfo',
success: function () { success: function () {
console.log('执行 my.authorize');
// @ts-ignore // @ts-ignore
my.getAuthUserInfo({ my.getAuthUserInfo({
success: function (userInfo) { success: function (userInfo) {
...@@ -238,6 +243,9 @@ var getAuthUserInfo = function () { ...@@ -238,6 +243,9 @@ var getAuthUserInfo = function () {
reject(err); reject(err);
} }
}); });
}
});
// @ts-ignore
}); });
}; };
exports.getAuthUserInfo = getAuthUserInfo; exports.getAuthUserInfo = getAuthUserInfo;
......
This diff is collapsed.
{ {
"name": "tbcc-sdk-ts", "name": "tbcc-sdk-ts",
"version": "1.0.2", "version": "1.0.4",
"description": "", "description": "",
"main": "lib/index.js", "main": "lib/index.js",
"scripts": { "scripts": {
......
...@@ -75,7 +75,7 @@ export const checkShopFavoredStatus = async (sellerId: number) => { ...@@ -75,7 +75,7 @@ export const checkShopFavoredStatus = async (sellerId: number) => {
return false; return false;
} }
let result: { isFavor?: boolean } = await promisifyApiToTb('checkShopFavoredStatus',{ id: +sellerId }) let result: { isFavor?: boolean } = await promisifyApiToTb('checkShopFavoredStatus',{ id: +sellerId })
if(result?.isFavor) return result.isFavor if(result?.isFavor !== undefined) return result.isFavor
if(result === 'checkShopFavoredStatus 仅支持真机调用,请在手机淘宝中运行')return true if(result === 'checkShopFavoredStatus 仅支持真机调用,请在手机淘宝中运行')return true
return result return result
}; };
......
...@@ -149,10 +149,15 @@ export const uploadImage = async (opts = {}) => { ...@@ -149,10 +149,15 @@ export const uploadImage = async (opts = {}) => {
*/ */
export const getAuthUserInfo = () => { export const getAuthUserInfo = () => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// @ts-ignore my.getAuthUserInfo({
success: userInfo => {
resolve(userInfo);
},
fail: err => {
my.authorize({ my.authorize({
scopes: 'scope.userInfo', scopes: 'scope.userInfo',
success: () => { success: () => {
console.log('执行 my.authorize')
// @ts-ignore // @ts-ignore
my.getAuthUserInfo({ my.getAuthUserInfo({
success: userInfo => { success: userInfo => {
...@@ -167,6 +172,10 @@ export const getAuthUserInfo = () => { ...@@ -167,6 +172,10 @@ export const getAuthUserInfo = () => {
reject(err); reject(err);
} }
}); });
}
});
// @ts-ignore
}); });
}; };
/** /**
......
...@@ -76,3 +76,5 @@ interface ISkuInfo { ...@@ -76,3 +76,5 @@ interface ISkuInfo {
skuId: string skuId: string
quantity: string quantity: string
} }
declare var my: any
\ No newline at end of file
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