user.js
1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
* @Date: 2024-01-01 00:00:00
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-09-02 20:33:00
* @FilePath: /lls_program/src/api/user.js
* @Description: 用户相关接口
*/
import { fn, fetch } from './fn';
const Api = {
GET_PROFILE: '/srv/?a=user&t=get_profile',
UPDATE_PROFILE: '/srv/?a=user&t=update_profile',
}
/**
* @description: 获取个人信息
* @returns {Promise} 返回用户详细个人资料
* @returns {Object} response - 响应对象
* @returns {number} response.code - 响应状态码
* @returns {string} response.msg - 响应消息
* @returns {Object} response.data - 响应数据
* @returns {Object} response.data.user - 用户信息对象
* @returns {number} response.data.user.id - 用户ID
* @returns {string} response.data.user.openid - 微信openid
* @returns {string} response.data.user.nickname - 用户昵称
* @returns {string} response.data.user.avatar_url - 用户头像URL
* @returns {string} response.data.user.birth_date - 用户生日
* @returns {boolean} response.data.user.wheelchair_needed - 是否需要轮椅
*/
export const getUserProfileAPI = (params) => fn(fetch.get(Api.GET_PROFILE, params));
/**
* @description: 更新个人信息
* @param {Object} params - 请求参数
* @param {string} params.nickname - 用户昵称
* @param {string} params.birth_date - 用户生日
* @param {string} params.avatar_url - 用户头像URL
* @param {boolean} params.wheelchair_needed - 是否需要轮椅
*/
export const updateUserProfileAPI = (params) => fn(fetch.post(Api.UPDATE_PROFILE, params));