From 24198a0bd5810f87c099c404741eee6277eaa5f8 Mon Sep 17 00:00:00 2001 From: chenruilong Date: Fri, 24 Feb 2023 15:22:21 +0800 Subject: [PATCH] =?UTF-8?q?fix(uni-id-co):=20externalRegister=20=E5=A4=B4?= =?UTF-8?q?=E5=83=8F=E6=9C=AA=E4=BD=BF=E7=94=A8avatar=5Ffile=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E4=BF=9D=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../uni-id-co/module/external/register.js | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/external/register.js b/uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/external/register.js index 783fe7f..1b2279c 100644 --- a/uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/external/register.js +++ b/uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/external/register.js @@ -1,3 +1,4 @@ +const url = require('url') const { preRegister, postRegister } = require('../../lib/utils/register') const { EXTERNAL_DIRECT_CONNECT_PROVIDER } = require('../../common/constants') @@ -7,7 +8,7 @@ const { EXTERNAL_DIRECT_CONNECT_PROVIDER } = require('../../common/constants') * @param {object} params * @param {string} params.externalUid 业务系统的用户id * @param {string} params.nickname 昵称 - * @param {string} params.gender 性别 + * @param {number} params.gender 性别 * @param {string} params.avatar 头像 * @returns {object} */ @@ -46,6 +47,20 @@ module.exports = async function (params = {}) { } }) + const extraData = {} + + if (avatar) { + // eslint-disable-next-line n/no-deprecated-api + const avatarPath = url.parse(avatar).pathname + const extName = avatarPath.indexOf('.') > -1 ? avatarPath.split('.').pop() : '' + + extraData.avatar_file = { + name: avatarPath, + extname: extName, + url: avatar + } + } + const result = await postRegister.call(this, { user: { avatar, @@ -62,7 +77,8 @@ module.exports = async function (params = {}) { uid: externalUid } ] - } + }, + extraData }) return { -- GitLab