| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- /**
- * 调理方案模块 API
- */
- import http from '@/utils/http'
- /**
- * 获取调理方案列表(分页)
- * @param {Object} params - { modeType, page, size }
- * @param {string} params.modeType - 模式标识: PROFESSIONAL / CUSTOM / EXPERT
- * @param {number} [params.page=0] - 页码
- * @param {number} [params.size=100] - 每页数量
- * @returns {Promise<{records, total}>}
- */
- export function getCareList(params = {}) {
- return http.post('/userCare/careList', {
- page: params.page || 0,
- size: params.size || 100,
- modeType: params.modeType || ''
- })
- }
- /**
- * 获取当前用户的自定义方案列表
- * 通过 Token 获取当前 APP 账号下创作人属于自己的自定义模式方案
- * @returns {Promise<Array<{id, planCode, name, modeType, symptoms, applicableGender, ageMin, ageMax, description, authorId, authorName, authorType, useCount, avgRating, lastUseTime, status, createTime, updateTime}>>}
- */
- export function getCustomPlanList() {
- return http.get('/app/custom-plan/list')
- }
- /**
- * 获取用户自定义方案详情
- * @param {string|number} id - 方案ID
- * @returns {Promise<Object>} 方案详情含steps
- */
- export function getCustomPlanDetail(id) {
- return http.get(`/app/custom-plan/${id}`)
- }
- /**
- * 获取调理方案详情
- * @param {string|number} id - 方案ID
- * @returns {Promise<{steps: Array}>}
- */
- export function getCareDetail(id) {
- return http.get('/userCare/careDetail', { data: { id } })
- }
- /**
- * 新增用户自定义方案
- * @param {Object} data - 方案数据 { name, symptoms, applicableGender, ageMin, ageMax, description, status, steps }
- * @returns {Promise<number>} 新方案ID
- */
- export function createCustomPlan(data) {
- return http.post('/app/custom-plan', data)
- }
- /**
- * 修改用户自定义方案
- * @param {Object} data - 方案数据 { id, name, symptoms, applicableGender, ageMin, ageMax, description, status, steps }
- * @returns {Promise}
- */
- export function updateCustomPlan(data) {
- return http.put('/app/custom-plan', data)
- }
- /**
- * 删除用户自定义方案
- * @param {string|number} id - 方案ID
- * @returns {Promise}
- */
- export function deleteCustomPlan(id) {
- return http.delete(`/app/custom-plan/${id}`)
- }
|