iviBehaviorController.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. 'use strict';
  2. const Controller = require('egg').Controller;
  3. // 娱乐信息统计分析管理
  4. class IviBehaviorController extends Controller {
  5. // 娱乐信息 听歌20020000,听电台20010000,看新闻20050000,看视频 20030000
  6. async index() {
  7. const { ctx, service } = this;
  8. const payload = ctx.validate();
  9. // 调用 Service 进行业务处理
  10. if (ctx.isDev()) {
  11. const data = ctx.getDataAdd(payload, {
  12. value: [ 'musicTotal', 'fwTotal', 'newsTotal', 'videoTotal', 'total' ] });
  13. ctx.success({ data });
  14. } else {
  15. const data = await service.iviBehaviorRecordService.index(payload);
  16. // 设置响应内容和响应状态码
  17. ctx.success({ data });
  18. }
  19. }
  20. async ext() {
  21. const { ctx, service } = this;
  22. if (ctx.isDev()) {
  23. const data = ctx.getBehaviorExt();
  24. ctx.success({ data });
  25. } else {
  26. const data = await service.iviBehaviorRecordService.ext();
  27. // 设置响应内容和响应状态码
  28. ctx.success({ data });
  29. }
  30. }
  31. }
  32. module.exports = IviBehaviorController;