Commit Graph

76 Commits

Author SHA1 Message Date
Pine 9b1df88bf0 任务资格要求:最低信用分/要求勋章/要求认证(0061),can_accept 校验,发布端点接收 2026-09-05 11:33:37 +08:00
Pine e131bba599 任务流程按模式适配:新增 assigned(指派/邀约待确认)/signed(签约托管) 状态 + accept-invite/sign 端点 + 按模式时间线 + 超时释放 2026-09-05 11:18:18 +08:00
Pine 6d0385ef88 task claim 表单承载:0058 迁移修复(TEXT 去 server_default) + register/grab 申请表单落库 + claims 返回 form 2026-09-05 11:08:55 +08:00
Pine 3061ceb2d8 实时通知体系后端:NotificationService 三通道(落库+MQTT+SSE)、迁移0057、通知接口增强(分页/分类/单条已读/未读计数/公告)、SSE /notify/events 鉴权流,事件接入任务/接单/认证/信用/培训/服务/点赞/评论/运营审核 2026-09-05 10:37:14 +08:00
Pine 1a614cb409 任务完整详情:detail 放开终态权限、聚合时间线/交付/验收/发票/参与方 2026-09-05 09:25:04 +08:00
Pine c12380cf8c 任务系统 v2/v3:状态机统一、v2 发布字段、接单/交付/验收/返工/结算/发票全链路 2026-09-05 03:40:58 +08:00
Pine e4d8534155 信用体系与徽章体系完整实现:L1-L8等级+无上限累加积分+26事件规则+26徽章引擎+全量重算+用户/运营端接口 2026-09-05 03:05:56 +08:00
Pine e1459cda12 fix(审核): 审核列表返回真实HTML内容+支持全部状态筛选
- list_all() 替代 list_pending(), 支持 ?status= 过滤
- 审核列表对 html 模式调用 _load_html_content() 从 OSS 加载真实源码
- 修复 page_type 不一致数据(embed_url有值但page_type=html)
- admin端预览直接用返回的htmlContent生成Blob URL, 不再fetch /oss/
2026-09-05 02:30:29 +08:00
Pine 051f7a1aed feat(个人主页): 审核日志全链路+驳回原因必填
- 新增 user_page_review_logs 表(迁移0054): 记录submit/approve/reject
- submit接口自动写日志(用户提交)
- review接口: 驳回必须填写原因; 通过/驳回均写日志(操作人+备注)
- 新增 GET /pages/admin/{user_id}/logs 审核日志查询
2026-09-05 01:42:13 +08:00
Pine 1ec34c0a5c feat(个人主页): 审核流程+OSS存储+能力数据公开+URL模式强制无能力
- 迁移0053: html_url/review_status/review_note/submitted_at/reviewed_at
- HTML保存时上传OSS,数据库存html_url;URL模式只存embed_url
- URL(embed)模式强制capabilities为空(第三方网页无法接入平台能力)
- HTML模式选择能力后警告:必须真实接入,否则下架+永久关闭功能
- 上架流程: 保存草稿→提交审核→审核通过→上架;修改已上架内容自动下架
- GET /pages/{user_id} 根据capabilities返回公开的能力数据(订单/证书)
- postMessage桥注入capabilityData给HTML
- 运营端审核接口: /pages/admin/review/list + /pages/admin/{user_id}/review
- OSS新增download方法
2026-09-04 23:51:47 +08:00
Pine 279341dd51 feat(pages): 新增OPC个人主页(user_pages)后端 — 自写HTML/第三方嵌入、能力接入声明、徽章规则、公开渲染接口 2026-09-04 21:51:33 +08:00
Pine b90ee8aabc fix(agents): AgentRepository 空串 port 不再被拦截,修复服务端查不到/删不掉智能体
require_port 单角色后恒定 port='',但 AgentRepository 用 if not port 把空串当无 port 直接返回空/None,导致 GET /agents 永远为空、GET/DELETE 404 'Agent not found';本地删除依赖服务端先删身份,被 404 卡死后本地也无法删除。改为 if port is None 后空串正常参与查询。
2026-09-04 17:49:00 +08:00
Pine a3cf1e0cd7 feat(market): 商品封面图 cover_url + 图标/封面上传接口
- MarketItem 新增 cover_url 字段(0051 迁移,已应用)
- service.create_item / _row 支持 cover_url
- ItemCreate/UpdateRequest 增加 cover_url;create/update 持久化
- 新增 POST /market/admin/items/upload-image(kind=icon|cover,
  OSS market/images/,5MB 限制,返回稳定相对路径)
- 数据库连接切换到新主机 47.108.226.213(.env 已更新)
2026-09-03 21:37:19 +08:00
Pine fef55e0fbb feat(market): 市场分类字典 + 商品标识 slug 规范化
市场分类字典(admin 端弹窗维护,已运行生效):
- 新增 MarketCategory 模型 + 0050 迁移 + seed
- categories.py 重构为数据库驱动(list/valid/CRUD)
- admin 分类管理端点:增删改/排序/启停;商品列表支持分类筛选

商品标识 slug 规范化(修复云超服市场安装下载链路):
- 新增 _normalize_slug:标识不含 '/' 自动补 pineagents/ 前缀,
  避免单段 slug 在 owner/name 拆分时产生 undefined
- admin_create_item:创建时 slug 规范化
- admin_update_item:修复标识首次提交后再次编辑无效
  (此前 handler 未把 slug 传给 update_item)

配套:存量单段 slug 数据已批量规范化为 pineagents/<slug>
2026-09-03 20:28:44 +08:00
Pine 3fe6bf6dbc feat: 登录注入 MQTT 凭证、官方智能体平台化、会话ID扩容、微信支付分账/认证迁移 2026-09-03 12:40:05 +08:00
Pine 6bac6b5c80 fix: RatingRepository 添加 list_for 方法,修复 /me/credit 500 错误
/me/credit 接口调用了 db.ratings.list_for(),但 RatingRepository 只有 avg_for 和 create 方法,
导致 AttributeError 返回 500。添加 list_for 方法返回用户收到的评价列表。
2026-09-03 11:16:23 +08:00
Pine ab52d4013d fix: 修复接口错误 - _loads未定义+重新注册ecosystem路由
1. repositories.py: 添加 _loads 函数定义(之前从 hall_repositories 隐式依赖导致 NameError)
   - 修复 /cert/types 返回 500 错误
2. main.py: 重新注册 rbac_ecosystem 路由(通知/信用/任务/合同/争议等基础功能)
   - 修复 /me/credit 返回 404 错误
3. rbac_ecosystem.py: 将已移除的 service 角色统一替换为 opc_member
   - _ANY 元组移除 service
   - 所有 require_roles 中的 service 替换为 opc_member
2026-09-03 11:05:37 +08:00
Pine cb1492f2d6 fix: 完整审查修复 - 5个问题
1. _resolve_identity: permissions_for 未归一化 role → 使用 account_type+permission_role
2. rbac_org.py: 用 user.role 判断 operator → 改用 capabilities
3. membership_service: sync_user_affiliation 不同步 organization_members → 新增 _sync_org_members
4. repositories.to_profile: capabilities 只查旧表 → 增加 organization_members 查询
5. Header.RoleBadge: account_type_label 被 t() 重复翻译 → 优先直接显示中文
2026-09-03 09:43:34 +08:00
Pine 6bb988cc3e refactor: 角色组织账号模型重构 - 阶段一
1. capabilities 写入 JWT,避免每次请求查库
2. 移除 service 账号类型,非 operator/carrier 统一归为 opc_member
3. 前端统一基于 capabilities 判断权限
4. 清理登录接口死代码,恢复账号密码登录
5. 移除 enterprise/provider/government/investor/developer 角色
6. 清理 seed.py 中多余角色和权限定义
7. 重写 rbac_portals.py 只保留 carrier 路由
2026-09-03 00:35:40 +08:00
Pine 581ef33112 fix(market): bundle_json 字段 MySQL 已 ALTER 为 MEDIUMTEXT(skill 内嵌 SKILL.md 可能超 64KB) 2026-09-02 14:44:03 +08:00
Pine 86c6d24b17 fix(pay): 所有支付小程序码 page 路径修正为 pages-extra 子包路径
统一修正3处支付相关小程序码的 page 参数(之前误写为主包 pages/ 路径,
扫码后微信找不到页面→白屏):

- app/pay/service.py: 算力充值支付 → pages-extra/pay/index
- app/market/service.py: 市场购买支付 → pages-extra/pay/index
- app/training/main.py: 活动报名支付 → pages-extra/pay-qr/index

加上之前修复的 scan-login(auth.py + wechat.py 默认参数),
后端所有 get_wxacode 调用的 page 路径现已全部正确。
2026-09-02 11:47:34 +08:00
Pine 700bafdb26 feat(invite): 完整邀请归因系统
数据模型:
- User表添加inviter_id/invite_code/invited_at/invite_share_count字段
- 新建invite_records表记录分享/扫码/注册归因
- MySQL迁移已执行

后端API(/invite/*):
- GET /invite/me 获取我的邀请码和统计
- GET /invite/qrcode 生成带邀请参数的小程序码(体验版/正式版)
- POST /invite/share 记录分享行为
- POST /invite/scan 记录扫码行为(无需登录)
- GET /invite/invitees 获取我邀请的用户列表

登录归因:
- wx_login支持inviter参数,新用户自动绑定邀请人
- 用户列表返回inviter_name和invite_count

服务层:
- invite_service.py:邀请码生成、归因绑定、小程序码生成、统计
2026-09-02 02:18:41 +08:00
Pine ece9dcc7ee feat(incubator): 园区设置+企业/成员信息自动识别接口
- 新增 IncubatorSetting 模型与迁移 0042:开放区域说明/申请注意事项/月报说明
- GET/PUT /incubator/settings(管理方维护,提交方只读)
- GET /incubator/company(提交方企业资料,月报/申请表单自动带出)
- GET /incubator/company/members(企业绑定成员,联系人自动填入)
2026-09-01 22:31:53 +08:00
Pine 04624ab477 feat(dm): 站内会话 + 我发布的任务/岗位(0041)
- 0041 迁移:dm_messages 点对点私信表(会话按双方聚合,read_at 未读标记)
- DmRepository:send/conversations(聚合末条+未读数)/thread/mark_read
- /dm/conversations、/dm/messages(GET 记录+已读、POST 发送,禁自发、校验接收人存在)
- /hall/tasks/mine(发布者视角,附接单/报名/投标计数)、/hall/jobs/mine(附投递计数)
2026-09-01 20:19:04 +08:00
Pine 53f7f495d3 feat(incubator): 昆明大学生创业园运营系统子应用——月度报告(填报/审核/统计) + 共享区域(直播间/会议室)申请/审批/备案
- app/incubator/ 独立子应用(service.py + routers.py,prefix=/incubator,21 接口)
- 身份自动判定:管理方=role carrier(归属 park_tenants.operator_user_id 或权限码),提交方=company_members 关联 park_companies.tenant_id 非空
- 月度报告:一企业一月一报告(UNIQUE),状态 draft/submitted/approved/rejected,统计维度对齐《派音人工智能2608》纸质月报
- 共享区域:live/meeting 两类,冲突检测按 (area_id,start_at,end_at) 与 pending/approved 重叠,承诺勾选校验,审批+备案
- models.py 追加三 ORM 模型;main.py 挂载路由;0040_incubator 迁移(父=0039_wx_profitsharing)
2026-09-01 19:48:51 +08:00
Pine 0fd210ac1f feat(pay): 微信服务商分账+资金托管改造——OPC个人/商户双绑定收款、验收95/5分账、回调确认、escrow资金托管字段扩展
- profitsharing.py:服务商分账客户端(添加接收方/发起分账/查分账/退款/回调验签)
- payment_bindings + settlement_logs:OPC 收款绑定(personal openid / merchant 子商户号)与分账流水镜像
- settlement_service.release_escrow:验收后优先发起微信分账(95%接单者/5%平台),未配置时降级台账结算(channel=manual)
- handle_split_notify:分账回调确认 escrow released(幂等)
- 路由:分账回调 + 绑定创建/列表/停用
- 迁移:alembic 0039(新表 + escrows 幂等加列)+ 兜底迁移脚本 + 冒烟测试
2026-09-01 18:39:41 +08:00
Pine 496c006ba0 feat(task): 载体端任务流通——平台级任务下发载体端+可下架/上架(不可编辑)+大屏联动
- 新增 task_park_visibility 表(task_id+park_id+visible,唯一约束),alembic 0038 迁移
- TaskParkVisibilityRepository:get/set(幂等 upsert)/hidden_ids
- rbac_portals 新增载体端任务管理:GET /carrier/tasks(平台级任务+本载体下架状态)、POST /carrier/tasks/{id}/hide|unhide(不可编辑,无 update 端点)
- 大屏 /park/api/tasks 过滤升级:本园专属 ∪ 平台级任务(受载体下架控制)
- seed:u_car_01 幂等绑定默认园区 T001
2026-09-01 14:44:14 +08:00
Pine 61c572a19a feat(task,sms): 任务功能增量合并到大厅 + 短信生态配置
- 任务统一合并到 /hall:新增 grab/grab-by-code/bid/doing/complete/deliver/recommend 操作端点(走 TaskService 真实逻辑)
- 删除 rbac_opc 全部旧任务端点(广场/详情/grab/bid/doing/complete/assign/recommend/select/deliver),/opc/tasks 返回 404
- /opc/my-tasks 改真实聚合(task_claims 承接 + bids 投标,附任务信息),不再读 opc_tasks 演示表
- dashboard_service.opc_dashboard 改 task_claims 统计
- 删除 opc_tasks 演示表(models/seed/repositories)
- BidRepository 新增 list_by_opc
- 短信生态(上一轮):sms.py 阿里云签名、seed 7 项配置、send-code scene、rbac_hall 预约/订单短信
2026-09-01 11:22:19 +08:00
Pine 0a6f753584 fix(db): 补回 system_configs.description 列(修复 /admin/config 500)
- 此前 MySQL 适配时模型编辑误删 description,导致仓储序列化 AttributeError
- 0037_system_config_description:幂等补列(SQLite 已有则跳过)并回填存量说明
- 与并行的 0037_market 分叉建 merge 版本,统一迁移线(当前 head=02d10eccb1f9)
2026-08-31 23:45:03 +08:00
Pine 04808aaf76 feat(market): 技能/插件/应用统一市场子应用(目录/管理/定价/购买/支付分发)+ 0037 迁移与权限种子 2026-08-31 23:41:59 +08:00
Pine 6d0bfae6aa feat(hall): 服务订单状态机 + 发包方任务操作(0036)
- 0036 迁移 + ServiceOrder ORM/仓储(service_orders:预约/下单→接单→交付→完成)
- /hall/services/{id}/order 预约下单(禁下自己的单);/hall/orders/bought|selling 双视角
- /hall/orders/{id}/{action} 六动作流转(accept/reject/start/deliver/complete/cancel),
  服务方/买方/运营三方权限约束 + 状态机非法流转校验
- /hall/tasks/{id}/win|assign|select|cancel:评标定标/指派/报名选定/取消(仅发包方或运营端)
2026-08-31 23:09:27 +08:00
Pine edf9691d7e feat(hall): 大厅与社区数据层(0035 迁移 + ORM + 仓储)
- 0035 迁移:jobs/job_applications/opc_services/service_inquiries/talent_profiles/
  community_posts/community_comments/community_likes/community_follows 建表;
  tasks.register_quota、bids.material、park_tenants.area_m2/services_json 扩展
- models.py 新增九张大厅/社区表 ORM;tasks/bids/park_tenants 同步扩展列
- 新增 infrastructure/hall_repositories.py(岗位/投递/服务/询单/人才/帖子/评论/点赞/关注仓储,
  驼峰出参契约)并挂载进 Database 门面(hall_* / community_*)
- TaskRepository.create/update/_to_dict 补 register_quota;
  ParkAdmissionRepository.create(社区入驻复用,source=community)
2026-08-31 22:20:16 +08:00
Pine 374767bbca chore: 清理废弃 SQLite 代码与过时注释
- 删除死代码 app/db.py / app/repositories.py / app/dependencies.py(legacy 模块,
  import 即损坏且全仓无引用,活跃实现在 app/infrastructure/)
- 删除废弃库文件 serverdata/data/opc.db(2026-08-24 并入总库前的旧分库)
- 注释措辞同步 SQLite→统一总库(DATABASE_URL 决定方言)
2026-08-31 21:46:22 +08:00
Pine ee1dfdfed9 feat(db): 数据库层 MySQL 适配(方言钩子/同步驱动映射/种子方言分支)
- infrastructure/db.py:MySQL 方言编译钩子(String 无长度→VARCHAR(255),Text→MEDIUMTEXT);
  新增 sync_database_url/make_sync_engine(sqlite+aiosqlite→sqlite,mysql+asyncmy→mysql+pymysql)
- models.py:sessions.token 显式 String(2048)、system_configs.value 改 Text(存量数据超 255,MySQL 需兼容)
- seed.py:_add_agent 幂等插入按方言分支(SQLite=INSERT OR IGNORE / MySQL=INSERT IGNORE)
- park/tenants.py:同步只读引擎改走 make_sync_engine(原 +aiosqlite replace 对 MySQL 无效)
- 依赖补 pymysql;.env.example 补 PINEAGENTS_DEMO_DATABASE_URL 说明
2026-08-31 21:40:17 +08:00
Pine dbc29eee59 feat(membership): 成员制归属重构与叠加制身份(多对多成员表+转园两级审核)
- park_members/company_members 多对多成员表(0028),users.affiliation 为派生缓存由 sync_user_affiliation 刷新
- 转园两级审核状态机(0029):pending_from→pending_to→approved,支持用户/企业整体转园与运营端兜底
- 叠加制身份(0030):身份恒为运营/载体/OPC,企业管理员为能力叠加非身份,去除 enterprise/carrier 直写角色
- rbac 新增 memberships/park-transfers/企业管理员工作台 /admin/ent/* 接口

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-31 20:36:26 +08:00
Pine f1147dced3 feat(pay): 微信支付V3子应用与算力充值
- app/pay 独立支付子应用(config/wxpay/models/repository/service/routers),便于后期拆分微服务
- 充值订单表 0026_compute_recharge;套餐支持折扣(discount)与上架开关(enabled),DB system_configs 优先、env 兜底
- 统一小程序支付:桌面端出小程序码→扫码进小程序确认页按 openid 发起 JSAPI→回调幂等到账(引擎 adjust_user_quota+镜像回写)
- 内嵌 wechatpayv3(含 async_),响应验签失败降级告警;新增 aiofiles 依赖

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-30 22:29:44 +08:00
Pine 4f11931143 feat(content): 资讯发布时间/来源/发布人规范 + 点赞/留言/分享互动体系
- published_at 发布时间(迁移0022):运营端不限、园区端禁早于3天前,双方均支持定时发布;C端/大屏到点才可见
- 发布人:运营端可设(留空显示官方)、园区端固定园区名只能填来源
- 点赞/分享/留言(迁移0023-0025):content_likes 去重点赞、like_count/share_count、留言回复+评论点赞
- 各出口(内容/留言/入驻资料 docs)统一 resolve_url 生成 CDN 直链;入库统一 to_object_path 对象路径
2026-08-28 17:17:49 +08:00
Pine 985b85cb4e feat(oss): 统一OSS/CDN对象存储与直链出口体系
- infrastructure/oss.py 重写:服务端上传/预签名上下行/CDN鉴权直链(方式A)/resolve_url·to_object_path 出入口规范
- config.py 新增 OSS_REGION/OSS_CDN_BASE_URL/OSS_CDN_AUTH_KEY
- media_upload 统一走 oss 单例,返回 CDN 直链;dispatcher /oss 前缀路由
- 管理端用户列表头像出口 CDN 化
2026-08-28 17:17:38 +08:00
Pine 89396eb6b0 chore: 汇总提交(园区资料/内容审核/任务相关)+迁移0019/0021及部署编排调整 2026-08-27 21:02:47 +08:00
Pine 4ef0f81629 feat(auth): /auth/me 与登录响应暴露 wxBound/wxMiniBound 绑定状态
- UserProfile schema 增加 wxBound/wxMiniBound(LoginResponse/ProfileResponse 继承)
- to_profile 补 wx_openid/wx_mini_openid 判定,web/admin 正确识别手机号+小程序绑定
2026-08-27 20:26:34 +08:00
Pine 076f96af74 feat(tasks): 阶段A后端核心 —— 多模式任务字段 + 接单资格判定 + 各模式限额守卫 + 公开广场/详情can_accept
- Task 增扩展列:publisher_role/visibility/c_visible/park_public/assign_type/assign_park_id/assign_opc_id/park_id/park_released/bid_quota/win_quota/eligibility(JSON)/settle_mode(默认operator_escrow)
- TaskRepository._to_dict/create/update 同步新字段;迁移 0020_task_multi_mode
- TaskService.can_accept(task,user):仅被指派/园区专属/指派园区未发单 + eligibility(证书/地域/性别/工时/领域/专长/案例) 判定,返回 ok/reasons
- 抢单(grab)与投标(bid)接入 can_accept 守卫;bid 加报名上限与重复报名校验
- /opc/tasks 公开广场改为 published+c_visible;/opc/tasks/{id} 详情同;登录后附带 can_accept/accept_reasons(经 optional_current_user)
2026-08-27 19:05:18 +08:00
Pine 89bd7e8390 feat(content): 发布体系 大/小图 + 公开 + 园区端发布
- 迁移0018:content_items 加 card_mode/is_public/source/tenant_id
- ContentRepository:_to_dict/create/update 含新字段;list 加 public_only/tenant_id 过滤
- /opc/content 仅 published+公开;/opc/content/{id} 非公开→404
- 园区端 POST /park/api/content:发布人强制=园区名、source=carrier、tenant=本园、is_public 默认false(仅大屏)、card_mode默认small
- 园区端 GET /park/api/content:本园区内容(含未公开)供大屏
- schemas 补 card_mode/is_public

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-27 15:42:39 +08:00
Pine a60f0ed180 feat(content): 资讯详情 阅读数 + 留言
- 迁移0017:content_items.read_count + content_comments 表
- ContentRepository:_to_dict 加 read_count;incr_read_count/content_comments/add_content_comment
- rbac_opc:GET /opc/content/{id} 自增阅读数;GET/POST /opc/content/{id}/comments(发布需 opc_member,带昵称/头像)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-27 15:28:27 +08:00
Pine 71b1f03bca feat(content): 资讯富编辑(封面/图集/视频/外链/发布人) + 媒体上传
- 迁移0016:content_items 加 cover/images_json/video/video_cover/link/publisher_name/publisher_avatar
- ContentRepository:_to_dict/create/update 支持富字段;images(list)↔images_json;update 白名单含 publisher_id
- schemas:ContentCreate/UpdateRequest 加富字段
- rbac_operator:POST /content 注入发布人(actor 昵称/头像快照);新增 POST /admin/upload(媒体上传)
- app/services/media_upload.py:统一上传(serverdata/uploads + abs_url),与 /api/upload 同契约

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-27 14:35:32 +08:00
Pine 7ec9b8fd8a fix(db): 每请求独立 AsyncSession(根除并发 500)
- get_db 由「返回 app.state.db 单例」改为「每请求各建一个 Database 并在结束关闭」
- Database.__init__ 复用按 url 缓存的共享异步引擎(_shared_engine),避免每请求重建引擎
- 修复 GET /auth/me、/admin/* 并发时 sqlalchemy.exc.InvalidRequestError: concurrent operations are not permitted(同一 AsyncSession 被并发请求复用)
- 对齐 park 子应用 _carrier_db 的每请求 Database 模式

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-27 14:17:55 +08:00
Pine 873a70a095 feat(content): 资讯增删改 + C端资讯中心(类别)端点
- ContentRepository:+update(部分字段)/get/delete
- schemas.operator:+ContentUpdateRequest(全可选)
- rbac_operator:+PUT/DELETE /admin/content/{id}(action:content.manage+审计)
- rbac_opc:+GET /opc/content?type=policy|news|skill|dynamic(仅published)、/opc/content/{id}(详情)
- 类别字典 policy/news/skill/dynamic

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-27 14:05:38 +08:00
Pine 8697119aaa feat(park-company): 园区企业→成员 + 企业算力(折扣%/配额,只增不减) 后端
- 迁移0015:park_companies 加 compute_discount/compute_quota/compute_quota_used/engine_group/owner_user_id;users 加 park_company_id(成员归属一家企业)
- tenants.py:company_members/get/add/remove(写 users.park_company_id)、available_members(候选)、set_company_compute(折扣%/配额 单调非降,越界 ValueError)、sync_company_engine(引擎组倍率同步,best-effort)
- park/routers.py:carrier 端点 company-members GET/POST/DELETE、company-pool、companies/{cid}/compute(monotonic+引擎同步);鉴权 _carrier_user+_my_park 隔离本园区
- compute_client.py:set_user_group_by_username、set_group_group_ratio(组倍率=1-discount%)、grant_user_quota_by_username(解析引擎id后 add_quota)
- rbac_admin.py:平台兜底 GET /park/tenants/{tid}/companies、PUT .../companies/{cid}/compute(monotonic+audit)
- _user_to_dict 暴露 park_company_id
- 单调校验服务端强判:折扣降/配额负增 → 400

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-26 19:57:37 +08:00
Pine ac2df72b21 refactor(auth): 去多身份/多端口——账号单一角色,删 user_identities/select-identity/多端口路由
- 删 UserIdentity 模型/IdentityRepository/db.identities,账号统一单一角色(users.role)
- auth.py 去 select-identity/_identity_summaries,登录恒返回 identities=[];_login_response_for_user 按单角色签发
- 删多端口路由 rbac_government/investor/developer 及其 main 挂载
- seed 去多身份回填(_migrate_identities/_ensure_port_agents/多端身份/端口标签映射)
- dependencies: require_port 去端口隔离(单角色放宽)、optional_current_user 修 identity_id 多余参数
- user_admin_service create_user 不再建端口身份;schemas 去 SelectIdentityRequest
- 新增迁移 0014_drop_user_identities(drop user_identities 表)
- 测试改写为单角色契约(登录空 identities、无 select-identity、账号级智能体)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-26 19:15:51 +08:00
Pine 745ba678bd feat(auth): 统一鉴权收口,账号单一角色+权限码,去多身份
- dependencies._resolve_identity 收敛为单角色(users.role),不再读身份分支
- auth.login/select_identity 单角色发token、identities 恒空,Pine=operator(运营方)
- repositories.to_profile 按 role 计算 account_type(修复身份标签显示"服务方")
- seed 重构 PERMISSIONS/ROLE_PERMISSIONS:operator 平台全 menu、carrier 园区 menu:park_*,删多端口冗余
- account_types 归一 operator/carrier/opc_member/service

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-26 19:02:54 +08:00
Pine 30f0baf074 feat(opc): OPC认证/园区转园 数据层 — OpcCertification/ParkTransfer 模型 + 三个 repo + schemas
- models.py: ParkTenant 加 operator_user_id(园区归属载体账号);新增 OpcCertification/ParkTransfer 两 ORM 类
- repositories.py: OpcCertificationRepository/ParkTransferRepository/ParkAdmissionRepository + Database 挂载
- schemas/opc.py: OpcCertApplyRequest/ParkTransferApplyRequest
- schemas/admin.py: OpcCertReviewRequest/ParkAdmissionReviewRequest/ParkTransferReviewRequest
2026-08-26 15:43:34 +08:00