| | |
| | | const list = session.getValue("request_log") || [] |
| | | |
| | | const res = typeof item.data == 'string' ? item.data : JSON.stringify(item.data) |
| | | if (res.length > 100 * 1024) { |
| | | const maxData = session.getValue("request_log_max_data") || {} |
| | | const key = `data${new Date().getTime()}` |
| | | maxData[key] = item.data |
| | | item.data_key = key |
| | | delete item.data |
| | | session.setValue("request_log_max_data", maxData) |
| | | if (res.length > 64 * 1024) { |
| | | // const maxData = session.getValue("request_log_max_data") || {} |
| | | // const key = `data${new Date().getTime()}` |
| | | // maxData[key] = item.data |
| | | // item.data_key = key |
| | | // delete item.data |
| | | // session.setValue("request_log_max_data", maxData) |
| | | item.data = res.length |
| | | } |
| | | if(item.url.indexOf("get_agv_state") > 0) |
| | | { |
| | | return |
| | | } |
| | | list.unshift(item) |
| | | if (list.length > 1000) { |
| | | const oldItem = list.shift() |
| | | const oldItem = list.pop() |
| | | if (oldItem.data_key) { |
| | | const maxData = session.getValue("request_log_max_data") || {} |
| | | delete maxData[oldItem.data_key] |
| | |
| | | }; |
| | | options.method = options.method || this.common.method; |
| | | options.dataType = options.dataType || this.common.dataType; |
| | | console.log("url", options.url, options.data) |
| | | |
| | | if(options.url.indexOf("get_agv_state") < 0) |
| | | { |
| | | console.log("url", options.url, options.data) |
| | | } |
| | | return new Promise((resolve, reject) => { |
| | | const app = getApp() |
| | | uni.request({ |
| | |
| | | method: options.method, |
| | | dataType: options.dataType, |
| | | success: (result) => { |
| | | console.log("result", result) |
| | | if(options.url.indexOf("get_agv_state") < 0) |
| | | { |
| | | console.log("result", result) |
| | | } |
| | | |
| | | const now = new Date() |
| | | const date = `${now.getHours()}:${now.getMinutes()}:${now.getSeconds()}` |
| | | if (result.statusCode != 200) { |