xiaolongmr commited on
Commit ·
fad8c19
1
Parent(s): eaf2aba
套餐
Browse files- api-dev-8000.err.log +1 -1
- api/shop.py +10 -0
api-dev-8000.err.log
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
INFO: Started server process [
|
| 2 |
INFO: Waiting for application startup.
|
| 3 |
INFO: Application startup complete.
|
| 4 |
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
|
|
|
|
| 1 |
+
INFO: Started server process [35324]
|
| 2 |
INFO: Waiting for application startup.
|
| 3 |
INFO: Application startup complete.
|
| 4 |
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
|
api/shop.py
CHANGED
|
@@ -61,6 +61,16 @@ def create_router() -> APIRouter:
|
|
| 61 |
async def get_my_profile(authorization: str | None = Header(default=None)):
|
| 62 |
identity = require_identity(authorization)
|
| 63 |
profile = auth_service.get_profile(str(identity.get("id") or ""))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
if profile is None:
|
| 65 |
raise HTTPException(status_code=404, detail={"error": "当前用户不存在,请重新登录"})
|
| 66 |
return {"profile": profile}
|
|
|
|
| 61 |
async def get_my_profile(authorization: str | None = Header(default=None)):
|
| 62 |
identity = require_identity(authorization)
|
| 63 |
profile = auth_service.get_profile(str(identity.get("id") or ""))
|
| 64 |
+
if profile is None and str(identity.get("role") or "").strip().lower() == "admin":
|
| 65 |
+
profile = {
|
| 66 |
+
"id": str(identity.get("id") or "admin"),
|
| 67 |
+
"name": str(identity.get("name") or "管理员"),
|
| 68 |
+
"role": "admin",
|
| 69 |
+
"created_at": None,
|
| 70 |
+
"account_pool_enabled": True,
|
| 71 |
+
"wechat_openid": "",
|
| 72 |
+
"wechat_bound_at": None,
|
| 73 |
+
}
|
| 74 |
if profile is None:
|
| 75 |
raise HTTPException(status_code=404, detail={"error": "当前用户不存在,请重新登录"})
|
| 76 |
return {"profile": profile}
|