From 21d56e0d300afd3debff3b23b8e6ea6e9771e7d1 Mon Sep 17 00:00:00 2001 From: thinker007 Date: Fri, 15 Sep 2023 10:31:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E9=87=8AselfRoute.DELETE("/self",=20c?= =?UTF-8?q?ontroller.DeleteSelf)=20=E8=87=AA=E6=88=91=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=20=E9=81=BF=E5=85=8D=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E8=87=AA=E5=B7=B1=E3=80=82=20=E5=B0=86=E9=82=80=E8=AF=B7?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=E6=94=B9=E4=B8=BA=EF=BC=9Alink=20=3D=20`${wi?= =?UTF-8?q?ndow.location.origin}/login=3Faff=3D${data}`=20=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=8F=B7=E5=8D=87=E7=BA=A7=E5=88=B0v0.5.5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- router/api-router.go | 2 +- web/src/components/PersonalSetting.js | 19 ++----------------- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/router/api-router.go b/router/api-router.go index 7ad48871..60962d9b 100644 --- a/router/api-router.go +++ b/router/api-router.go @@ -37,7 +37,7 @@ func SetApiRouter(router *gin.Engine) { { selfRoute.GET("/self", controller.GetSelf) selfRoute.PUT("/self", controller.UpdateSelf) - selfRoute.DELETE("/self", controller.DeleteSelf) + //selfRoute.DELETE("/self", controller.DeleteSelf) //注释掉自我删除代码 不允许用户删除自己的账户 避免作弊 滥用免费额度。 selfRoute.GET("/token", controller.GenerateAccessToken) selfRoute.GET("/aff", controller.GetAffCode) selfRoute.POST("/topup", controller.TopUp) diff --git a/web/src/components/PersonalSetting.js b/web/src/components/PersonalSetting.js index 6baf1f35..447f8d16 100644 --- a/web/src/components/PersonalSetting.js +++ b/web/src/components/PersonalSetting.js @@ -75,7 +75,7 @@ const PersonalSetting = () => { const res = await API.get('/api/user/aff'); const { success, message, data } = res.data; if (success) { - let link = `${window.location.origin}/register?aff=${data}`; + let link = `${window.location.origin}/login?aff=${data}`; setAffLink(link); setSystemToken(""); await copy(link); @@ -102,19 +102,6 @@ const PersonalSetting = () => { showError('请输入你的账户名以确认删除!'); return; } - - const res = await API.delete('/api/user/self'); - const { success, message } = res.data; - - if (success) { - showSuccess('账户已删除!'); - await API.get('/api/user/logout'); - userDispatch({ type: 'logout' }); - localStorage.removeItem('user'); - navigate('/login'); - } else { - showError(message); - } }; const bindWeChat = async () => { @@ -178,9 +165,7 @@ const PersonalSetting = () => { - + {systemToken && (