example.js 798 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. 'use strict';
  2. const Controller = require('ee-core').Controller;
  3. const { app } = require('electron');
  4. class ExampleController extends Controller {
  5. /**
  6. * test
  7. */
  8. async test (args) {
  9. let obj = {
  10. status:'ok'
  11. }
  12. // 调用egg的某个api
  13. // const result = await this.app.curlEgg('post', '/api/v1/example/test2', {name: 'gsx2'});
  14. // console.log('fffffffffff: ', result);
  15. //this.app.logger.info('ssssssssssssssssssss');
  16. return obj;
  17. }
  18. /**
  19. * hello
  20. */
  21. hello (args, event) {
  22. let newMsg = args + " +1";
  23. let reply = '';
  24. reply = '收到:' + args + ',返回:' + newMsg;
  25. // let channel = "example.socketMessageStop";
  26. // event.reply(`${channel}`, '另外的数据');
  27. return reply;
  28. }
  29. }
  30. module.exports = ExampleController;