valueController.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. 'use strict';
  2. const Controller = require('../extend/baseController');
  3. class ValueController extends Controller {
  4. tag() {
  5. return this.ctx.service.valueService;
  6. }
  7. async userValueDetails() {
  8. const { ctx, service } = this;
  9. const query = ctx.query;
  10. const result = await service.valueService.userValueDetails(query);
  11. ctx.success(result);
  12. }
  13. // 积分表添加地区字段
  14. // async addDept() {
  15. // const { ctx, service } = this;
  16. // ctx.setOrder('time', true); // 倒序
  17. // const result = await this.tag().list(ctx.query);
  18. // let index = 0;
  19. // for (const item of result) {
  20. // const user = await this.ctx.model.SysUserModel.findOne({ _id: this.app.mongoose.Types.ObjectId(item.userid) });
  21. // if (user) {
  22. // const addQuery = {};
  23. // addQuery.dept1 = user.dept1._id;
  24. // addQuery.dept2 = user.dept2._id;
  25. // addQuery.dept3 = user.dept3._id;
  26. // addQuery.dept4 = user.dept4._id;
  27. // addQuery.dept5 = user.dept5._id;
  28. // await service.valueService.update({ _id: item._id }, addQuery);
  29. // index++;
  30. // ctx.logger.error('已更改', index, '条数据');
  31. // } else {
  32. // index++;
  33. // ctx.logger.error(index, '条数据', '该用户不存在', item.userid);
  34. // }
  35. // }
  36. // // ctx.success(result);
  37. // }
  38. }
  39. module.exports = ValueController;