- Tuya MiniApp IDE 版本信息:Node v16.20.2 Tools 0.8.12 Ray 1.7.10
- App 应用版本信息: 设置-关于中进行查看~
- "@ray-js/panel-sdk": "1.13.1", "@ray-js/ray": "1.7.24",
- 移动设备信息:iphone 15pro
- 相关代码: const fetchCityInfo = useCallback(
async (
latitude: number,
longitude: number
): Promise<{ country?: string; province?: string; city?: string } | undefined> => {
if (!devId) {
return undefined;
}
try {
const result = await getLightRhythmsCityInfo({
bizId: devId,
bizType: 0,
lon:${longitude},
lat:${latitude},
});
console.log('getLightRhythmsCityInfo response:', result);
const visited = new WeakSet<Record<string, unknown>>();
const resolveCityInfo = (
value: unknown
): { country?: string; province?: string; city?: string } | undefined => {
if (value == null) {
return undefined;
}
if (typeof value === 'string') {
try {
const parsed = JSON.parse(value);
return resolveCityInfo(parsed);
} catch (error) {
return undefined;
}
}
if (typeof value !== 'object') {
return undefined;
}
const record = value as Record<string, unknown>;
if (visited.has(record)) {
return undefined;
}
visited.add(record);
if (record.country record.province record.city) {
return {
country: typeof record.country === 'string' ? record.country : undefined,
province: typeof record.province === 'string' ? record.province : undefined,
city: typeof record.city === 'string' ? record.city : undefined,
};
}
return Object.values(record).reduce<
{ country?: string; province?: string; city?: string } | undefined
>((found, next) => found resolveCityInfo(next), undefined);
};
const parsed = resolveCityInfo(result);
if (parsed) {
console.log('Parsed city info:', parsed);
}
return parsed undefined;
} catch (error) {
console.error('getLightRhythmsCityInfo failed:', error);
return undefined;
}
},
[devId]
); - 日志信息:
- 问题描述(复现步骤):真机调试请求api,真实设备请求被阻止,后面用虚拟设备发现可以请求。已经在小程序平台授权节律的api
- 预期结果:真实设备能正常请求api
- 实际结果:真实设备不能发送请求api,被阻止了
面板小程序节律api请求
面板小程序节律api请求
- Attachments
-
-
Tags:
Re: 面板小程序节律api请求
真实设备在IDE授权的账号家庭下吗,是否是没有该设备权限? 设备id可以发一下
Re: 面板小程序节律api请求
真实设备是共享到ide开发账号下,设备id:6ca473326cfb0b958dwfiq
Re: 面板小程序节律api请求
这个方法会校验真实设备是否开通了生物节律高级能力,虚拟设备是没有校验的,真实设备需要开通高级能力(除授权能力包外,需要设备开通高级能力),可以提工单填写设备id/产品id开通生物节律高级能力后,再重新尝试
。