Commit Graph

22 Commits

Author SHA1 Message Date
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 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 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 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 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 11598abcc1 feat(api): 任务广场与任务详情公开化(无需登录)
- GET /opc/tasks 去除 require_roles 改为公开,按 display_priority 降序返回已发布任务
- 新增 GET /opc/tasks/{task_id} 公开任务详情(仅已发布,其余404)
2026-08-27 18:36:16 +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 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 bc6265eb67 feat(opc): OPC认证/入园/转园 端点 + 园区端方案B审核 + 迁移0013
- rbac_opc.py: /opc/certification/apply|mine、/opc/park-transfer/apply|mine
- rbac_admin.py: platform operator 兜底 list/review (opc-certifications/park-admissions/park-transfers),通过回填 users.set_classification
- park/routers.py: carrier 角色凭 operator_user_id 定位本园区,/park/api park-admissions|transfers view+review
- park/tenants.py: bind_admin 写 operator_user_id + find_by_operator_user_id
- 迁移 0013: opc_certifications + park_transfers + park_tenants.operator_user_id
2026-08-26 15:43:34 +08:00
Pine ea904d3a50 feat(task): 完善任务系统 —— 分类字典/字段/四种接单方式/独占限额/交付时限
- Task 加 published_at/delivery_days/headcount/exclusive/publisher_id/category_id;新增 TaskCategory 分类字典表(35 类)。
- mode 归一 grab/bid/assign/recommend(旧 designated→assign、dispatch→recommend);TaskService 加 assign/recommend/select_recommend,claim 支持独占/限额、published+claimed 均可抢(多人)。
- TaskClaim 支持 source=assign/recommend、status=assigned/recommended/withdrawn + count_active_by_task;TaskCategoryRepository;Database 装配 task_categories。
- 端口:operator GET /admin/task-categories + POST tasks/{id}/assign|recommend|select;opc 同;park /api/tasks 返回 mode/deadline/delivery_days/headcount/exclusive/publisher_name。
- 迁移 0009(tasks 加列+task_categories)已应用+stamp;seed 35 分类字典 + task 新字段(含独占/推荐演示) + 补种已初始化库。
- 测试 test_task_system.py(独占/限额/指派/推荐/list_published/publish/category)+补齐 test_task_claim 语义, 15 passed。

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-25 19:30:16 +08:00
Pine b9b5e2e2ff feat(task): 任务中心扫码接单(多端) —— 服务端任务状态机/端口/迁移
- Task 加 task_code/tags/display_priority/claimed_by/claimed_at/doing_at;新增 TaskClaim 流水表。
- TaskService 加 claimed/doing/completed 状态机(claim/start_doing/complete),grab 并入 claim。
- TaskRepository 加 list_published/get_by_code/update/claim/set_doing + TaskClaimRepository;挂 Database。
- 端口:
  · opc  /tasks/grab-by-code、/tasks/{id}/doing、/tasks/{id}/complete
  · operator POST /tasks(auto task_code) + PATCH /tasks/:id
  · park  /park/api/tasks(大屏展示,含 scan_payload 二维码载荷)
  · training /api/tasks/claim-by-code、/api/tasks/my(小程序 C 端账号→OPC 身份 find-or-create 领单)
- 迁移 0008(tasks 加列 + task_claims)已应用+stamp;seed 补 task_code/tags/grab demo。
- tests/test_task_claim.py(自包含内存库, 状态机+流水+list_published), 直接 async 校验通过。

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-25 18:40:35 +08:00
Pine e5e9d265bf feat(compute): 归户闭环——relay 透传用户PAT + 用户用量/余额接口
- relay /v1 转发优先透传客户端 Authorization(用户算力PAT→compute归户), 无则回落 COMPUTE_RELAY_TOKEN(匿名)
- compute_client: user_balance/user_usage(取该用户一枚PAT鉴权查 /api/user/self|self/usage)
- rbac_opc 新增 /opc/compute/usage(本月按模型) + /opc/compute/balance
2026-08-25 14:38:23 +08:00
Pine 6685d80600 fix(compute): /opc/compute/base 与 tokens 500 修复
- base: request.base_url 是 URL 对象无 rstrip, 改 str(...).rstrip
- tokens: list_user_tokens 现返回列表, 兼容 list/dict
- 修复 OPC 桌面端算力中心 Base API 地址与令牌列表 500(此前 500→前端空/失败)
2026-08-25 14:15:16 +08:00
Pine 515735b772 feat(compute): 用户端算力中心 base 地址支持公网配置(PINEAGENTS_COMPUTE_PUBLIC_BASE)
- config 加 COMPUTE_PUBLIC_BASE; /opc/compute/base 优先用公网, 回落 request.base_url
- 避免经代理显示 127.0.0.1 内部地址; 用户可获真实可用的 /v1 接入地址
2026-08-25 14:08:26 +08:00
Pine 865f937f41 feat(compute): 把 admin 模型开放给 OPC 与 /v1(算力中心化)
- compute_client.list_models(status): 拉取 compute 引擎 admin 模型
- 新增 compute_catalog.py(替代静态 pineagents_catalog): Model行→桌面端形状(id/name/group/价格/能力/actual_model), 仅 status=1
- rbac_opc /opc/compute/models|prices 改读 admin 模型; /v1/models 与之一致
- 删 pineagents_catalog.py(静态, 不再引用)
- tests: compute_catalog._map 2 通过
2026-08-25 13:47:08 +08:00
Pine 6242717e7b feat(opc): 用户端算力中心(供应商自动对接 PineAgents)
- 新增 /opc/compute/*(require_roles opc_member): base(基础 API 地址)/models(可用模型)/prices(价目)/tokens(我的令牌 列表/创建/删除)
- pineagents_catalog: 供应商自动对接 PineAgents 的模型与价目目录(与 /v1 中继模型一致)
- compute_client: 新增 issue_user_token/list_user_tokens/delete_token(按用户名挂引擎用户)
- 令牌创建经引擎签 PAT, 用户可自服务管理; 引擎数据经 server-core 代理, 前端不直连
2026-08-25 12:21:15 +08:00
Pine 01ef3c9637 refactor: schemas 抽取(DTO 从 models.py 与路由内联迁至 api/schemas/)
- 新建 api/schemas/:auth/agents/admin/ecosystem/investor/opc/operator/org/portals
- models.py 移除 15 个 Pydantic DTO(保留 ORM 数据模型层)
- 13 个路由内联 DTO 全部迁出,路由瘦身仅剩处理逻辑
- 全量 66 测试通过
2026-08-24 09:51:52 +08:00
Pine c99662cfec feat: 业务层 services 抽取完成(工作台/用户管理)
- DashboardService:OPC 工作台聚合(统计/进行中任务/智能体建议/月度收入/消息)
- UserAdminService:建号+默认身份联动、角色分配提权防护(action:role.grant_perm 仅超管)
- rbac_opc dashboard / rbac_admin create_user+set_role 接线
- services 层覆盖全部核心业务域,路由全瘦身
2026-08-24 09:35:08 +08:00
Pine 413bd29390 feat: 业务层 services 抽取(财务/结算/补贴)
- FinanceService:opc_add_finance 直写 ORM 改为走 Repository.create(修复四层依赖违规)
- SettlementService:结算佣金(5%)/电子合同幂等/争议联动/投资撮合评分
- SubsidyService:政务三级审批状态机(区县→市→省→发放)
- rbac_ecosystem/rbac_government/rbac_opc 接线,路由瘦身
2026-08-24 01:54:04 +08:00
Pine d754d6ca4e feat: 业务层 services + 领域层 domain
- 领域层 domain/rules.py:RBAC 判定规则纯函数(role/permission/scope),接口层守卫改调领域规则
- 业务层 services/task_service.py:统一任务状态机(grab/bid/deliver/win/review),修复 deliver 无状态预检缺陷
- rbac_opc 抢单/投标/交付改走 TaskService
2026-08-23 23:56:39 +08:00
Pine 980a2db6d9 refactor: 平台应用异步四层架构(接口/业务/领域/基础设施)
- 基础设施层 async:SQLAlchemy 异步引擎/会话、33 Repository async 化、models/security/seed 迁入 infrastructure、新增 cache.py(redis.asyncio) 与 oss.py(aioboto3)
- 接口层:routers 迁 api/routers 并全 async,dependencies 迁 api/dependencies(get_db/get_current_user async)
- 依赖:sqlalchemy[asyncio]/aiosqlite/asyncmy/redis/aioboto3;config 异步 URL + Redis/OSS 配置
- 删除废弃:旧同步 db/dependencies/repositories/storage
- 验证:平台 19 路由 + 培训 48 路由全注册;/health /auth/login /auth/me /admin/tasks /notifications 等接口 async 可用
2026-08-23 23:52:58 +08:00