mirror of
https://gitee.com/dromara/electron-egg.git
synced 2026-05-14 11:52:07 +08:00
job
This commit is contained in:
@@ -126,7 +126,7 @@ module.exports = (appInfo) => {
|
|||||||
* 主进程
|
* 主进程
|
||||||
*/
|
*/
|
||||||
config.mainServer = {
|
config.mainServer = {
|
||||||
host: '127.0.0.1',
|
host: 'localhost',
|
||||||
port: 7072,
|
port: 7072,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,35 @@
|
|||||||
|
// const Exception = require('ee-core/module/exception');
|
||||||
|
// Exception.start();
|
||||||
|
const Job = require('ee-core/module/jobs/baseJobClass');
|
||||||
const Loader = require('ee-core/module/loader');
|
const Loader = require('ee-core/module/loader');
|
||||||
const Log = require('ee-core/module/log');
|
const Log = require('ee-core/module/log');
|
||||||
const Ps = require('ee-core/module/utils/ps');
|
const Ps = require('ee-core/module/utils/ps');
|
||||||
const test = Loader.requireJobsModule('./test');
|
const test = Loader.requireJobsModule('./test');
|
||||||
|
|
||||||
// logger.info("[renderer] process: ", process);
|
//tests.hello();
|
||||||
Log.info("[child-process] process type: ", Ps.processType());
|
|
||||||
Log.info("[child-process] process cwd: ", process.cwd());
|
|
||||||
|
|
||||||
test.hello();
|
/**
|
||||||
//test.utilsMod();
|
* 示例服务
|
||||||
|
* @class
|
||||||
|
*/
|
||||||
|
class ExampleJob extends Job {
|
||||||
|
|
||||||
|
constructor(params) {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the job
|
||||||
|
*/
|
||||||
|
async handle () {
|
||||||
|
// logger.info("[renderer] process: ", process);
|
||||||
|
Log.info("[child-process] process type: ", Ps.processType());
|
||||||
|
Log.info("[child-process] process cwd: ", process.cwd());
|
||||||
|
|
||||||
|
tests.hello();
|
||||||
|
//test.utilsMod();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ExampleJob.toString = () => '[class ExampleJob]';
|
||||||
|
module.exports = ExampleJob;
|
||||||
|
|||||||
13
electron/jobs/hello.js
Normal file
13
electron/jobs/hello.js
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
const Loader = require('ee-core/module/loader');
|
||||||
|
const Log = require('ee-core/module/log');
|
||||||
|
const Ps = require('ee-core/module/utils/ps');
|
||||||
|
const test = Loader.requireJobsModule('./test');
|
||||||
|
|
||||||
|
|
||||||
|
module.exports = () => {
|
||||||
|
Log.info("[child-process] process type: ", Ps.processType());
|
||||||
|
Log.info("[child-process] process cwd: ", process.cwd());
|
||||||
|
|
||||||
|
test.hello();
|
||||||
|
//test.utilsMod();
|
||||||
|
};
|
||||||
@@ -3,7 +3,6 @@
|
|||||||
*************************************************/
|
*************************************************/
|
||||||
|
|
||||||
const ChildJob = require('ee-core/module/jobs/child');
|
const ChildJob = require('ee-core/module/jobs/child');
|
||||||
// const OriginJob = require('ee-core/module/jobs/unification');
|
|
||||||
const UtilsPs = require('ee-core/module/utils/ps');
|
const UtilsPs = require('ee-core/module/utils/ps');
|
||||||
const Log = require('ee-core/module/log');
|
const Log = require('ee-core/module/log');
|
||||||
const test = require('./test');
|
const test = require('./test');
|
||||||
@@ -31,7 +30,8 @@ module.exports = async (app) => {
|
|||||||
test();
|
test();
|
||||||
|
|
||||||
let myJob = new ChildJob();
|
let myJob = new ChildJob();
|
||||||
myJob.run('exampleJob', './jobs/example.js');
|
//myJob.run('exampleJob', './jobs/example.js');
|
||||||
|
myJob.run('exampleJob', './jobs/hello.js');
|
||||||
|
|
||||||
// let opt2 = {
|
// let opt2 = {
|
||||||
// dev: true,
|
// dev: true,
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ const specialIpcRoute = {
|
|||||||
const requestHttp = (uri, parameter) => {
|
const requestHttp = (uri, parameter) => {
|
||||||
// url转换
|
// url转换
|
||||||
const config = storage.get('httpServiceConfig');
|
const config = storage.get('httpServiceConfig');
|
||||||
const host = config.server || 'http://127.0.0.1:7071';
|
const host = config.server || 'http://localhost:7071';
|
||||||
let url = uri.split('.').join('/');
|
let url = uri.split('.').join('/');
|
||||||
url = host + '/' + url;
|
url = host + '/' + url;
|
||||||
console.log('url:', url);
|
console.log('url:', url);
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ export default {
|
|||||||
storage.set('httpServiceConfig', r);
|
storage.set('httpServiceConfig', r);
|
||||||
|
|
||||||
// url转换
|
// url转换
|
||||||
const host = r.server || 'http://127.0.0.1:7071';
|
const host = r.server || 'http://localhost:7071';
|
||||||
let uri = ipcApiRoute.uploadFile;
|
let uri = ipcApiRoute.uploadFile;
|
||||||
let url = uri.split('.').join('/');
|
let url = uri.split('.').join('/');
|
||||||
this.action_url = host + '/' + url;
|
this.action_url = host + '/' + url;
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
currentStatus: '关闭',
|
currentStatus: '关闭',
|
||||||
servicAddress: 'ws://127.0.0.1:7070'
|
servicAddress: 'ws://localhost:7070'
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
|
|||||||
Reference in New Issue
Block a user