12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- import Taro from '@tarojs/taro'
- import { SHARE_CHANNEL } from '../constant'
- // Determine if the environment is `weapp` and get the `envVersion`
- const isWeApp = process.env.TARO_ENV === 'weapp'
- const accountInfo = isWeApp ? Taro.getAccountInfoSync() : null
- const envVersion = isWeApp
- ? accountInfo?.miniProgram.envVersion || 'release'
- : null
- // Helper function to determine base URL based on environment
- const getBaseUrl = (releaseUrl: string, preUrl: string) => {
- if (isWeApp) {
- return envVersion === 'release' ? releaseUrl : preUrl
- } else {
- return process.env.XLB_ENV !== 'pre_env' ? releaseUrl : preUrl
- }
- }
- // Define base URLs
- export const bluebookBaseConst = getBaseUrl(
- 'https://api.xiaolanben.com/bluebook/',
- 'https://api.xiaolanben.com/bluebook-pre/',
- )
- export const blueServiceBaseConst = getBaseUrl(
- 'https://api.xiaolanben.com/blue-service/',
- 'https://api.xiaolanben.com/blue-service-pre/',
- )
- export const blueUserBaseConst = getBaseUrl(
- 'https://api.xiaolanben.com/blue-user/',
- 'https://api.xiaolanben.com/blue-user-pre/',
- )
- export const blueConnBaseConst = getBaseUrl(
- 'https://api.xiaolanben.com/blue-conn/',
- 'https://api.xiaolanben.com/blue-conn-pre/',
- )
- export const xlbGatewayBaseConst = getBaseUrl(
- 'https://api.xiaolanben.com/',
- 'https://blue-book-pre.u51.com/',
- )
- export const bluebookGatewayBaseConst = getBaseUrl(
- 'https://api.xiaolanben.com/xlb-gateway/blue-book/',
- 'https://api.xiaolanben.com/blue-book-idc/blue-book/',
- )
- export const blueServicePrefix = isWeApp
- ? 'https://api.xiaolanben.com/'
- : '/api.xiaolanben.com/'
- export const usercenterbase = 'https://api.u51.com/'
- export function getUserCenterParams() {
- return {
- big_app_id: 35,
- app_id: 2035,
- plat: 4,
- channel: SHARE_CHANNEL,
- invitationCode: undefined,
- }
- }
|