Merge branch 'test' into feat-scene

This commit is contained in:
2026-08-10 11:56:37 +08:00
4 changed files with 188 additions and 5 deletions
+11 -2
View File
@@ -26,7 +26,7 @@ try {
}
const ADDONS_BASE_URL = BASE_URL.replace(/\/api\/shoot$/, "/api/shoot");
// 统一处理业务接口请求,包含登录态、业务错误和 WiFi 连接空响应兼容。
// 统一处理业务接口请求,包含登录态、业务错误和特定接口空响应兼容。
function request(method, url, data = {}, baseUrl = BASE_URL) {
const token = uni.getStorageSync(
`${uni.getAccountInfoSync().miniProgram.envVersion}_token`
@@ -41,7 +41,11 @@ function request(method, url, data = {}, baseUrl = BASE_URL) {
data,
timeout: 10000,
success: (res) => {
if (url === "/user/hardwareBox/connectWifi" && res.statusCode === 200 && res.data && Object.keys(res.data).length === 0) {
const acceptsEmptyResponse = [
"/user/hardwareBox/connectWifi",
"/user/device/unbindByQrcodeId",
].includes(url);
if (acceptsEmptyResponse && res.statusCode === 200 && res.data && Object.keys(res.data).length === 0) {
resolve({});
return;
}
@@ -266,6 +270,11 @@ export const unbindDeviceAPI = (deviceId) => {
});
};
// 测试环境根据设备二维码编号解绑设备,不校验设备归属。
export const unbindDeviceByQrcodeIdAPI = (id) => {
return request("POST", "/user/device/unbindByQrcodeId", {id});
};
export const getMyDevicesAPI = () => {
// "/user/device/getBinding?deviceId=9ZF9oVXs"
return request("GET", "/user/device/getBindings");