GSS UC Integration — 用户中心 SSO / 主数据同步(Fred 子系统共享包)
将各子系统里同构的 modules/uc_integration 抽成可安装包,避免复制粘贴分叉。
能力
| 接口 | 说明 |
|---|---|
GET /{subsystem}/uc_integration/auth/sso/config |
登录模式 |
POST /{subsystem}/uc_integration/auth/sso/exchange |
UC code/accessToken → 本地 JWT |
POST /{subsystem}/uc_integration/auth/sso/refresh |
UC refreshToken 续期 |
POST /{subsystem}/uc_integration/internal/uc-sync |
UC 主数据推送(仅本机) |
GET /{subsystem}/uc_integration/internal/uc-sync |
同步健康检查 |
本地 JWT 的 sub 含:
- 本地身份:
id/username/name/store_id/store_ids/role uc:UC validate/exchange 原样透传(不做字段白名单)
安装
# 开发:可编辑安装
pip install -e /path/to/uc-integration
# 或从 git
pip install "gss-uc-integration @ git+ssh://git@github.com/org/uc-integration.git"
Fred 只从项目 modules/ 扫描蓝图,安装后必须链接:
# 在子系统根目录(含 modules/)
python /path/to/uc-integration/scripts/link_to_project.py .
# 或覆盖已有 symlink
python /path/to/uc-integration/scripts/link_to_project.py . --force
等价手动操作:
ln -sfn "$(python -c 'import uc_integration,pathlib; print(pathlib.Path(uc_integration.__file__).parent)')" \
modules/uc_integration
宿主配置
common/config/Config.py(或等价配置):
LOAD_CUSTOM_MODULES = [..., "uc_integration"]
SSO_LOGIN_MODE = 'uc' # 或 'local'
UC_SUBSYSTEM_CODE = 'ai_check' # 路由前缀:/{code}/uc_integration
USER_CENTER_BASE_URL = 'http://127.0.0.1:5001'
USER_CENTER_INTERNAL_SECRET = '...' # 与 UC OPEN_API_INTERNAL_SECRET 一致
# 可选
UC_INCLUDE_STORE_SCOPE = True # JWT 写入 store_ids / role(默认 True)
UC_STORE_FALLBACK_FIRST = True # 无匹配门店时回退第一个(默认 True)
宿主前置条件
- 本地库有
uc_user/uc_store等镜像表(可由 sync DDL 自动建) - ORM:
model.model中存在UcUser(以及门店 scope 需要的UcDept等) - 依赖:
fred_admin、Flask、SQLAlchemy(由子系统环境提供)
目录结构(Fred 兼容)
uc_integration/
__init__.py # 导出蓝图
backend/
__init__.py # Blueprint + url_prefix
deps.py # 惰性解析 model.model
controller/
service/
schema/
从旧模块迁移
pip install -e ../uc-integration- 备份并删除子系统
modules/uc_integration python ../uc-integration/scripts/link_to_project.py .- 确认
UC_SUBSYSTEM_CODE与门户子系统编码一致 - 验证
GET /{code}/uc_integration/auth/sso/config
版本
当前 0.1.0,以 ai_check(UC 原样透传)+ todo(门店 scope / 动态前缀)合并为基准。
Metadata
Release files for gss-uc-integration 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gss_uc_integration-0.1.0.tar.gz | 15.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gss_uc_integration-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 35.6 kB
Release files / gss_uc_integration-0.1.0.tar.gz
| Download URL | gss_uc_integration-0.1.0.tar.gz |
|---|---|
| Size | 15.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
71b1b101164774f9d3a363817b60e3839fe51a611d6168a7112a6be68613e185
|
|
BLAKE2b-256 checksum How to use checksums |
e49a62076e4f41e14935cb64423e600355bf91d412254be652a90b3feccb58bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / gss_uc_integration-0.1.0-py3-none-any.whl
| Download URL | gss_uc_integration-0.1.0-py3-none-any.whl |
|---|---|
| Size | 20.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
936e48ca0c9fdd2ca8d8fde2db38e5fccd08b1b8a78e3d34f958edfd92a72e6d
|
|
BLAKE2b-256 checksum How to use checksums |
16e5f8684c7bd6ae45450343e435e9c163135515a5779bd3150aef6c0978a5f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|