文件
jw-beauty/miniprogram/utils/api.js
T
Guoguo f2ee086cc8 feat: 扫描报告页+手动选波长护理+光疗功效介绍页+诊断框架(占位阈值)
- services/diagnosis.js: 诊断流水线框架,阈值/PD映射为占位待标定,支持单波长降级
- auto-scan: 扫描完成改为出报告让用户选择护理(替代原自动开始治疗)
- 新增 scan-report/manual-treatment/light-info 三页,全部接入 i18n
- api.js: 新增 report/diagnosis-config 接口(对接后端契约)
2026-07-18 20:17:09 -07:00

43 行
2.4 KiB
JavaScript

var http = require('./request')
module.exports = {
// Auth
login: function (code) { return http.post('/api/v1/auth/login', { code: code }) },
getPhone: function (code) { return http.post('/api/v1/user/phone', { code: code }) },
// User
getProfile: function () { return http.get('/api/v1/user/profile') },
updateProfile: function (data) { return http.put('/api/v1/user/profile', data) },
// Device
getDevices: function () { return http.get('/api/v1/device/list') },
bindDevice: function (deviceId) { return http.post('/api/v1/device/bind', { device_id: deviceId }) },
confirmBind: function (deviceId, token) { return http.post('/api/v1/device/bind/confirm', { device_id: deviceId, bind_token: token }) },
unbindDevice: function (deviceId) { return http.post('/api/v1/device/unbind', deviceId ? { device_id: deviceId } : {}) },
// Subscription
getPlans: function () { return http.get('/api/v1/subscription/plans') },
getSubscription: function () { return http.get('/api/v1/subscription') },
activateTrial: function () { return http.post('/api/v1/subscription/trial') },
purchase: function (plan) { return http.post('/api/v1/subscription/purchase', { plan: plan }) },
// Payment
getPaymentOrder: function (orderId) { return http.get('/api/v1/payment/orders/' + orderId) },
syncPaymentOrder: function (orderId) { return http.post('/api/v1/payment/orders/' + orderId + '/sync') },
// Treatment
getRecords: function (params) { return http.get('/api/v1/treatment/history', params) },
syncTreatment: function (data) { return http.post('/api/v1/treatment/sync', data) },
getRecordDetail: function (id) { return http.get('/api/v1/treatment/' + id) },
// Scan report + diagnosis config (backend contract; see server scan-report routes)
saveReport: function (data) { return http.post('/api/v1/treatment/report', data) },
getLatestReport: function (deviceId) { return http.get('/api/v1/treatment/report/latest', deviceId ? { device_id: deviceId } : {}) },
getReport: function (id) { return http.get('/api/v1/treatment/report/' + id) },
getDiagnosisConfig: function () { return http.get('/api/v1/treatment/diagnosis-config') },
// Device commands
getPendingCommands: function (deviceId) { return http.get('/api/v1/device/command/pending', { device_id: deviceId }) },
reportCommandResult: function (data) { return http.post('/api/v1/device/command/result', data) }
}