Files
jiebanke/mini-program/api/config.js
2025-08-31 21:09:33 +08:00

121 lines
2.6 KiB
JavaScript

// API基础配置
const config = {
// 开发环境
development: {
baseURL: 'http://localhost:3100/api',
timeout: 10000
},
// 生产环境
production: {
baseURL: 'https://api.jiebanke.com/api',
timeout: 15000
}
}
// 获取当前环境配置
const getConfig = () => {
const env = process.env.NODE_ENV || 'development'
return config[env]
}
// API端点
const endpoints = {
// 用户相关
USER: {
LOGIN: '/auth/login',
REGISTER: '/auth/register',
PROFILE: '/user/profile',
UPDATE_PROFILE: '/user/profile',
UPLOAD_AVATAR: '/user/avatar'
},
// 旅行计划
TRAVEL: {
LIST: '/travel/list',
DETAIL: '/travel/detail',
CREATE: '/travel/create',
JOIN: '/travel/join',
MY_PLANS: '/travel/my-plans',
SEARCH: '/travel/search'
},
// 动物认养
ANIMAL: {
LIST: '/animal/list',
DETAIL: '/animal/detail',
ADOPT: '/animal/adopt',
MY_ANIMALS: '/animal/my-animals',
CATEGORIES: '/animal/categories'
},
// 送花服务
FLOWER: {
LIST: '/flower/list',
DETAIL: '/flower/detail',
ORDER: '/flower/order',
MY_ORDERS: '/flower/my-orders',
CATEGORIES: '/flower/categories'
},
// 订单管理
ORDER: {
LIST: '/order/list',
DETAIL: '/order/detail',
CANCEL: '/order/cancel',
PAY: '/order/pay',
CONFIRM: '/order/confirm'
},
// 支付相关
PAYMENT: {
CREATE: '/payment/create',
QUERY: '/payment/query',
REFUND: '/payment/refund'
},
// 系统相关
SYSTEM: {
CONFIG: '/system/config',
NOTICE: '/system/notice',
FEEDBACK: '/system/feedback'
},
// 搜索相关
SEARCH: {
GLOBAL: '/search/global',
SUGGESTIONS: '/search/suggestions',
TRAVEL: '/search/travel',
ANIMAL: '/search/animal',
FLOWER: '/search/flower',
USER: '/search/user'
},
// 推广相关
PROMOTION: {
DATA: '/promotion/data',
RECORDS: '/promotion/records',
ALL_RECORDS: '/promotion/all-records',
QRCODE: '/promotion/qrcode',
REWARD_DETAILS: '/promotion/reward-details',
WITHDRAW: '/promotion/withdraw',
WITHDRAW_RECORDS: '/promotion/withdraw-records'
},
// 认证相关
AUTH: {
PHONE_LOGIN: '/auth/phone-login',
WECHAT_LOGIN: '/auth/wechat-login',
PASSWORD_LOGIN: '/auth/password-login',
SEND_SMS_CODE: '/auth/send-sms-code',
CHECK_TOKEN: '/auth/check-token',
REFRESH_TOKEN: '/auth/refresh-token',
BIND_PHONE: '/auth/bind-phone',
CHANGE_PASSWORD: '/auth/change-password',
RESET_PASSWORD: '/auth/reset-password'
}
}
export default {
...getConfig(),
endpoints
}