luoweijian
|
fa476b4766
|
feat: 单端在线登录(顶号)——每 (用户, 端类型) 至多一个活会话
按 .scratch/single-device-login spec(票 01-07)落地:
- 会话反向索引 session:{userId}:{clientType}->jti(token 键为真相、索引为线索,
反查必验证、脏索引自愈),与 token 键 TTL 对齐并跟随滑动续期
- login/dingtalk 增可选 clientType(默认 pc、大小写不敏感、非法值 61016);
检测到设备在线不签正式 token,返回 61013 + 短命 preLoginToken(带 data 不抛异常)
- 新增 login/dingtalk/confirm:GETDEL 消费 preLoginToken(拿到即烧)-> 踢旧会话
(埋 kicked 标记 + 删旧 token)-> 签新 token 覆写索引;失效统一 61014
- 被顶设备下次请求:filter 埋 ATTR_KICKED_OFFLINE -> commence 输出 401 + 61015
- 登出改 CAS 删索引(Lua 脚本,防误删已被顶号覆写的新索引)
- crm-base Result 增 fail(code, msg, data) 重载;错误码 61013-61016 登记 README
- 存量会话(无 clientType)与老前端(不传 clientType)路径完全兼容;JWT 不变
- 测试:TokenServiceTest 18 / FilterTest 4 / HandlersTest 3 / AuthServiceImplTest +5,
crm-auth 183 全过,全仓 8 模块 BUILD SUCCESS
|
3 weeks ago |
luoweijian
|
3d55eeb196
|
feat(dict): data dictionary module — two-level flat model, CRUD/default/cache/permission/seed (ADR-0015)
- 4 tables (dict_group/dict_item/dict_group_default/dict_ref_count), delete_key soft-delete reuse
- DictGroup/DictItem full CRUD + force-delete + status toggle + enabled-list
- DictReferenceService: increment/decrement/batchApply/isReferenced, same-tx ref_count, no cache
- DictQueryService: Caffeine 10s cache + 2s negative cache for empty results, group.status join
- Default item: INSERT ON DUPLICATE KEY UPDATE, hibernate on group disable, auto-restore
- Permission seeds: 10 perm codes → sys_menu tree, bound to ROLE_ADMIN, no crm-auth import
- Built-in dict initializer: idempotent upsert, builtin=false never touched (US-41), value not overwritten
- 48 tests pass; full project compiles
|
1 month ago |