lrf 2 anni fa
parent
commit
4de973885e
1 ha cambiato i file con 4 aggiunte e 2 eliminazioni
  1. 4 2
      app/service/user/point.js

+ 4 - 2
app/service/user/point.js

@@ -20,8 +20,10 @@ class PointService extends CrudService {
     const orderDetail = await this.orderDetailModel.findById(orderDetail_id);
     assert(orderDetail, '缺少订单信息');
     const realPay = this.ctx.service.util.orderDetail.computedRealPay(orderDetail);
-    // 支付金额/10 为积分; TODO需要改成可设置的
-    const point = this.ctx.divide(realPay, 10);
+    // 支付金额/设定金额 为积分;
+    const config = await this.ctx.service.system.config.query();
+    const setting = _.get(config, 'config.buyPoint', 10);
+    const point = this.ctx.divide(realPay, setting);
     const { customer, _id: source_id } = orderDetail;
     const obj = { customer, source_id, source: 'OrderDetail' };
     const r = await this.checkHasAdd(obj);