Pine
|
7493383f6a
|
feat(users): 建号规则收紧与手机号绑定
- 管理端/园区端创建用户:账号系统随机生成不可指定,手机号必填且全局唯一
- 管理端用户管理支持绑定/更换手机号(PATCH /admin/users/{id}/phone)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-08-30 22:29:44 +08:00 |
|
Pine
|
e44fea96ca
|
feat(compute): /v1中继鉴权重写与平台用户余额视图
- relay 鉴权重写:JWT→引擎 PAT 逐用户归属,拒绝匿名调用,余额<=0 预检 403
- compute_client 增 list_engine_users/get_engine_user/sync_user_mirror 等
- 运营端新增 /admin/compute/platform-users 平台用户视图(引擎真实余额/折扣/用量)与充值镜像回写
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-08-30 22:29:44 +08:00 |
|
Pine
|
9c4908fb87
|
feat(auth): 停用账密登录 + 扫码会话有效期下发 + 叠加制身份模型
- /auth/login 全端口停用(403 引导手机号/小程序扫码登录)
- 扫码会话接口下发 expires_in(前端二维码倒计时)
- role_allowed 叠加制身份:所有账号自带 OPC 基础身份,operator/carrier 仅业务叠加,35 处 C 端端点统一放行
|
2026-08-28 17:17:58 +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
|
b745328d49
|
feat(tasks): 运营端任务详情/竞标/报名端点 + 园区发布任务端点
- 运营端 /admin/tasks/{id} 详情、/{id}/bids、/{id}/claims、/{id}/bids/{bid_id}/win 开标定标(余标置lost+进 in_progress)
- 园区端 POST /park/api/park/tasks 发布任务(publisher_role=park/park_id=本园/发布即上架/默认公有)
|
2026-08-27 20:19:40 +08:00 |
|
Pine
|
3bed50f316
|
feat(tasks): 企业发标 EnterpriseTaskCreate 增多端配置字段(可见性/指派/园区/名额/条件/托管)
|
2026-08-27 19:42:53 +08:00 |
|
Pine
|
34b662ce38
|
feat(tasks): 任务创建/更新 schema 增多端配置字段(可见性/指派/园区/名额/条件/托管)
|
2026-08-27 19:29:42 +08:00 |
|
Pine
|
ad1bcf5bbf
|
feat(tasks): 阶段A剩余 —— 园区端/大屏任务 + 运营平台资金托管结算
- 大屏 /api/tasks 改为仅展示「当前园区可接」:本园专属(park_id)∪公有(park_public),状态published/claimed/doing
- 园区端 /api/park/tasks(本园发布+指派本园列表) /tasks/{id}/release(园区内发单→park_released+可见性) /tasks/{id}/assign(园区内指派→锁定被指派人)
- 运营托管结算(operator):/admin/escrows(台账) /admin/tasks/{id}/escrow(托管建档/充值,佣金5%) /admin/tasks/{id}/release(验收结算,划佣金+余额代付OPC),全部挂运营平台
|
2026-08-27 19:07:20 +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
|
b80fba6150
|
feat(content): GET /admin/content/{id} 详情(编辑回填)
|
2026-08-27 14:56:21 +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
|
5840a5cb4c
|
feat(ops): 课程/活动管理支持编辑与删除
- training_admin_bridge:+update_course/delete_course/update_activity/delete_activity(tdb.update_row/delete_row)
- schemas.operator:+CourseUpdateRequest/ActivityUpdateRequest(字段全可选,仅更新传入项)
- rbac_operator:+PUT/DELETE /admin/courses/{id}、/admin/activities/{id}(action:course.manage/activity.manage + 审计)
- 富操作(增/改/删/态)齐备
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-08-27 10:33:15 +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
|
97f0a0698c
|
feat(park): 平台园区/屏幕绑定 + OPC认证入园转园审核 + 园区端carrier修复
- rbac_admin 新增 /admin/park/screens|tenants|devices/{id}/bind|unbind 及 OPC认证/入园/转园审核端点
- tenants.list_all_screens 带 online(MQTT心跳),bind/unbind 完备
- park/routers: tenant_bind 绑定即 set_role(carrier);_my_park 兜底 username→admin_username 解析园区(修"未关联任何园区")
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-08-26 19:02:58 +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
|
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
|
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 |
|
Pine
|
f6f2008498
|
refactor(auth): 账号类型彻底收敛为四种 + 各端口守卫改 service(去除冗余角色)
- 迁移守卫: provider/enterprise/government/investor/developer 一律 require_roles("service")
- token/profile.role 归一为四种(operator/carrier/opc_member/service); require_roles 与之一致
- 账号类型集中 app/domain/account_types.py; 子角色停用
|
2026-08-26 13:15:06 +08:00 |
|
Pine
|
00f43976b3
|
feat(auth): 账号类型收敛为四种 + 对外下发中文标签(文本)
- account_type(role)→operator/carrier/opc_member/service; 非运营非OPC一律service; sub_role置None
- 登录/me/资料统一返回 account_type + account_type_label(运营方/载体方/OPC/服务方); 前端直接渲染文本
- 权限按账号类型解析(service→provider基座), 逻辑集中在 app/domain/account_types.py
|
2026-08-26 13:09:02 +08:00 |
|
Pine
|
af6f01c5a9
|
feat(auth): 账号类型统一为四种(运营方/载体方/OPC/服务方) + 关闭子角色 + 权限逻辑集中
- 新增 app/domain/account_types.py(唯一来源): account_type(role)→operator/carrier/opc/service,
非运营非OPC一律→service(预留服务商/甲方企业); permission_role(类型)→权限角色码; label()
- _issue_token/_profile_for 统一走账号类型: 权限=permissions_for(permission_role(atype)),
子角色置None(停用); 资料暴露 account_type/account_type_label
- 端口角色(role)仅保留做内部路由守卫兼容, 对外鉴权用四种账号类型
|
2026-08-26 13:03:44 +08:00 |
|
Pine
|
cabc49eda9
|
fix(auth): 同一账号不同登录方式权限一致 —— 登录身份由账号真实角色决定
- 新增 _login_response_for_user: 保证 C端有opc_member身份, 但令牌角色取账号真实身份(多身份→中性token, role=users.role)
- phone/wx/mp/扫码/绑定 登录统一走它, 不再强制 opc_member → 手机号绑定的operator账号手机号登录也是operator
- 修「admin登录无权限, 刷新才有」根因(登录角色错配)
|
2026-08-26 13:00:20 +08:00 |
|
Pine
|
2bac67fb3c
|
fix(auth): 账号ID/登录名/昵称/微信身份彻底独立, 不再互相影响
- username 登录名独立生成: 微信用户 wx_<tokenHex>、手机号用户 u_<tokenHex> —— 不再 = openid / 手机号
- 手机号登录只按 phone 列查找(find_by_phone), 删除用 username 兜底
- 微信 openid/unionid/mini_openid 存各自列, 不污染 username
|
2026-08-26 12:55:05 +08:00 |
|
Pine
|
53521b9438
|
feat(auth): 支持通过小程序码「绑定小程序」到当前账号
- WxQrSessionStore 支持 bind_user_id(绑定态)+message; bind_user() 访问器
- POST /auth/mp-qr/bind-start(当前账号发起,返小程序码); confirm 检测绑定态: 把openid绑到目标账号(若该微信属另一账号则按手机号/微信合并)
- poll 返回 message(bound); repositories 加 set_wx_mini_openid
|
2026-08-26 12:47:55 +08:00 |
|
Pine
|
0cdcdeed26
|
feat(auth): 关闭所有微信登录(开放平台扫码),只保留小程序登录
- AUTH_WECHAT_QR 默认 false(禁用微信扫码OAuth); AUTH_WECHAT_LOGIN 默认 true(小程序登录开启)
- mp-qr/start 改挂 AUTH_WECHAT_LOGIN(小程序); /auth/status login_modes 不含 wechat
|
2026-08-26 12:25:53 +08:00 |
|
Pine
|
fa06678e92
|
feat(auth): 运行环境(生产/开发)+ 小程序码版本(体验版trial/正式版release)可配
- PINEAGENTS_ENV=prod|dev 判定运行环境; /auth/status 回显 env + wxacode_env 以便确认
- PINEAGENTS_WXACODE_ENV=release|trial|develop 决定小程序码指向(默认 prod→release, dev→trial=体验版)
- get_wxacode 用该 env_version(支持体验版测试)
|
2026-08-26 12:21:30 +08:00 |
|
Pine
|
f697fdad37
|
feat(auth): 统一账号绑定/解绑 + 按手机号自动合并(同一账号不新建)
- merge_accounts(keeper,absorbed): 身份字段继承、user_identities改挂、audit_logs/任务归属改指keeper、absorbed级联删除(防FK阻断)
- POST /auth/bind-phone(验证码,手机号被占用→按手机号合并成keeper并返新令牌); POST /auth/unbind(至少要留一种登录方式); wx-phone 改走合并
- profile 加 wxBound/wxMiniBound; schemas BindPhoneRequest/UnbindRequest
|
2026-08-26 12:15:22 +08:00 |
|
Pine
|
53cb18efe5
|
feat(auth): 小程序扫码登录其它端口 —— 生成小程序码(微信扫一扫自动拉起)
- wechat.get_wxacode(access_token缓存+getwxacodeunlimit),scene短token<=32
- /auth/mp-qr/start 返回 qr_image(小程序码,扫码自动打开小程序pages/scan-login) ,无凭据回退 qr_url
- mp-qr gate 改 AUTH_WECHAT_QR(默认开)
|
2026-08-26 11:59:54 +08:00 |
|
Pine
|
e761a089b9
|
feat(compute): 算力中心 余额门控+充值+真实来源数值
- relay 匿名不再回落admin令牌(root无限额)→401或受限RELAY令牌(修无余额可用)
- /admin/compute/user-balance(充值add/subtract/override)+审计; compute_client.adjust_user_quota
- proxy follow_redirects(修gin尾斜杠301/307空数据); ping 返 version+quota_per_unit
|
2026-08-26 11:59:54 +08:00 |
|
Pine
|
32ca580a06
|
feat(auth): 统一四种登录 —— 短信演示码123456 + 微信扫码OAuth + 小程序扫码
- sms stub 固定演示码123456
- 微信扫码(开放平台标准OAuth): /auth/wx-qr/start|wx-callback(GET/POST)|wx-qr/poll
- 小程序扫码: /auth/mp-qr/start|poll|confirm
- /auth/status 返回四 login_modes;WECHAT_OPEN_APPID/SECRET、AUTH_WECHAT_QR、WECHAT_QR_REDIRECT_URI 配置
|
2026-08-25 22:47:27 +08:00 |
|
Pine
|
9d60e0afc6
|
feat(auth): 平台成唯一账号源——小程序微信登录进 users + OPC 报名资料字段
统一用户账号体系(阶段1,非破坏):
- UserRepository 新增 get_by_wx_mini_openid。
- /auth/wx-login:小程序登录(X-Client=miniprogram)按 wx_mini_openid 建/复用
users 账号(role=opc_member, source=mini_program, auth_type=wx_openid),
并带 nickName/avatarUrl;非小程序仍走 wx_openid。
- /auth/me + 登录响应补齐小程序契约字段 name/phone/phoneBound。
- users 增 opc_status/topics 列(alembic 0010);desktop/web profile 也输出
name/phone/phoneBound/status/topics,且 update-profile 支持 name/status/topics 映射。
- scripts/db/seed.py 增 accounts→users 幂等迁移:旧小程序账号并入全局 users
(wx_mini_openid/phone 关联 + opc_member 身份),由用户执行 migrate+seed。
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-08-25 19:59: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
|
a976ce194e
|
refactor(auth): 统一登录=账号密码+手机号验证码, 微信扫码预留(本期未开放)
- auth/status 返回 login_modes([password,phone]) + wechat_login 标志, 供各端渲染(VITE 按此显示)
- wx-login 用 config.AUTH_WECHAT_LOGIN(默认 false) 闸门, 未开放返回 503'微信登录预留中'
- 本期所有端口两种登录模式; 微信扫码后期拓展
|
2026-08-25 16:25:50 +08:00 |
|
Pine
|
0039a809ac
|
feat(user): 用户认证状态/所属/账号类型 分类字段
- users 增: certification_status(uncertified|pending|certified|rejected)+certification_time, affiliation(independent|park)+park_id/park_name, account_type(opc_default|park_staff|platform_staff|provider|enterprise); alembic 0007
- repo: set_classification; _user_to_dict 含全部新字段; profile 返回认证/所属/账号类型
- admin: POST /admin/users/{id}/classification(认证/分类设置, action:user.manage) + UserClassificationRequest schema
- 迁移已应用, 导入通过
|
2026-08-25 16:24:19 +08:00 |
|
Pine
|
879396b532
|
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/算力)
|
2026-08-25 16:21:20 +08:00 |
|
Pine
|
ad14f9ccce
|
fix(compute): sync-users 移除 write_audit(根治会话 PendingRollback/UNIQUE 污染)
- write_audit 的 commit 与对账只读会话事务交互, 触发 PendingRollbackError + audit_logs.id UNIQUE 冲突, 并污染会话使后续 get_current_user 连带失败
- 对账幂等自明不写审计, 直接返回统计; 点击同步不再 500
|
2026-08-25 15:47:27 +08:00 |
|
Pine
|
77a71cc0e6
|
fix(compute): sync-users 审计改最佳努力,修复会话事务冲突 500
- 对账循环中 db.users.list() 开了未关事务, 末尾 write_audit 的 commit 报 IllegalStateChangeError(commit during prepare)
- 审计包裹 try/except 不阻断对账; 引擎用户同步不再 500
|
2026-08-25 15:45:30 +08:00 |
|
Pine
|
2675e3776a
|
feat(compute): 引擎用户对账同步(用户=平台总用户)
- compute_client.ensure_user(幂等建号, 存在不抛)
- 新增 POST /admin/compute/sync-users: 遍历平台全部用户→建引擎账号(幂等)+缺令牌签PAT, 保证 engine用户=平台用户
- 解决已有平台用户未回填导致引擎≠平台(此前仅新用户同步)
|
2026-08-25 15:31:32 +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 |
|