Forráskód Böngészése

评分bug:10好抵1差有bug

lrf 2 éve
szülő
commit
35e86c49f2
1 módosított fájl, 3 hozzáadás és 5 törlés
  1. 3 5
      app/service/shop/goodsRate.js

+ 3 - 5
app/service/shop/goodsRate.js

@@ -42,8 +42,8 @@ class GoodsRateService extends CrudService {
     const length = arr.length;
     let mid,
       midIndex;
-    const wl = [],
-      gl = [];
+    const gl = [];
+    let wl = [];
     if (length % 2 !== 0) {
       midIndex = this.ctx.plus(Math.floor(length / 2), 1);
       mid = arr[midIndex];
@@ -56,9 +56,7 @@ class GoodsRateService extends CrudService {
       else wl.push(i);
     }
     const offset = _.floor(this.ctx.divide(gl.length, 10));
-    for (let i = 0; i < offset.length; i++) {
-      wl.pop();
-    }
+    wl = wl.splice(1, offset);
     score = this.ctx.minus(score, this.ctx.multiply(wl.length, 0.01));
     return score;
   }