release: freeze demo v1.1.0 2026-10-19
CI/CD Pipeline / Backend Build & Test (push) Canceled after 0s
CI/CD Pipeline / Admin Web Build (push) Canceled after 0s
CI/CD Pipeline / Mini Program Compile Check (push) Canceled after 0s
CI/CD Pipeline / Migration Validation (push) Canceled after 0s
CI/CD Pipeline / Test Shell Guard (Phase 23 Gate) (push) Canceled after 0s
CI/CD Pipeline / UI Contracts (source-structure gates) (push) Canceled after 0s
CI/CD Pipeline / E2E (live stack) (push) Canceled after 0s

This commit is contained in:
WorkBuddy
2026-10-19 20:36:22 +08:00
parent 8b505d9133
commit 69ebf33e18
157 changed files with 21111 additions and 72 deletions
+127
View File
@@ -0,0 +1,127 @@
import { get, post, put } from '../client'
import { opGet, opPost } from '../operatorClient'
import { idempotencyKey } from '../idempotency'
/** 用户端红娘服务(申请/我的服务/详情/推荐) */
export const matchmakerService = {
applyService(payload: Record<string, any>) {
return post('/matchmaker/services', payload, { idempotencyKey: idempotencyKey('matchmaker-apply') })
},
getMyServices(params: Record<string, any> = {}) {
return get('/matchmaker/services', params)
},
async getServiceDetail(serviceId: string) {
// 用户端后端未注册 GET /matchmaker/services/{id}(仅列表接口)——
// 由列表按 id 派生,避免对不存在路由发起 404 请求。
const result: any = await get('/matchmaker/services', { limit: 50 })
const list: any[] = result?.items || result?.records || (Array.isArray(result) ? result : [])
return list.find((s: any) => (s.serviceId || s.id) === serviceId) ?? null
},
confirmService(serviceId: string) {
return post(`/matchmaker/services/${encodeURIComponent(serviceId)}/confirm`, {}, {
idempotencyKey: idempotencyKey('matchmaker-confirm', serviceId),
})
},
withdrawService(serviceId: string) {
return post(`/matchmaker/services/${encodeURIComponent(serviceId)}/withdraw`, {}, {
idempotencyKey: idempotencyKey('matchmaker-withdraw', serviceId),
})
},
getRecommendations(params: Record<string, any> = {}) {
return get('/matchmaker/recommendations', params)
},
markRecommendationViewed(recommendationId: string) {
return put(`/matchmaker/recommendations/${encodeURIComponent(recommendationId)}/viewed`)
},
acceptRecommendation(recommendationId: string) {
return post(`/matchmaker/recommendations/${encodeURIComponent(recommendationId)}/accept`, {}, {
idempotencyKey: idempotencyKey('mm-rec-accept', recommendationId),
})
},
passRecommendation(recommendationId: string) {
return post(`/matchmaker/recommendations/${encodeURIComponent(recommendationId)}/pass`, {}, {
idempotencyKey: idempotencyKey('mm-rec-pass', recommendationId),
})
},
}
/**
* 红娘工作台(Operator 会话)。
* 不变量:红娘只做推荐/跟进,**不可替用户 Like/Pass**(AGENTS 第 5 条)。
*/
export const operatorMatchmakerService = {
dashboard() {
return opGet('/operator/matchmaker/dashboard')
},
myAssignments() {
return opGet('/operator/matchmaker/assignments/my')
},
recommendations() {
return opGet('/operator/matchmaker/recommendations')
},
pending() {
return opGet('/operator/matchmaker/pending')
},
managementServices() {
return opGet('/operator/matchmaker/management/services')
},
serviceDetail(id: string) {
return opGet(`/operator/matchmaker/services/${encodeURIComponent(id)}`)
},
recommend(serviceId: string, payload: Record<string, any>) {
return opPost(`/operator/matchmaker/services/${encodeURIComponent(serviceId)}/recommend`, payload)
},
followup(serviceId: string, payload: Record<string, any>) {
return opPost(`/operator/matchmaker/services/${encodeURIComponent(serviceId)}/followup`, payload)
},
complete(serviceId: string) {
return opPost(`/operator/matchmaker/services/${encodeURIComponent(serviceId)}/complete`, {})
},
myContactAuthorizations() {
return opGet('/operator/matchmaker/contact-authorizations/my')
},
requestContactAuthorization(payload: Record<string, any>) {
return opPost('/operator/matchmaker/contact-authorizations', payload)
},
revokeContactAuthorization(id: string, reason: string) {
return opPost(`/operator/matchmaker/contact-authorizations/${encodeURIComponent(id)}/revoke`, { reason })
},
referralHistory() {
return opGet('/referrals/operator/history')
},
referToServiceStation(payload: Record<string, any>) {
return opPost('/referrals/service-station', payload)
},
referToActivity(payload: Record<string, any>) {
return opPost('/referrals/activity', payload)
},
}
/** 红娘转介(用户侧确认) */
export const referralService = {
getMyReferralHistory() {
return get('/referrals/my-history')
},
confirmReferral(targetId: string, targetType: 'service_station' | 'activity') {
return post(`/referrals/${encodeURIComponent(targetId)}/confirm`, { targetType }, {
idempotencyKey: idempotencyKey('referral-confirm', `${targetId}:${targetType}`),
})
},
}
/** 受控联系授权(用户单独明示同意,INV) */
export const contactConsentService = {
my() {
return get('/contact-authorizations/my')
},
consent(id: string) {
return post(`/contact-authorizations/${encodeURIComponent(id)}/consent`, {}, {
idempotencyKey: idempotencyKey('contact-consent', id),
})
},
decline(id: string) {
return post(`/contact-authorizations/${encodeURIComponent(id)}/decline`, {}, {
idempotencyKey: idempotencyKey('contact-decline', id),
})
},
}