wx.request({
url: 'https://wx-xiaochengxutouxiangbizhi.oss-cn-shenzhen.aliyuncs.com/xzrgGo.json',
header: {
'content-type': 'application/json'
},
success(res) {
// 直接获取字符串数据,不需要 JSON.stringify
let stationInfo = res.data.data.open;
console.log('我们收到的数据:', stationInfo);
console.log('数据类型:', typeof stationInfo);
// 按字符串进行比较
if (stationInfo === "0") {
console.log('条件成立: open === "0"');
// 当 open 为 "0" 时的逻辑
} else {
console.log('条件不成立: open !== "0"');
// 当 open 不为 "0" 时的逻辑
}
},
fail(error) {
console.error('请求失败:', error);
}
});