Quellcode durchsuchen

fix: 底层接口封装移除gwAppId和token字段

carver vor 2 Jahren
Ursprung
Commit
7c9f327044

+ 2 - 4
antbuilder/core/store/actions/login.js

@@ -108,11 +108,9 @@ export default {
 		if (res) {
 			const [ywtErr, ywtResult] = await ywtAuth({
 				ticket: res.ticket,
-				gwAppId,
 			});
-			if (!ywtErr && ywtResult && ywtResult.token) {
-				app.globalData.ywtToken = "Bearer " + ywtResult.token;
-				app.globalData.ywtUserId = ywtResult.userId;
+			if (!ywtErr && ywtResult) {
+				app.globalData.ywtUserId = ywtResult.userId || "";
 			}
 		}
 		commit({

+ 4 - 1
antbuilder/core/utils/request.js

@@ -69,6 +69,8 @@ export function _request({
 							data: null,
 						},
 					]);
+				} else if (code === 401) {
+					resolve([null, result]);
 				} else if (code === 500) {
 					// 自定义错误
 					showErrorMessgage({
@@ -224,7 +226,7 @@ export default async function request(options) {
 	const [err, res] = await _request(options);
 	if (err) return [err, null];
 	const code = +getIn(res, ["code"], "");
-	if (code === 20001 || code === 20002 || code === 20008 || code === 401) {
+	if (code === 20001 || code === 20002 || code === 20008) {
 		const [error] = await setTicket();
 		if (!error) {
 			const result = await request(options);
@@ -233,6 +235,7 @@ export default async function request(options) {
 		return [error, null];
 	} else if (code === 401) {
 		// 手动发起请求
+		console.log("手动发起授权请求 33 ===>", res);
 	}
 	const data = res.data || null;
 	return [null, data];

+ 3 - 4
antbuilder/core/utils/service.js

@@ -79,10 +79,9 @@ export async function checkUserInfo() {
 	app.globalData.ticketData.expiresTime = expiresTime;
 	app.globalData.alipayUid = userInfo.alipayUid || "";
 	if (userInfo) {
-		const [ywtErr, ywtResult] = await ywtAuth({ ticket, gwAppId });
-		if (!ywtErr && ywtResult && ywtResult.token) {
-			app.globalData.ywtToken = "Bearer " + ywtResult.token;
-			app.globalData.ywtUserId = ywtResult.userId;
+		const [ywtErr, ywtResult] = await ywtAuth({ ticket });
+		if (!ywtErr && ywtResult) {
+			app.globalData.ywtUserId = ywtResult.userId || "";
 		}
 	}
 	return [null, res];

+ 0 - 1
app.js

@@ -12,7 +12,6 @@ App(
 	Store({
 		onLaunch(options) {
 			onDefaultAppLaunch.call(this, options);
-			console.log("options ===>", options);
 		},
 
 		globalData: { ...defaultGlobalData },