浏览代码

fix: 底层接口添加alipayUid字段

carver 2 年之前
父节点
当前提交
c0602d8b94
共有 3 个文件被更改,包括 7 次插入1 次删除
  1. 1 0
      antbuilder/core/store/actions/login.js
  2. 5 1
      antbuilder/core/utils/request.js
  3. 1 0
      antbuilder/core/utils/service.js

+ 1 - 0
antbuilder/core/store/actions/login.js

@@ -104,6 +104,7 @@ export default {
 		}
 		app.globalData.isUserLogin = true;
 		app.globalData.userInfo = res;
+		app.globalData.alipayUid = res.alipayUid || "";
 		if (res) {
 			const [ywtErr, ywtResult] = await ywtAuth({
 				ticket: res.ticket,

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

@@ -40,6 +40,7 @@ export function _request({
 			data: Object.assign(data, {
 				userId: app.globalData.ywtUserId || "",
 				appId: app.globalData.appId || "",
+				alipayUid: app.globalData.alipayUid,
 				terminal,
 			}),
 			headers: {
@@ -118,6 +119,7 @@ export function _ywtRequest({
 			data: Object.assign(data, {
 				userId: app.globalData.ywtUserId || "",
 				appId: app.globalData.appId || "",
+				alipayUid: app.globalData.alipayUid,
 				terminal,
 			}),
 			headers: {
@@ -222,13 +224,15 @@ 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) {
+	if (code === 20001 || code === 20002 || code === 20008 || code === 401) {
 		const [error] = await setTicket();
 		if (!error) {
 			const result = await request(options);
 			return result;
 		}
 		return [error, null];
+	} else if (code === 401) {
+		// 手动发起请求
 	}
 	const data = res.data || null;
 	return [null, data];

+ 1 - 0
antbuilder/core/utils/service.js

@@ -77,6 +77,7 @@ export async function checkUserInfo() {
 	const { ticket, expiresTime, userInfo } = res;
 	app.globalData.ticketData.ticket = ticket;
 	app.globalData.ticketData.expiresTime = expiresTime;
+	app.globalData.alipayUid = userInfo.alipayUid || "";
 	if (userInfo) {
 		const [ywtErr, ywtResult] = await ywtAuth({ ticket, gwAppId });
 		if (!ywtErr && ywtResult && ywtResult.token) {