feat(user): 全局用户准确来源 + 丰富跨端字段(全端口兼容)

- users 增: wx_unionid/wx_mini_openid(微信绑定), source(来源枚举), auth_type, register_ip, last_login_ip/at, email, gender, birthday, compute_provisioned/username/quota/used_quota(算力镜像); alembic 0006
- 来源: register/phone-login/wx-login(读 X-Client 头,回退 body.source,再回退按 auth_type 推断)、admin 创建=admin、seed=seed
- auth: 登录(签发令牌)记 last_login; profile 返回 source/auth_type/compute; email/gender/birthday 可编辑
- 对账 sync-users 回写 compute_* 镜像到平台用户
- _user_to_dict 含全部新字段; 迁移已应用, 导入/零依赖校验通过(dict 含 source/算力)
This commit is contained in:
Pine
2026-08-25 16:21:20 +08:00
parent ad14f9ccce
commit 879396b532
7 changed files with 191 additions and 5 deletions
+1
View File
@@ -41,6 +41,7 @@ class UserAdminService:
user = await self.db.users.create(
req.username, req.password, nickname=req.nickname,
role=req.role, sub_role=req.sub_role, org_id=req.org_id, region_id=req.region_id,
source="admin", auth_type="admin",
)
await self.db.identities.create(
user["id"], port=_PORT_FOR_ROLE.get(req.role, "opc"), role=req.role,