feat: 管理端推送 Webhook 配置与出站推送链路接入

1、修复了管理端设置在推送开关/配置项上的联动与保存问题。

2、新增 OutboundPushHookService、PushHook/InternalPushHook 接口、前端 PushHookConfigPanel 与小程序 pushHook 工具。

3、优化 Analyze/Auth/Test/支付回调触发路径,补充去重迁移脚本与实施文档。

Made-with: Cursor
This commit is contained in:
Ghost
2026-04-15 15:07:36 +08:00
parent c946584a7d
commit cf835ea585
29 changed files with 2964 additions and 111 deletions

View File

@@ -3,6 +3,7 @@ const app = getApp()
const payment = require('../../utils/payment')
const { hasPhone, bindPhoneByCode, isProfileComplete } = require('../../utils/phoneAuth.js')
const { mbtiDescriptions } = require('../../utils/descriptions')
const { triggerTestResultCompleted } = require('../../utils/pushHook')
function buildSceneFallback(baseResult) {
const mbti = baseResult.mbti || ''
@@ -393,6 +394,7 @@ Page({
// 记录本次测试记录ID由 /api/analyze 返回)
if (apiData && apiData._testResultId) {
updates.testResultId = apiData._testResultId
triggerTestResultCompleted(apiData._testResultId)
}
this.setData(updates)

View File

@@ -2,6 +2,7 @@
const app = getApp()
const payment = require('../../utils/payment')
const { getEnterpriseIdForApiPayload } = require('../../utils/enterpriseContext.js')
const { triggerTestResultCompleted } = require('../../utils/pushHook')
Page({
data: {
@@ -178,6 +179,9 @@ Page({
const requiresPayment = !!p.requiresPayment
const amountYuan = p.amountYuan || 0
const resultId = d._testResultId || 0
if (resultId) {
triggerTestResultCompleted(resultId)
}
// 兼容API 直接返回结构化对象,或把 JSON 放在 content 里
d = this.normalizeStructuredData(d)

View File

@@ -1,96 +1,96 @@
<!--pages/result/resume.wxml - 简历综合分析结果页 -->
<view class="container">
<!-- 分析中状态 -->
<view class="analyzing-modal" wx:if="{{loading && !error}}">
<view class="analyzing-content">
<view class="analyzing-icon">
<view class="spinner"></view>
</view>
<text class="analyzing-title">{{analyzingTitle || '正在分析中'}}</text>
<text class="analyzing-desc">{{analyzingTip}}</text>
<view class="analyzing-bar">
<view class="analyzing-bar-fill" style="width: {{progress}}%"></view>
</view>
<text class="analyzing-hint">这个过程可能需要30秒到1分钟请耐心等待...</text>
</view>
</view>
<!-- 结果显示 -->
<block wx:if="{{!loading || error || content || profileGate}}">
<!-- 页面顶部 Hero -->
<view class="hero-banner {{error ? 'hero-error' : 'hero-success'}}">
<text class="hero-icon">{{error ? '⚠️' : '📋'}}</text>
<view class="hero-text-wrap">
<text class="hero-title">{{error ? '生成失败' : '人才综合评估报告'}}</text>
<text class="hero-sub">{{error ? '请检查后重新生成' : '基于测评结果 · 综合分析'}}</text>
</view>
</view>
<!-- 异常状态 -->
<view class="card error-card" wx:if="{{error}}">
<text class="card-title error-title">失败原因</text>
<text class="card-text error-message">{{error}}</text>
<view class="action-btn-retry" bindtap="fetchResumeAnalysis">
<text class="retry-text">点击重新生成</text>
</view>
</view>
<!-- 需要付费解锁 -->
<view class="card pay-gate-card" wx:if="{{payInfo.requiresPayment && !payInfo.isPaid && !error}}">
<text class="pay-gate-icon">🔒</text>
<text class="pay-gate-title">报告已生成,需付费解锁</text>
<text class="pay-gate-desc">完整的简历综合分析报告已生成\n支付后即可查看全部内容</text>
<view class="pay-gate-amount">
<text class="pay-amount-label">解锁价格</text>
<text class="pay-amount-value">¥{{payInfo.amountYuan}}</text>
</view>
<view class="pay-gate-btn {{paying ? 'paying' : ''}}" bindtap="doPay">
<text class="pay-gate-btn-text">{{paying ? '支付中...' : '立即支付解锁'}}</text>
</view>
</view>
<!-- 资料未完善:与问卷/面相报告一致 -->
<view class="card pay-gate-card" wx:if="{{profileGate && (!payInfo.requiresPayment || payInfo.isPaid) && !error}}">
<text class="pay-gate-icon">📝</text>
<text class="pay-gate-title">完善资料后查看完整报告</text>
<text class="pay-gate-desc">请补全头像、昵称并绑定手机号\n即可查看简历综合分析全文</text>
<view class="pay-gate-btn" bindtap="goCompleteProfile">
<text class="pay-gate-btn-text">去完善资料</text>
</view>
</view>
<!-- 成功内容:分块卡片展示 -->
<block wx:if="{{content && sections.length > 0 && !payInfo.requiresPayment && !profileGate}}">
<view class="card section-card" wx:for="{{sections}}" wx:key="index">
<view class="section-header">
<text class="section-icon">{{item.icon}}</text>
<text class="section-title-text">{{item.title}}</text>
</view>
<view class="section-body">
<text class="content-text">{{item.body}}</text>
</view>
</view>
</block>
<!-- 兜底显示:解析失败时显示原始内容 -->
<view class="card" wx:if="{{content && sections.length === 0 && !payInfo.requiresPayment}}">
<text class="card-title">综合分析综评</text>
<text class="card-text content-text">{{content}}</text>
</view>
<!-- 操作按钮 -->
<view class="action-section" wx:if="{{!loading || error}}">
<button class="btn btn-primary" open-type="share" wx:if="{{!payInfo.requiresPayment && !profileGate && content}}">
<text class="btn-text">分享分析报告</text>
</button>
<view class="btn btn-outline" bindtap="fetchResumeAnalysis" wx:if="{{!loading && content && !payInfo.requiresPayment && !profileGate}}">
<text class="btn-text-outline">重新分析生成</text>
</view>
<view class="btn btn-outline" bindtap="goHome">
<text class="btn-text-outline">返回首页</text>
</view>
</view>
</block>
</view>
<!--pages/result/resume.wxml - 简历综合分析结果页 -->
<view class="container">
<!-- 分析中状态 -->
<view class="analyzing-modal" wx:if="{{loading && !error}}">
<view class="analyzing-content">
<view class="analyzing-icon">
<view class="spinner"></view>
</view>
<text class="analyzing-title">{{analyzingTitle || '正在分析中'}}</text>
<text class="analyzing-desc">{{analyzingTip}}</text>
<view class="analyzing-bar">
<view class="analyzing-bar-fill" style="width: {{progress}}%"></view>
</view>
<text class="analyzing-hint">这个过程可能需要30秒到1分钟请耐心等待...</text>
</view>
</view>
<!-- 结果显示 -->
<block wx:if="{{!loading || error || content || profileGate}}">
<!-- 页面顶部 Hero -->
<view class="hero-banner {{error ? 'hero-error' : 'hero-success'}}">
<text class="hero-icon">{{error ? '⚠️' : '📋'}}</text>
<view class="hero-text-wrap">
<text class="hero-title">{{error ? '生成失败' : '人才综合评估报告'}}</text>
<text class="hero-sub">{{error ? '请检查后重新生成' : '基于测评结果 · 综合分析'}}</text>
</view>
</view>
<!-- 异常状态 -->
<view class="card error-card" wx:if="{{error}}">
<text class="card-title error-title">失败原因</text>
<text class="card-text error-message">{{error}}</text>
<view class="action-btn-retry" bindtap="fetchResumeAnalysis">
<text class="retry-text">点击重新生成</text>
</view>
</view>
<!-- 需要付费解锁 -->
<view class="card pay-gate-card" wx:if="{{payInfo.requiresPayment && !payInfo.isPaid && !error}}">
<text class="pay-gate-icon">🔒</text>
<text class="pay-gate-title">报告已生成,需付费解锁</text>
<text class="pay-gate-desc">完整的简历综合分析报告已生成\n支付后即可查看全部内容</text>
<view class="pay-gate-amount">
<text class="pay-amount-label">解锁价格</text>
<text class="pay-amount-value">¥{{payInfo.amountYuan}}</text>
</view>
<view class="pay-gate-btn {{paying ? 'paying' : ''}}" bindtap="doPay">
<text class="pay-gate-btn-text">{{paying ? '支付中...' : '立即支付解锁'}}</text>
</view>
</view>
<!-- 资料未完善:与问卷/面相报告一致 -->
<view class="card pay-gate-card" wx:if="{{profileGate && (!payInfo.requiresPayment || payInfo.isPaid) && !error}}">
<text class="pay-gate-icon">📝</text>
<text class="pay-gate-title">完善资料后查看完整报告</text>
<text class="pay-gate-desc">请补全头像、昵称并绑定手机号\n即可查看简历综合分析全文</text>
<view class="pay-gate-btn" bindtap="goCompleteProfile">
<text class="pay-gate-btn-text">去完善资料</text>
</view>
</view>
<!-- 成功内容:分块卡片展示 -->
<block wx:if="{{content && sections.length > 0 && !payInfo.requiresPayment && !profileGate}}">
<view class="card section-card" wx:for="{{sections}}" wx:key="index">
<view class="section-header">
<text class="section-icon">{{item.icon}}</text>
<text class="section-title-text">{{item.title}}</text>
</view>
<view class="section-body">
<text class="content-text">{{item.body}}</text>
</view>
</view>
</block>
<!-- 兜底显示:解析失败时显示原始内容 -->
<view class="card" wx:if="{{content && sections.length === 0 && !payInfo.requiresPayment}}">
<text class="card-title">综合分析综评</text>
<text class="card-text content-text">{{content}}</text>
</view>
<!-- 操作按钮 -->
<view class="action-section" wx:if="{{!loading || error}}">
<button class="btn btn-primary" open-type="share" wx:if="{{!payInfo.requiresPayment && !profileGate && content}}">
<text class="btn-text">分享分析报告</text>
</button>
<view class="btn btn-outline" bindtap="fetchResumeAnalysis" wx:if="{{!loading && content && !payInfo.requiresPayment && !profileGate}}">
<text class="btn-text-outline">重新分析生成</text>
</view>
<view class="btn btn-outline" bindtap="goHome">
<text class="btn-text-outline">返回首页</text>
</view>
</view>
</block>
</view>