在小程序本地开发调试时 前端代码:
// 微信手机登录
// 调用云托管接口进行登录 ; e.detail 请求数据
post( '/wechatMiniLogin', e.detail)
本地启动docker服务 后端代码 请求地址 http://api.weixin.qq.com/wxa/getopendata?openid=
// 构建 JSON 请求体
String jsonBody = String.format("{\"cloudid_list\": [\"%s\"]}", cloudID);
// 构建 HttpRequest
HttpRequest apiWxReq = HttpRequest.newBuilder()
.uri(URI.create(WxCloudVisitApi.getGETOPENDATA(openid)))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonBody, StandardCharsets.UTF_8))
.build();
// 1. 创建 HttpClient(可复用)
HttpClient client = HttpClient.newBuilder()
.connectTimeout(Duration.ofSeconds(10))
.build();
返回信息:
响应数据: {"errcode":0,"errmsg":"ok","data_list":[{"cloud_id":"102_lePfDXUUJ026mrxPNtnFc-37jU82XkgRfAcILgOpd3XifUWZwXVYDCbLegY","json":"{ \"cloudID\":\"102_lePfDXUUJ026mrxPNtnFc-37jU82XkgRfAcILgOpd3XifUWZwXVYDCbLegY\", \"errCode\":-601007, \"errMsg\":\"cloudID not belong to user.\" }"}]}
请问,本地启动docker服务调试调用 微信开发接口服务 获取手机号 是否可以呢
