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
75 lines
3.2 KiB
TypeScript
75 lines
3.2 KiB
TypeScript
import { get, post, del } from '../client'
|
||
import { idempotencyKey } from '../idempotency'
|
||
|
||
/** 活动列表/详情/报名/我的活动/反馈/签到 */
|
||
export const activityService = {
|
||
getActivities(params: Record<string, any> = {}) {
|
||
return get('/activities', params)
|
||
},
|
||
getActivityDetail(activityId: string) {
|
||
return get(`/activities/${encodeURIComponent(activityId)}`)
|
||
},
|
||
register(activityId: string, payload: Record<string, any> = {}) {
|
||
return post(`/activities/${encodeURIComponent(activityId)}/register`, payload, {
|
||
idempotencyKey: idempotencyKey('activity-register', activityId),
|
||
})
|
||
},
|
||
cancelRegistration(activityId: string) {
|
||
return del(`/activities/${encodeURIComponent(activityId)}/register`)
|
||
},
|
||
getMyActivities(params: Record<string, any> = {}) {
|
||
// 后端实际路由为 GET /activities/my(原 /my-activities 无对应 handler → 404)
|
||
return get('/activities/my', params)
|
||
},
|
||
submitFeedback(activityId: string, payload: Record<string, any>) {
|
||
return post(`/activities/${encodeURIComponent(activityId)}/feedback`, payload, {
|
||
idempotencyKey: idempotencyKey('activity-feedback', activityId),
|
||
})
|
||
},
|
||
generateCheckinToken(activityId: string) {
|
||
return post(`/activities/${encodeURIComponent(activityId)}/checkin-token`, {}, {
|
||
idempotencyKey: idempotencyKey('checkin-token', activityId),
|
||
})
|
||
},
|
||
getMutualMatches(activityId: string) {
|
||
return get(`/activities/${encodeURIComponent(activityId)}/interests/mutual`)
|
||
},
|
||
checkMutualInterest(activityId: string, partnerId: string) {
|
||
return get(`/activities/${encodeURIComponent(activityId)}/interests/mutual/${encodeURIComponent(partnerId)}`)
|
||
},
|
||
}
|
||
|
||
/**
|
||
* 活动互选二阶段同意(INV-014/015):
|
||
* 互选结果 → 双方各自 confirm → 才创建 Match/沟通入口。
|
||
* 单向意向保密:结果接口只返回双相交集。
|
||
*/
|
||
export const activityMutualService = {
|
||
getResults(activityId: string) {
|
||
return get(`/activities/${encodeURIComponent(activityId)}/mutual/results`)
|
||
},
|
||
createConsent(activityId: string, partnerId: string) {
|
||
return post(`/activities/${encodeURIComponent(activityId)}/mutual/consent`, { partnerId }, {
|
||
idempotencyKey: idempotencyKey('mutual-consent', `${activityId}:${partnerId}`),
|
||
})
|
||
},
|
||
confirmConnection(activityId: string, partnerId: string) {
|
||
return post(`/activities/${encodeURIComponent(activityId)}/mutual/confirm`, { partnerId }, {
|
||
idempotencyKey: idempotencyKey('mutual-confirm', `${activityId}:${partnerId}`),
|
||
})
|
||
},
|
||
declineConnection(activityId: string, partnerId: string) {
|
||
return post(`/activities/${encodeURIComponent(activityId)}/mutual/decline`, { partnerId }, {
|
||
idempotencyKey: idempotencyKey('mutual-decline', `${activityId}:${partnerId}`),
|
||
})
|
||
},
|
||
getMyConsentStatus(activityId: string, partnerId: string) {
|
||
return get(`/activities/${encodeURIComponent(activityId)}/mutual/status/${encodeURIComponent(partnerId)}`)
|
||
},
|
||
confirmInterest(activityId: string, partnerId: string) {
|
||
return post(`/activities/${encodeURIComponent(activityId)}/interests/confirm`, { partnerId }, {
|
||
idempotencyKey: idempotencyKey('interest-confirm', `${activityId}:${partnerId}`),
|
||
})
|
||
},
|
||
}
|