Explorar o código

1. 拦截orderId长度不能大于19

MONSTER-ygh hai 6 meses
pai
achega
8081c96e1f
Modificáronse 1 ficheiros con 6 adicións e 0 borrados
  1. 6 0
      src/utils/request.js

+ 6 - 0
src/utils/request.js

@@ -29,6 +29,12 @@ service.interceptors.request.use(config => {
   if (getToken() && !isToken) {
     config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
   }
+  if(config.params && config.params.orderId && config.params.orderId.length > 19) {
+    return Promise.reject(new Error("订单号不存在!!!"))
+  }
+  if(config.data && config.data.orderId && config.data.orderId.length > 19) {
+    return Promise.reject(new Error("订单号不存在!!!"))
+  }
   // get请求映射params参数
   if (config.method === 'get' && config.params) {
     let url = config.url + '?' + tansParams(config.params);