lrf 2 éve
szülő
commit
6cd31cabb6
1 módosított fájl, 3 hozzáadás és 1 törlés
  1. 3 1
      app/service/user/cashOut.js

+ 3 - 1
app/service/user/cashOut.js

@@ -32,7 +32,9 @@ class CashOutService extends CrudService {
     if (status === '1') {
       const { customer: inviter, money } = data;
       const obj = { inviter, money, time: moment().format('YYYY-MM-DD HH:mm:ss'), status: '-1', source: '-1', source_id: data._id };
-      await this.cashBackModel.create(obj);
+      const num = await this.cashBackModel.count({ inviter, status: '-1', source: '-1', source_id: data._id });
+      // 说明该申请没有流水,添加流水;有流水就不加了
+      if (num < 0) await this.cashBackModel.create(obj);
     }
     return data;
   }