|
@@ -117,8 +117,8 @@ class CardService extends CrudService {
|
|
|
await recommender.save();
|
|
|
const record = _.pick(recommender, [ 'mobile', 'name' ]);
|
|
|
record.points = score;
|
|
|
- record.opera = '推荐办卡';
|
|
|
- record.params = { name: user.name, mobile: user.mobile };
|
|
|
+ record.opera = '1';
|
|
|
+ record.params = { name: user.name, mobile: user.mobile, level: user.level };
|
|
|
try {
|
|
|
await this.record.create(record);
|
|
|
} catch (error) {
|
|
@@ -199,7 +199,7 @@ class CardService extends CrudService {
|
|
|
// 添加积分记录
|
|
|
const record = _.pick(user, [ 'mobile', 'name' ]);
|
|
|
record.points = this.car_point;
|
|
|
- record.opera = '车奖';
|
|
|
+ record.opera = '2';
|
|
|
try {
|
|
|
await this.record.create(record);
|
|
|
} catch (error) {
|
|
@@ -248,7 +248,7 @@ class CardService extends CrudService {
|
|
|
const record = _.pick(rec, [ 'mobile', 'name' ]);
|
|
|
try {
|
|
|
record.points = 20;
|
|
|
- record.opera = '同级奖励';
|
|
|
+ record.opera = '3';
|
|
|
await this.record.create(record);
|
|
|
} catch (error) {
|
|
|
this.logger.error(`line-250-积分记录添加失败${JSON.stringify(record)}`);
|
|
@@ -277,10 +277,10 @@ class CardService extends CrudService {
|
|
|
const points = this.getReturns(level, r_level);
|
|
|
r_rec.points = r_rec.points + points;
|
|
|
await r_rec.save();
|
|
|
- const record = _.pick(rec, [ 'mobile', 'name' ]);
|
|
|
+ const record = _.pick(r_rec, [ 'mobile', 'name' ]);
|
|
|
try {
|
|
|
record.points = points;
|
|
|
- record.opera = '直推下级完成业绩反佣金';
|
|
|
+ record.opera = '4';
|
|
|
await this.record.create(record);
|
|
|
} catch (error) {
|
|
|
this.logger.error(`line-282-积分记录添加失败${JSON.stringify(record)}`);
|
|
@@ -390,7 +390,7 @@ class CardService extends CrudService {
|
|
|
const { filter } = condition;
|
|
|
const bTerm = await this.model.find(filter);
|
|
|
const cTerm = await this.model.find({ r_mobile: bTerm.map(i => i.mobile) });
|
|
|
- return { list: [ ...bTerm, ...cTerm ], total: bTerm.length + cTerm.length };
|
|
|
+ return { list: _.uniqBy([ ...bTerm, ...cTerm ], '_id'), total: bTerm.length + cTerm.length };
|
|
|
}
|
|
|
}
|
|
|
|