From 659f9f42aec01d928574791b4150c75a3ecf0585 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=9C=E9=B9=B0?= <17kungfuboy@gmail.com> Date: Wed, 15 Feb 2023 15:37:40 +0800 Subject: [PATCH] fix: some bug --- .../browser/src/app/pages/user-modal.component.ts | 12 ++++-------- .../project/api/http/edit/api-edit.component.ts | 2 +- .../browser/src/app/shared/services/trace.service.ts | 7 ++----- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/workbench/browser/src/app/pages/user-modal.component.ts b/src/workbench/browser/src/app/pages/user-modal.component.ts index 174e4b0e..6586605b 100644 --- a/src/workbench/browser/src/app/pages/user-modal.component.ts +++ b/src/workbench/browser/src/app/pages/user-modal.component.ts @@ -315,7 +315,7 @@ export class UserModalComponent implements OnInit, OnDestroy { this.store.clearAuth(); return; } - this.trace.setUserID(data.userId); + this.trace.setUser({ loginUserId: data.userId }); // * 0=邮箱 1=手机号 2=wx 3=qq 4=飞书 5=github 6=帐号 7=跳转登录 const hash = new Map().set(0, '邮箱').set(1, '手机号').set(2, 'Wecaht').set(3, 'QQ').set(4, 'Feishu').set(5, 'Github').set(6, '账号'); // (0, '登录').set(1, '注册'); @@ -325,9 +325,7 @@ export class UserModalComponent implements OnInit, OnDestroy { } if (data.type == 1) { // * register - this.trace.report('register_success', { - register_way: hash.get(data.loginWay) - }); + this.trace.setUser({ register_way: hash.get(data.loginWay) }); } this.store.setLoginInfo(data); this.effect.updateWorkspaceList(); @@ -420,7 +418,7 @@ export class UserModalComponent implements OnInit, OnDestroy { this.eMessage.error($localize`Please check you username or password`); return; } - this.trace.setUserID(data.userId); + this.trace.setUser({ loginUserId: data.userId }); // * 0=邮箱 1=手机号 2=wx 3=qq 4=飞书 5=github 6=帐号 7=跳转登录 const hash = new Map().set(0, '邮箱').set(1, '手机号').set(2, 'Wecaht').set(3, 'QQ').set(4, 'Feishu').set(5, 'Github').set(6, '账号'); // (0, '登录').set(1, '注册'); @@ -430,9 +428,7 @@ export class UserModalComponent implements OnInit, OnDestroy { } if (data.type == 1) { // * register - this.trace.report('register_success', { - register_way: hash.get(data.loginWay) - }); + this.trace.setUser({ register_way: hash.get(data.loginWay) }); } this.store.setLoginInfo(data); this.effect.updateWorkspaceList(); diff --git a/src/workbench/browser/src/app/pages/workspace/project/api/http/edit/api-edit.component.ts b/src/workbench/browser/src/app/pages/workspace/project/api/http/edit/api-edit.component.ts index b8bc9b45..1413dfa7 100644 --- a/src/workbench/browser/src/app/pages/workspace/project/api/http/edit/api-edit.component.ts +++ b/src/workbench/browser/src/app/pages/workspace/project/api/http/edit/api-edit.component.ts @@ -168,7 +168,7 @@ export class ApiEditComponent implements OnDestroy, TabViewComponent { this.trace.report('add_api_document_success', { trigger_way: ux, workspace_type: this.globalStore.isLocal ? 'local' : 'cloud', - param_type: IMPORT_MUI[this.model.requestParams?.bodyParams?.at(0)?.dataType] || '' + param_type: IMPORT_MUI[this.model.apiAttrInfo.contentType] || '' }); const data = this.getFormdata(); this.initialModel = this.apiEditUtil.formatEditingApiData(data); diff --git a/src/workbench/browser/src/app/shared/services/trace.service.ts b/src/workbench/browser/src/app/shared/services/trace.service.ts index 4f0bb134..89882176 100644 --- a/src/workbench/browser/src/app/shared/services/trace.service.ts +++ b/src/workbench/browser/src/app/shared/services/trace.service.ts @@ -26,11 +26,8 @@ export class TraceService { console.log('trace =>>', eventId, JSON.stringify(params, null, 2)); gio('track', eventId, params); } - setUserID(id) { - if (!id) { - return; - } - gio('setUserId', id); + setUser(data = {}) { + gio('people.set', data); } start() { gio('config', { dataCollect: false });