| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- 'use strict';
- const { Controller } = require('ee-core');
- const { shell } = require('electron');
- const Log = require('ee-core/log');
- const autoUpdater = require('../addon/autoUpdater');
- const { searchBacthProgress } = require('../api/imageMatting')
- const errData = {
- msg :'请求失败,请联系管理员',
- code:999
- }
- /**
- * example
- * @class
- */
- class UtilsController extends Controller {
- constructor(ctx) {
- super(ctx);
- }
- /**
- * 所有方法接收两个参数
- * @param args 前端传的参数
- * @param event - ipc通信时才有值。详情见:控制器文档
- */
- /**
- * upload
- */
- async openFileFolder (params) {
- // const result = await Services.get('example').test('electron');
- Log.info(params)
- Log.info(decodeURIComponent(params))
- shell.openPath(params);
- }
- async shellFun (params) {
- shell[params.action](params.params)
- }
- async checkUpdate () {
- let updaterAddon = new autoUpdater();
- updaterAddon.create();
- if(updaterAddon.checkUpdate()){
- return
- }
- }
- async checkProgress(params){
- console.log('checkProgress')
- let error = false
- const res = await searchBacthProgress(params).catch(e=>{
- Log.info(e);
- error = errData
- return error;
- })
- console.log(res)
- if(res.data){
- return res.data
- }
- return error;
- }
- }
- UtilsController.toString = () => '[class ExampleController]';
- module.exports = UtilsController;
|