export function isJSON(str) {
	if (typeof str == 'string') {
		try {
			JSON.parse(str);
			if (typeof JSON.parse(str) === 'number') {
				return false;
			}
			return true;
		} catch (e) {
			return false;
		}
	}
}

export const getSysCode = () => {
  return getYunShangGuiZhouSyStemConfig().sysCode;
};

// 查询系统配置
export const getYunShangGuiZhouSyStemConfig = () => {
	const localStorageData = localStorage.getItem('antd-pro-systemConfig');
	if (localStorageData && isJSON(localStorageData)) {
		let d = JSON.parse(localStorageData);
		return {
			sysCode: d.code,
			logo: '',
			name: d.name,
			siteId: '5',
			siteUrl: '',
		};
	} else {
		return {
			sysCode: undefined,
			name: '',
		};
	}
};
