From d6edf7a8fc45d594c2ab9cc982e7ad5b483def65 Mon Sep 17 00:00:00 2001 From: TechQuery Date: Mon, 21 Oct 2024 02:33:41 +0800 Subject: [PATCH] [fix] 2 detail bugs of Lark API --- .github/workflows/deploy-production.yml | 2 +- src/controller/User.ts | 9 ++++++--- src/utility.ts | 7 ++++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/deploy-production.yml b/.github/workflows/deploy-production.yml index c9c8407..4942d1e 100644 --- a/.github/workflows/deploy-production.yml +++ b/.github/workflows/deploy-production.yml @@ -8,7 +8,7 @@ on: tags: - v* env: - ARTIFACT_PATH: /tmp/artifact.tar + ARTIFACT_PATH: artifact.tar BOX_NAME: ${{ github.event.repository.name }} BOX_URL: ${{ github.repository }} HOST: ${{ secrets.HOST }} diff --git a/src/controller/User.ts b/src/controller/User.ts index 7eb108a..4901c20 100644 --- a/src/controller/User.ts +++ b/src/controller/User.ts @@ -31,6 +31,7 @@ import { import { APP_SECRET, blobURLOf, + lark, leanClient, PersonBiDataTable, searchConditionOf @@ -47,6 +48,8 @@ export class UserController { }); static async signUp({ mobilePhone }: SignInData) { + await lark.getAccessToken(); + const [{ name, gender, avatar, email } = {}] = await new PersonBiDataTable().getList({ 手机号: mobilePhone }), existed = await store.findOneBy({ mobilePhone }); @@ -54,8 +57,8 @@ export class UserController { const saved = await store.save({ ...existed, mobilePhone, - email, - nickName: name || existed.nickName || mobilePhone, + email: email?.text, + nickName: name || existed?.nickName || mobilePhone, gender: gender === '女' ? Gender.Female @@ -100,7 +103,7 @@ export class UserController { return { token: body.validate_token }; } - @Post('/session/code') + @Post('/session/SMS-code') @OnUndefined(201) async createSMSCode( @Body() { captchaToken, captchaCode, mobilePhone }: SMSCodeInput diff --git a/src/utility.ts b/src/utility.ts index f380f5c..809b2c3 100644 --- a/src/utility.ts +++ b/src/utility.ts @@ -5,6 +5,7 @@ import { BiDataQueryOptions, BiDataTable, LarkApp, + TableCellLink, TableCellValue, TableRecordFields } from 'mobx-lark'; @@ -74,8 +75,8 @@ export class CommonBiDataTable extends BiDataTable() { client = lark.client; } -export interface Person - extends Record<'name' | 'gender' | 'email' | '手机号', string> { +export interface Person extends Record<'name' | 'gender' | '手机号', string> { + email: TableCellLink; avatar: TableCellValue; } @@ -94,7 +95,7 @@ export const blobURLOf = (value: TableCellValue) => ('file_token' in value[0] || 'attachmentToken' in value[0]) ? `${OWSBlobRoot}/${value[0].name}` : '' - : value + ''; + : value?.toString(); export const parseBlobConnection = (raw: string) => Object.fromEntries(