getLightRhythmsCityInfo(data: CommonLonLatParams)

版本要求:
@tuya-miniapp/cloud-api≥1.0.5

描述

获取指定地理位置所在的城市信息。

参数

参数类型必填说明
是请求参数:bizId(业务 ID)、bizType(业务类型,0:设备 1:群组)、lon(经度)、lat(纬度)

返回值

类型:Promise<GetLightRhythmsCityInfoResult>
包含 country(国家)、province(省份)、city(城市)

引用对象

interfaceGetLightRhythmsCityInfoResult
属性类型描述
countrystring国家
provincestring省份
citystring城市

合法值

CommonLonLatParams.bizType
值说明最低版本
0--
1--

示例代码

请求示例

import { getLightRhythmsCityInfo } from '@tuya-miniapp/cloud-api';

getLightRhythmsCityInfo({
  bizId: 'vdevo167504******003',
  bizType: 0,
  lon: '112.233',
  lat: '30.233',
})
  .then((response) => {
    console.log(response);
  })
  .catch();

返回示例

{
  "country": "中国",
  "city": "益阳市",
  "province": "湖南省"
}