From 0db9215587e0bf444dd89d02521cd5bf40bc9119 Mon Sep 17 00:00:00 2001 From: longda Date: Tue, 24 Mar 2026 23:20:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D:=20=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=9B=B4=E6=96=B0API=E6=94=AF=E6=8C=81=E6=96=B0=E5=AD=97?= =?UTF-8?q?=E6=AE=B5/=E7=99=BB=E5=BD=95=E6=AC=A1=E6=95=B0=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/routers/auth.py | 6 ++++++ backend/app/routers/users.py | 30 ++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/backend/app/routers/auth.py b/backend/app/routers/auth.py index d3b7730..18e8797 100644 --- a/backend/app/routers/auth.py +++ b/backend/app/routers/auth.py @@ -100,6 +100,12 @@ def login( headers={"WWW-Authenticate": "Bearer"}, ) + # 更新登录次数和最后登录时间 + from datetime import datetime + user.f99_98_login_count = (user.f99_98_login_count or 0) + 1 + user.f99_99_last_login = datetime.now() + db.commit() + # 生成 token access_token = create_access_token(data={"sub": user.f99_90_id}) diff --git a/backend/app/routers/users.py b/backend/app/routers/users.py index 1914635..a94ea85 100644 --- a/backend/app/routers/users.py +++ b/backend/app/routers/users.py @@ -182,6 +182,12 @@ def update_user( role: Optional[str] = Body(None), password: Optional[str] = Body(None), user_code: Optional[str] = Body(None), + level: Optional[str] = Body(None), + points: Optional[int] = Body(None), + balance: Optional[float] = Body(None), + totalAmount: Optional[float] = Body(None), + aiCount: Optional[int] = Body(None), + searchCount: Optional[int] = Body(None), current_user: User = Depends(get_current_user), db: Session = Depends(get_db) ): @@ -201,6 +207,30 @@ def update_user( if role is not None: user.role = role + # 更新会员等级 + if level is not None: + user.f99_94_level = level + + # 更新积分 + if points is not None: + user.f99_100_points = points + + # 更新余额 + if balance is not None: + user.f01_11_balance = balance + + # 更新累计金额 + if totalAmount is not None: + user.f01_12_total_amount = totalAmount + + # 更新AI识别次数 + if aiCount is not None: + user.f99_95_ai_count = aiCount + + # 更新寻号次数 + if searchCount is not None: + user.f99_96_search_count = searchCount + # 更新用户编码 if user_code is not None: # 只有非空字符串才检查唯一性