|
|
@@ -4,13 +4,16 @@ const _ = require('lodash');
|
|
|
const path = require('path');
|
|
|
const fs = require('fs');
|
|
|
const { exec } = require('child_process');
|
|
|
-const { Controller, Utils } = require('ee-core');
|
|
|
+const { Controller } = require('ee-core');
|
|
|
const {
|
|
|
app: electronApp,
|
|
|
dialog, shell, BrowserView, Notification,
|
|
|
powerMonitor, screen, nativeTheme
|
|
|
} = require('electron');
|
|
|
const dayjs = require('dayjs');
|
|
|
+const ChildJob = require('ee-core/module/jobs/child');
|
|
|
+const Ps = require('ee-core/module/ps');
|
|
|
+const Log = require('ee-core/module/log');
|
|
|
|
|
|
let myTimer = null;
|
|
|
let browserViewObj = null;
|
|
|
@@ -38,14 +41,8 @@ class ExampleController extends Controller {
|
|
|
async test () {
|
|
|
const result = await this.service.example.test('electron');
|
|
|
|
|
|
- let tmpDir = Utils.getLogDir();
|
|
|
- console.log('tmpDir:', tmpDir);
|
|
|
-
|
|
|
- // console.log('this.app.request:', this.app.request.query);
|
|
|
-
|
|
|
- // const exampleAddon = this.app.addon.example;
|
|
|
- // const str = exampleAddon.hello();
|
|
|
- // console.log('str:', str);
|
|
|
+ let tmpDir = Ps.getLogDir();
|
|
|
+ Log.info('tmpDir:', tmpDir);
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
@@ -56,7 +53,7 @@ class ExampleController extends Controller {
|
|
|
async dbOperation(args) {
|
|
|
const { service } = this;
|
|
|
const paramsObj = args;
|
|
|
- //console.log('eeeee paramsObj:', paramsObj);
|
|
|
+ //Log.info('eeeee paramsObj:', paramsObj);
|
|
|
const data = {
|
|
|
action: paramsObj.action,
|
|
|
result: null,
|
|
|
@@ -89,7 +86,7 @@ class ExampleController extends Controller {
|
|
|
async sqlitedbOperation(args) {
|
|
|
const { service } = this;
|
|
|
const paramsObj = args;
|
|
|
- //console.log('eeeee paramsObj:', paramsObj);
|
|
|
+ //Log.info('eeeee paramsObj:', paramsObj);
|
|
|
const data = {
|
|
|
action: paramsObj.action,
|
|
|
result: null,
|
|
|
@@ -278,9 +275,9 @@ class ExampleController extends Controller {
|
|
|
// const chromeExtensionDir = chromeExtension.getDirectory();
|
|
|
// const extensionDir = path.join(chromeExtensionDir, extensionId);
|
|
|
|
|
|
- // console.log("[api] [example] [loadExtension] extension id:", extensionId);
|
|
|
+ // Log.info("[api] [example] [loadExtension] extension id:", extensionId);
|
|
|
// unzip(crxFile, extensionDir).then(() => {
|
|
|
- // console.log("[api] [example] [loadExtension] unzip success!");
|
|
|
+ // Log.info("[api] [example] [loadExtension] unzip success!");
|
|
|
// chromeExtension.load(extensionId);
|
|
|
// });
|
|
|
|
|
|
@@ -406,7 +403,7 @@ class ExampleController extends Controller {
|
|
|
// 数组,只取一个吧
|
|
|
res = resArr[0];
|
|
|
}
|
|
|
- // console.log('[electron] [ipc] [example] [getScreen] res:', res);
|
|
|
+ // Log.info('[electron] [ipc] [example] [getScreen] res:', res);
|
|
|
data = [
|
|
|
{
|
|
|
title: '分辨率',
|
|
|
@@ -449,8 +446,8 @@ class ExampleController extends Controller {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- let softwarePath = path.join(Utils.getExtraResourcesDir(), softName);
|
|
|
- this.app.logger.info('[openSoftware] softwarePath:', softwarePath);
|
|
|
+ let softwarePath = path.join(Ps.getExtraResourcesDir(), softName);
|
|
|
+ Log.info('[openSoftware] softwarePath:', softwarePath);
|
|
|
|
|
|
// 检查程序是否存在
|
|
|
if (!fs.existsSync(softwarePath)) {
|
|
|
@@ -539,7 +536,7 @@ class ExampleController extends Controller {
|
|
|
params,
|
|
|
body
|
|
|
}
|
|
|
- console.log('httpInfo:', httpInfo);
|
|
|
+ Log.info('httpInfo:', httpInfo);
|
|
|
|
|
|
if (!body.id) {
|
|
|
return false;
|
|
|
@@ -618,7 +615,7 @@ class ExampleController extends Controller {
|
|
|
* 上传文件
|
|
|
*/
|
|
|
async uploadFile() {
|
|
|
- let tmpDir = Utils.getLogDir();
|
|
|
+ let tmpDir = Ps.getLogDir();
|
|
|
const files = this.app.request.files;
|
|
|
let file = files.file;
|
|
|
|
|
|
@@ -684,7 +681,7 @@ class ExampleController extends Controller {
|
|
|
* 测试接口
|
|
|
*/
|
|
|
hello (args) {
|
|
|
- console.log('hello ', args);
|
|
|
+ Log.info('hello ', args);
|
|
|
}
|
|
|
}
|
|
|
|