config.js 1.3 KB
/**
 * 小程序配置文件
 */
import { NativeModules } from 'react-native';

const config = {
  apiUrl: 'https://api-new.xiniunet.com/router?',
  uploadUrl: 'https://my-new.xiniunet.com/api/fileUpload.do',
  app_key: '48C6AEB8E12E2D3D249B4D7771594AD6',
  secret: '684CE9EF4B118766F3746997C9A256D2',
};
if(__DEV__){
	config.apiUrl = 'https://api-dev.xiniunet.com/router?';
	config.app_key = 'FEDA506D38D8E930626E850139E74E0C';
	config.secret = '9019951CC31D86A31D2E911D4BE51142';
	config.uploadUrl = 'https://my-plat.xiniunet.com/api/fileUpload.do';
}
if(NativeModules.system){
	NativeModules.system.getMode().then(
		(result) => {
			if (result.toLowerCase() === 'xntalkdev') {
				// 开发环境
				config.apiUrl = 'https://api-dev.xiniunet.com/router?';
				config.app_key = 'FEDA506D38D8E930626E850139E74E0C';
				config.secret = '9019951CC31D86A31D2E911D4BE51142';
				config.uploadUrl = 'https://my-plat.xiniunet.com/api/fileUpload.do';
			} else if (result.toLowerCase() === 'xntalktest') {
				config.apiUrl = 'https://api-test.xiniunet.com/router?';
				config.app_key = 'FEDA506D38D8E930626E850139E74E0C';
				config.secret = '9019951CC31D86A31D2E911D4BE51142';
				config.uploadUrl = 'https://my-test.xiniunet.com/api/fileUpload.do';
			}
		},
	).catch((error) => {
		console.log(error);
	});
}

module.exports = config;