如果扫描用户,没有订单,不需要返回任何信息给用户
完成套餐从数据库中提取
This commit is contained in:
+23
-4
@@ -4,6 +4,12 @@ const config_url = require("./url.js");
|
||||
const request = (option) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
common_vendor.index.__f__("log", "at config/http.js:9", `发起请求: ${option.method} ${config_url.URL + option.url}`, option.data);
|
||||
if (!option.hideLoading) {
|
||||
common_vendor.index.showLoading({
|
||||
title: option.loadingText || "加载中...",
|
||||
mask: true
|
||||
});
|
||||
}
|
||||
common_vendor.index.request({
|
||||
url: config_url.URL + option.url,
|
||||
method: option.method,
|
||||
@@ -16,9 +22,9 @@ const request = (option) => {
|
||||
"Clientid": common_vendor.index.getStorageSync("client_id")
|
||||
},
|
||||
success(res) {
|
||||
common_vendor.index.__f__("log", "at config/http.js:24", `请求响应: ${option.url}`, res);
|
||||
common_vendor.index.__f__("log", "at config/http.js:32", `请求响应: ${option.url}`, res);
|
||||
if (res.statusCode !== 200) {
|
||||
common_vendor.index.__f__("error", "at config/http.js:28", `HTTP状态码错误: ${res.statusCode}`, res.data);
|
||||
common_vendor.index.__f__("error", "at config/http.js:36", `HTTP状态码错误: ${res.statusCode}`, res.data);
|
||||
if (res.data) {
|
||||
resolve(res.data);
|
||||
return;
|
||||
@@ -27,15 +33,28 @@ const request = (option) => {
|
||||
return;
|
||||
}
|
||||
if (res.data && res.data.code !== 200) {
|
||||
common_vendor.index.__f__("warn", "at config/http.js:42", `业务状态码错误: ${res.data.code}`, res.data);
|
||||
common_vendor.index.__f__("warn", "at config/http.js:50", `业务状态码错误: ${res.data.code}`, res.data);
|
||||
if (option.ignoreEmptyError && (res.data.code === 500 && res.data.msg && (res.data.msg.includes("未找到") || res.data.msg.includes("不存在")))) {
|
||||
resolve({
|
||||
code: 200,
|
||||
msg: "操作成功",
|
||||
data: []
|
||||
});
|
||||
return;
|
||||
}
|
||||
resolve(res.data);
|
||||
return;
|
||||
}
|
||||
resolve(res.data);
|
||||
},
|
||||
fail(err) {
|
||||
common_vendor.index.__f__("error", "at config/http.js:53", `请求失败: ${option.url}`, err);
|
||||
common_vendor.index.__f__("error", "at config/http.js:74", `请求失败: ${option.url}`, err);
|
||||
reject(err);
|
||||
},
|
||||
complete() {
|
||||
if (!option.hideLoading) {
|
||||
common_vendor.index.hideLoading();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
+6
-4
@@ -36,8 +36,10 @@ const checkOrdersByStatus = (deviceNo, statuses) => {
|
||||
return config_http.request({
|
||||
url: `/app/order/list?deviceNo=${deviceNo}&orderStatus=${statusQuery}`,
|
||||
method: "get",
|
||||
hideLoading: true
|
||||
hideLoading: true,
|
||||
// 隐藏加载提示,避免干扰用户
|
||||
ignoreEmptyError: true
|
||||
// 添加标记,表示即使返回空数据也不视为错误
|
||||
});
|
||||
};
|
||||
const getDeviceInfo = (deviceNo) => {
|
||||
@@ -47,7 +49,7 @@ const getDeviceInfo = (deviceNo) => {
|
||||
});
|
||||
};
|
||||
const queryById = (id) => {
|
||||
common_vendor.index.__f__("log", "at config/user.js:80", `查询订单详情, orderId: ${id}`);
|
||||
common_vendor.index.__f__("log", "at config/user.js:81", `查询订单详情, orderId: ${id}`);
|
||||
return config_http.request({
|
||||
url: `/app/order/${id}`,
|
||||
method: "get",
|
||||
@@ -62,14 +64,14 @@ const rentPowerBank = (deviceNo, phone) => {
|
||||
});
|
||||
};
|
||||
const confirmPaymentAndRent = (orderId) => {
|
||||
common_vendor.index.__f__("log", "at config/user.js:119", `确认支付并弹出充电宝, orderId: ${orderId}`);
|
||||
common_vendor.index.__f__("log", "at config/user.js:120", `确认支付并弹出充电宝, orderId: ${orderId}`);
|
||||
return config_http.request({
|
||||
url: `/app/device/confirmPaymentAndRent?orderId=${orderId}`,
|
||||
method: "post"
|
||||
});
|
||||
};
|
||||
const updateOrderPackage = (data) => {
|
||||
common_vendor.index.__f__("log", "at config/user.js:158", "更新订单套餐信息:", data);
|
||||
common_vendor.index.__f__("log", "at config/user.js:159", "更新订单套餐信息:", data);
|
||||
return config_http.request({
|
||||
url: "/app/device/updateOrderPackage",
|
||||
method: "post",
|
||||
|
||||
Reference in New Issue
Block a user