112 Commits

Author SHA1 Message Date
Pine 9f57ef25d6 refactor(training): 用户识别支持手机号身份并规范同步旁路注释
Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-30 22:29:44 +08:00
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 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 75b81ca8de chore(scripts): 演示数据临时脚本(资讯4类×25条+活动40场,手动 add/del,不入种子迁移) 2026-08-29 00:30:16 +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 084f039d10 feat(园区端): 放宽 release/assign 作用域(本园发布或指派本园均可) + 新增 /park/api/park/tasks/{id}/status 上架下架 2026-08-27 19:48:49 +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 9160183a3c feat(park): GET /park/api/content/feed 大屏资讯流(tenant 解析,含未公开) 2026-08-27 15:53:51 +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 74d50c829d feat(upload): 媒体上传优先走 OSS(OSS_ENDPOINT 启用→桶,返回 endpoint/bucket/key 绝对URL),本地降级
Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-27 14:53:59 +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 cbe0d03357 feat(admission): 园区入驻申请 —— park_admissions表+训练子应用端点+上传放宽
- 模型迁移0012 park_admissions(tenant/user/form_json/docs_json/status)
- app/training: GET /api/park/tenants(公开) / POST /api/park-admission / mine / 运营列表+review
- /api/upload 放宽到 图片/pdf/doc,20MB
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 c2f4c13ab3 feat(auth): 账号唯一性+清理多余账号 —— 迁移0011加phone/微信openid非空部分唯一索引
- users.phone/wx_openid/wx_mini_openid/wx_unionid 各自唯一(非空部分唯一索引)
- 创建账号必生成ID(create用new_id);find_by_phone/find_by_wx 唯一校验
- cleanup_accounts.py 清理旧accounts已被users接管的重复账号;seed不再重复造账号、迁移后删旧行
2026-08-25 22:47:27 +08:00
Pine 8a00712750 feat(training): 培训子应用接入统一账号——业务鉴权改验平台 JWT + 读写平台 users
阶段3(统一账号落地,小程序侧):
- require_auth 改为解平台 JWT(app.jwt.decode_access_token),返回 {username,sub};
  新增 _current_user(按 sub/username 取 users)、_user_payload(读 users 昵称/手机/
  opc_status/topics/source)、_set_user_phone。
- me/update-profile/bind-phone/wx-phone 改为读写平台 users;绑定手机用平台 sms 校验
  (platform_sms.verify) + 写 users.phone;update-profile 映射 name→nickname、
  status→opc_status、topics→JSON。
- 业务(报名/我的报名/查报名/签到)改从 _current_user 取手机号等资料。
- 移除培训端自带登录:register/login/send-code/phone-login/wx-login 返回 410,
  防止再产生 accounts 双套账号(统一走平台 /auth)。

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-25 20:22:24 +08:00
Pine 6b0c3ba134 feat(tasks): 新增任务种子脚本(幂等) —— 21 个多类型丰富演示任务
- scripts/db/seed_tasks.py:按 task_code 幂等插入;四种接单方式(grab/bid/assign/recommend)全覆盖、多分类(经 task_categories 映射 category_id)、多预算/交付时限/人数(限额或独占)/发包方/状态(published 上墙 + claimed/doing/completed/cancelled 对照)。21 条,当前任务总数 30、上墙 25。

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-25 20:18:16 +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