- Profile: show "未订阅" card when subscription inactive/0 days - Profile: subscription management navigates to page instead of modal - Subscribe-plans: data-driven plan cards with mock payment flow - Subscribe-plans: show current subscription status at top - Subscribe-prompt: "先使用普通模式" goes to wear-check directly - Add help and contact placeholder pages - Fix unbindDevice to work without explicit deviceId
33 行
1.7 KiB
JavaScript
33 行
1.7 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 }) },
|
|
mockBind: function (deviceId) { return http.post('/api/v1/device/mock-bind', { device_id: deviceId }) },
|
|
unbindDevice: function (deviceId) { return http.post('/api/v1/device/unbind', deviceId ? { device_id: deviceId } : {}) },
|
|
|
|
// Subscription
|
|
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 }) },
|
|
|
|
// 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) },
|
|
|
|
// 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) }
|
|
}
|