xiangqinxiaochengxu/miniprogram/utils/constants.js
2026-04-17 10:49:14 +08:00

36 lines
806 B
JavaScript

const DEFAULT_API_BASE_URL = 'http://127.0.0.1:8000/api/v1'
const API_BASE_URL_KEY = 'api_base_url'
const CUSTOMER_SERVICE_WECHAT_KEY = 'customer_service_wechat'
function getApiBaseUrl() {
return wx.getStorageSync(API_BASE_URL_KEY) || DEFAULT_API_BASE_URL
}
function setApiBaseUrl(url) {
if (!url) {
return
}
wx.setStorageSync(API_BASE_URL_KEY, url)
}
function getCustomerServiceWechat() {
return wx.getStorageSync(CUSTOMER_SERVICE_WECHAT_KEY) || 'service_wechat_001'
}
function setCustomerServiceWechat(value) {
if (!value) {
return
}
wx.setStorageSync(CUSTOMER_SERVICE_WECHAT_KEY, value)
}
module.exports = {
DEFAULT_API_BASE_URL,
API_BASE_URL_KEY,
CUSTOMER_SERVICE_WECHAT_KEY,
getApiBaseUrl,
setApiBaseUrl,
getCustomerServiceWechat,
setCustomerServiceWechat
}