From bf2ab8d9d1f0c0c8ddc483b135eed3e5a26b50b9 Mon Sep 17 00:00:00 2001 From: TechQuery Date: Mon, 21 Oct 2024 02:01:36 +0800 Subject: [PATCH] [fix] 2 detail bugs of Lark API --- .github/workflows/deploy-production.yml | 2 +- src/controller/User.ts | 9 ++++++--- src/utility.ts | 5 +++-- 3 files changed, 10 insertions(+), 6 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..e8d7012 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; }