CI/CD Pipeline / Backend Build & Test (push) Waiting to run
CI/CD Pipeline / Admin Web Build (push) Waiting to run
CI/CD Pipeline / Mini Program Compile Check (push) Waiting to run
CI/CD Pipeline / Migration Validation (push) Blocked by required conditions
CI/CD Pipeline / Test Shell Guard (Phase 23 Gate) (push) Waiting to run
CI/CD Pipeline / UI Contracts (source-structure gates) (push) Waiting to run
CI/CD Pipeline / E2E (live stack) (push) Blocked by required conditions
122 lines
4.1 KiB
TypeScript
122 lines
4.1 KiB
TypeScript
import { get, post, put, patch, del } from '../client'
|
||
import { idempotencyKey } from '../idempotency'
|
||
|
||
/** 本人全局状态(GET /me/status) */
|
||
export const userService = {
|
||
getStatus() {
|
||
return get('/me/status')
|
||
},
|
||
}
|
||
|
||
/** 本人资料 / 择偶条件 / 照片 / 隐私 / 审核 / 关系状态(对齐 miniapp/services/profileService.js) */
|
||
export const profileService = {
|
||
getProfile() {
|
||
return get('/me/profile')
|
||
},
|
||
updateProfile(payload: Record<string, any>) {
|
||
return put('/me/profile', payload, { idempotencyKey: idempotencyKey('profile-put', payload?.userId || 'me') })
|
||
},
|
||
updateBasicProfile(payload: Record<string, any>) {
|
||
return patch('/me/profile/basic', payload, { idempotencyKey: idempotencyKey('profile-basic', 'me') })
|
||
},
|
||
getCompletion() {
|
||
return get('/me/profile/completion')
|
||
},
|
||
getPreferences() {
|
||
return get('/me/preferences')
|
||
},
|
||
updatePreferences(payload: Record<string, any>) {
|
||
return put('/me/preferences', payload, { idempotencyKey: idempotencyKey('preferences-put') })
|
||
},
|
||
getPhotos() {
|
||
return get('/me/photos')
|
||
},
|
||
deletePhoto(photoId: string) {
|
||
return del(`/me/photos/${encodeURIComponent(photoId)}`)
|
||
},
|
||
setMainPhoto(photoId: string) {
|
||
return put(`/me/photos/${encodeURIComponent(photoId)}/main`, {}, { idempotencyKey: idempotencyKey('photo-main', photoId) })
|
||
},
|
||
requestUploadToken(payload: { fileName: string; contentType?: string }) {
|
||
return post('/me/photos/upload-token', payload, { idempotencyKey: payload.fileName })
|
||
},
|
||
confirmPhoto(payload: { fileKey: string; photoType: string }) {
|
||
return post('/me/photos/confirm', payload, { idempotencyKey: idempotencyKey('photo-confirm', payload.fileKey) })
|
||
},
|
||
getPrivacySettings() {
|
||
return get('/me/privacy-settings')
|
||
},
|
||
updatePrivacySettings(payload: Record<string, any>) {
|
||
return put('/me/privacy-settings', payload, { idempotencyKey: idempotencyKey('privacy-put') })
|
||
},
|
||
getReviewStatus() {
|
||
return get('/me/profile/review-status')
|
||
},
|
||
submitReview() {
|
||
return post('/me/profile/submit-review', {}, { idempotencyKey: idempotencyKey('review-submit') })
|
||
},
|
||
getRelationshipStatus() {
|
||
return get('/me/relationship-status')
|
||
},
|
||
pauseSearching() {
|
||
return patch('/me/relationship-status', { status: 'paused' }, { idempotencyKey: idempotencyKey('rel-pause') })
|
||
},
|
||
resumeSearching() {
|
||
return patch('/me/relationship-status', { status: 'searching' }, { idempotencyKey: idempotencyKey('rel-resume') })
|
||
},
|
||
markGettingToKnow() {
|
||
return patch('/me/relationship-status', { status: 'getting_to_know' }, { idempotencyKey: idempotencyKey('rel-gtk') })
|
||
},
|
||
}
|
||
|
||
/** 实名认证 */
|
||
export const verificationService = {
|
||
submit(payload: { realName: string; idCardNumber: string; faceImageUrl?: string }) {
|
||
const tail = (payload.idCardNumber || '').slice(-4).toUpperCase()
|
||
return post('/verification/submit', payload, { idempotencyKey: idempotencyKey('verification-submit', tail) })
|
||
},
|
||
getStatus() {
|
||
return get('/verification/status')
|
||
},
|
||
}
|
||
|
||
/** 本地资格核验 */
|
||
export const localEligibilityService = {
|
||
getStatus() {
|
||
return get('/local-eligibility')
|
||
},
|
||
declare(payload: Record<string, any>) {
|
||
return post('/local-eligibility/declaration', payload)
|
||
},
|
||
uploadEvidence(payload: Record<string, any>) {
|
||
return post('/local-eligibility/evidences', payload)
|
||
},
|
||
submit() {
|
||
return post('/local-eligibility/submit', {}, { idempotencyKey: idempotencyKey('local-eligibility-submit') })
|
||
},
|
||
}
|
||
|
||
/** 通知(用户端不提供聊天,仅通知) */
|
||
export const notificationService = {
|
||
getNotifications(params: Record<string, any> = {}) {
|
||
return get('/notifications', params)
|
||
},
|
||
markNotificationRead(id: string) {
|
||
return put(`/notifications/${encodeURIComponent(id)}/read`)
|
||
},
|
||
markAllNotificationsRead() {
|
||
return put('/notifications/read-all')
|
||
},
|
||
getNotificationsUnreadCount() {
|
||
// 后端实际路由为 GET /notifications/unread(返回 {count})
|
||
return get('/notifications/unread')
|
||
},
|
||
}
|
||
|
||
/** 公益服务记录(我的服务时间线) */
|
||
export const serviceHistoryService = {
|
||
getMyServiceHistory() {
|
||
return get('/me/service-history')
|
||
},
|
||
}
|