mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-22 22:36:06 +08:00
修改 QLAPI 系统通知
This commit is contained in:
parent
51ef4e7476
commit
ad6e08525c
9
back.d.ts
vendored
Normal file
9
back.d.ts
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
import 'express';
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
namespace Express {
|
||||||
|
interface Request {
|
||||||
|
platform: string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -20,8 +20,8 @@ import {
|
||||||
UpdateEnvRequest,
|
UpdateEnvRequest,
|
||||||
} from '../protos/api';
|
} from '../protos/api';
|
||||||
import LoggerInstance from '../loaders/logger';
|
import LoggerInstance from '../loaders/logger';
|
||||||
import NotificationService from '../services/notify';
|
|
||||||
import pick from 'lodash/pick';
|
import pick from 'lodash/pick';
|
||||||
|
import SystemService from '../services/system';
|
||||||
|
|
||||||
Container.set('logger', LoggerInstance);
|
Container.set('logger', LoggerInstance);
|
||||||
|
|
||||||
|
@ -165,11 +165,8 @@ export const systemNotify = async (
|
||||||
callback: sendUnaryData<SystemNotifyResponse>,
|
callback: sendUnaryData<SystemNotifyResponse>,
|
||||||
) => {
|
) => {
|
||||||
try {
|
try {
|
||||||
const notifyService = Container.get(NotificationService);
|
const systemService = Container.get(SystemService);
|
||||||
const data = await notifyService.notify(
|
const data = await systemService.notify(call.request);
|
||||||
call.request.title,
|
|
||||||
call.request.content,
|
|
||||||
);
|
|
||||||
callback(null, { code: 200, data });
|
callback(null, { code: 200, data });
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
callback(e);
|
callback(e);
|
||||||
|
|
|
@ -1,15 +1,7 @@
|
||||||
import { Service, Inject } from 'typedi';
|
import { Service, Inject } from 'typedi';
|
||||||
import winston from 'winston';
|
import winston from 'winston';
|
||||||
import {
|
import { createRandomString, getNetIp } from '../config/util';
|
||||||
createFile,
|
|
||||||
createRandomString,
|
|
||||||
fileExist,
|
|
||||||
getNetIp,
|
|
||||||
getPlatform,
|
|
||||||
safeJSONParse,
|
|
||||||
} from '../config/util';
|
|
||||||
import config from '../config';
|
import config from '../config';
|
||||||
import * as fs from 'fs/promises';
|
|
||||||
import jwt from 'jsonwebtoken';
|
import jwt from 'jsonwebtoken';
|
||||||
import { authenticator } from '@otplib/preset-default';
|
import { authenticator } from '@otplib/preset-default';
|
||||||
import {
|
import {
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
*/
|
*/
|
||||||
console.log('test scripts');
|
console.log('test scripts');
|
||||||
QLAPI.notify('test scripts', 'test desc');
|
QLAPI.notify('test scripts', 'test desc');
|
||||||
QLAPI.getEnvs({ searchValue: 'dddd' }).then(x => {
|
QLAPI.getEnvs({ searchValue: 'dddd' }).then((x) => {
|
||||||
console.log(x)
|
console.log('getEnvs', x);
|
||||||
})
|
});
|
||||||
QLAPI.systemNotify({ title: '123', content: '231' }).then(x => {
|
QLAPI.systemNotify({ title: '123', content: '231' }).then((x) => {
|
||||||
console.log(x)
|
console.log('systemNotify', x);
|
||||||
})
|
});
|
||||||
console.log('test desc');
|
console.log('test desc');
|
||||||
|
|
|
@ -6,7 +6,9 @@ cron: 1 9 * * *
|
||||||
"""
|
"""
|
||||||
|
|
||||||
print("test script")
|
print("test script")
|
||||||
QLAPI.notify("test script", "test desc")
|
print(QLAPI.notify("test script", "test desc"))
|
||||||
QLAPI.systemNotify({"title": "test script", "content": "dddd"})
|
print("test systemNotify")
|
||||||
|
print(QLAPI.systemNotify({"title": "test script", "content": "dddd"}))
|
||||||
|
print("test getEnvs")
|
||||||
print(QLAPI.getEnvs("1"))
|
print(QLAPI.getEnvs("1"))
|
||||||
print("test desc")
|
print("test desc")
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
const grpc = require('@grpc/grpc-js');
|
const grpc = require('@grpc/grpc-js');
|
||||||
const protoLoader = require('@grpc/proto-loader');
|
const protoLoader = require('@grpc/proto-loader');
|
||||||
|
|
||||||
console.log(process.env.QL_DIR);
|
|
||||||
const PROTO_PATH = `${process.env.QL_DIR}/back/protos/api.proto`;
|
const PROTO_PATH = `${process.env.QL_DIR}/back/protos/api.proto`;
|
||||||
const options = {
|
const options = {
|
||||||
keepCase: true,
|
keepCase: true,
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
"noEmit": false,
|
"noEmit": false,
|
||||||
"esModuleInterop": true
|
"esModuleInterop": true
|
||||||
},
|
},
|
||||||
"include": ["./back/**/*"],
|
"include": ["./back/**/*", "./back.d.ts"],
|
||||||
"exclude": ["node_modules"],
|
"exclude": ["node_modules"],
|
||||||
"files": ["./back/index.d.ts"]
|
"files": ["./back/index.d.ts"]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user