fix: 测试环境显示develop分支
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 6m20s

This commit is contained in:
luo
2026-07-20 11:02:05 +08:00
parent fac05db39a
commit ca338dd345
4 changed files with 110 additions and 4 deletions

View File

@@ -3,7 +3,7 @@ name: 构建并部署前端到测试环境
on: on:
push: push:
branches: branches:
- main - develop
- dev - dev
- test - test
@@ -27,7 +27,7 @@ jobs:
- name: 设置镜像标签 - name: 设置镜像标签
id: tag id: tag
run: | run: |
if [ "${{ github.ref }}" = "refs/heads/main" ]; then if [ "${{ github.ref }}" = "refs/heads/develop" ]; then
echo "tag=latest" >> $GITHUB_OUTPUT echo "tag=latest" >> $GITHUB_OUTPUT
elif [ "${{ github.ref }}" = "refs/heads/dev" ]; then elif [ "${{ github.ref }}" = "refs/heads/dev" ]; then
echo "tag=dev" >> $GITHUB_OUTPUT echo "tag=dev" >> $GITHUB_OUTPUT
@@ -51,8 +51,8 @@ jobs:
docker push ${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.tag }} docker push ${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.tag }}
docker push ${{ env.IMAGE_NAME }}:${{ github.sha }} docker push ${{ env.IMAGE_NAME }}:${{ github.sha }}
- name: 部署到本地(仅 main 分支) - name: 部署到本地(仅 develop 分支)
if: github.ref == 'refs/heads/main' if: github.ref == 'refs/heads/develop'
run: | run: |
# 确保部署目录存在 # 确保部署目录存在
mkdir -p ${{ env.DEPLOY_DIR }} mkdir -p ${{ env.DEPLOY_DIR }}

View File

@@ -0,0 +1,24 @@
# Change: 代理现金余额不足100元展示
## Why
当前代理资金概况缺少对现金可用余额不足的明确提示,运营人员无法快速识别需要关注的店铺资金状态。业务要求以固定阈值 100 元展示预警,不开放阈值配置,也不把信用额度计入预警文案。
## What Changes
- 在代理资金概况中展示现金余额、冻结金额和基于后端 `low_balance_warning` 的“现金余额不足100元”红色状态。
- 复用 `GET /api/admin/shops/fund-summary`,读取 `balance``frozen_balance``cash_available``low_balance_warning` 字段,金额统一按分转元展示。
- 复用通知列表与通知目标解析接口,实现低余额通知跳转到对应店铺资金页。
- 明确前端不得自行计算 100 元阈值,也不得展示阈值输入框。
- 不包含公共站内通知中心页面的实现与改造。
## Impact
- Affected specs: `commission-management`
- Affected code:
- `src/types/api/commission.ts`
- `src/views/commission-management/agent-fund-overview/index.vue`
- 顶部通知抽屉相关通知跳转逻辑
- Out of scope:
- 公共站内通知中心页面的开发或改造
- 任意余额预警阈值配置能力

View File

@@ -0,0 +1,60 @@
## ADDED Requirements
### Requirement: Agent Cash Available Low Balance Warning
The agent fund overview SHALL display cash balance data and a fixed-threshold low balance warning using the backend-provided `low_balance_warning` flag from `GET /api/admin/shops/fund-summary`. The frontend MUST NOT calculate the threshold itself and MUST NOT expose any threshold configuration input.
#### Scenario: Display normal balance state above threshold
- **GIVEN** 用户进入代理资金概况页面
- **WHEN** `GET /api/admin/shops/fund-summary` 返回 `balance``frozen_balance``cash_available`
- **AND** `low_balance_warning=false`
- **THEN** 页面 MUST 展示现金余额和冻结金额
- **AND** 所有金额 MUST 按分转元展示
- **AND** 页面 MUST NOT 展示“现金余额不足100元”红色状态
#### Scenario: Display warning state at or below threshold
- **GIVEN** 用户进入代理资金概况页面
- **WHEN** `GET /api/admin/shops/fund-summary` 返回 `low_balance_warning=true`
- **THEN** 页面 MUST 展示“现金余额不足100元”红色状态
- **AND** 该提示 MUST NOT 将信用额度计入文案
#### Scenario: Frontend does not expose threshold configuration
- **WHEN** 用户查看代理资金概况页面
- **THEN** 页面 MUST NOT 展示余额预警阈值输入框或配置控件
- **AND** 前端 MUST NOT 依据 `cash_available` 自行计算是否低于 `100`
### Requirement: Agent Fund Summary Low Balance Response Fields
The frontend SHALL read the low-balance display state exclusively from the `GET /api/admin/shops/fund-summary` response fields `balance:int64`, `frozen_balance:int64`, `cash_available:int64`, and `low_balance_warning:bool`.
#### Scenario: Read low balance response contract
- **WHEN** 前端请求 `GET /api/admin/shops/fund-summary`
- **THEN** 前端 MUST 读取 `balance``frozen_balance``cash_available``low_balance_warning`
- **AND** `low_balance_warning` MUST be the only source of truth for whether the warning is shown
### Requirement: Low Balance Notification Target Navigation
The system SHALL allow users to navigate from low-balance notifications in the top notification drawer to the corresponding shop's fund overview page by reusing the notification list and notification target resolution APIs. Unauthorized targets SHALL follow the shared error-page behavior.
#### Scenario: Navigate from low balance notification to shop fund overview
- **GIVEN** 用户在顶部通知抽屉中看到低余额通知
- **WHEN** 用户点击该通知
- **THEN** 前端 MUST 复用 `GET /api/admin/notifications/{id}/target` 解析跳转目标
- **AND** 系统 MUST 导航到对应店铺的资金页
#### Scenario: Handle unauthorized notification target
- **GIVEN** 用户点击低余额通知
- **WHEN** 通知目标页无权限访问或目标不可访问
- **THEN** 系统 MUST 按统一错误页处理
#### Scenario: Public notification center is out of scope
- **WHEN** 本次变更落地
- **THEN** 公共站内通知中心页面 MUST NOT be required for this change to be considered complete
- **AND** 顶部通知抽屉跳转能力仍 MUST be supported

View File

@@ -0,0 +1,22 @@
## 1. API Contract
- [ ] 1.1 更新代理资金概况相关数据模型,补充 `balance``frozen_balance``cash_available``low_balance_warning` 字段读取。
- [ ] 1.2 复用 `GET /api/admin/notifications``GET /api/admin/notifications/{id}/target` 的既有通知接口,不新增站内通知中心专用接口。
## 2. Agent Fund Overview UI
- [ ] 2.1 在代理资金概况中展示现金余额、冻结金额,并统一按分转元格式化。
- [ ] 2.2 当 `low_balance_warning=true` 时展示“现金余额不足100元”红色状态。
- [ ] 2.3 不展示阈值输入框,不把信用额度计入预警文案,也不由前端自行计算余额阈值。
## 3. Notification Navigation
- [ ] 3.1 在顶部通知抽屉中支持低余额通知跳转到对应店铺资金页。
- [ ] 3.2 当用户无目标页面权限或目标不可访问时,按统一错误页处理。
- [ ] 3.3 明确公共站内通知中心页面不在本次实现范围内。
## 4. Verification
- [ ] 4.1 验证现金可用余额高于、等于、低于100元三种情况下的状态展示正确且仅由 `low_balance_warning` 控制。
- [ ] 4.2 验证通知跳转到对应店铺资金页成功,无权限时进入统一错误处理。
- [ ] 4.3 运行相关前端校验,并执行 `openspec validate update-agent-fund-low-balance-warning --strict`