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,
|
||||
} from '../protos/api';
|
||||
import LoggerInstance from '../loaders/logger';
|
||||
import NotificationService from '../services/notify';
|
||||
import pick from 'lodash/pick';
|
||||
import SystemService from '../services/system';
|
||||
|
||||
Container.set('logger', LoggerInstance);
|
||||
|
||||
|
@ -165,11 +165,8 @@ export const systemNotify = async (
|
|||
callback: sendUnaryData<SystemNotifyResponse>,
|
||||
) => {
|
||||
try {
|
||||
const notifyService = Container.get(NotificationService);
|
||||
const data = await notifyService.notify(
|
||||
call.request.title,
|
||||
call.request.content,
|
||||
);
|
||||
const systemService = Container.get(SystemService);
|
||||
const data = await systemService.notify(call.request);
|
||||
callback(null, { code: 200, data });
|
||||
} catch (e: any) {
|
||||
callback(e);
|
||||
|
|
|
@ -1,15 +1,7 @@
|
|||
import { Service, Inject } from 'typedi';
|
||||
import winston from 'winston';
|
||||
import {
|
||||
createFile,
|
||||
createRandomString,
|
||||
fileExist,
|
||||
getNetIp,
|
||||
getPlatform,
|
||||
safeJSONParse,
|
||||
} from '../config/util';
|
||||
import { createRandomString, getNetIp } from '../config/util';
|
||||
import config from '../config';
|
||||
import * as fs from 'fs/promises';
|
||||
import jwt from 'jsonwebtoken';
|
||||
import { authenticator } from '@otplib/preset-default';
|
||||
import {
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
*/
|
||||
console.log('test scripts');
|
||||
QLAPI.notify('test scripts', 'test desc');
|
||||
QLAPI.getEnvs({ searchValue: 'dddd' }).then(x => {
|
||||
console.log(x)
|
||||
})
|
||||
QLAPI.systemNotify({ title: '123', content: '231' }).then(x => {
|
||||
console.log(x)
|
||||
})
|
||||
QLAPI.getEnvs({ searchValue: 'dddd' }).then((x) => {
|
||||
console.log('getEnvs', x);
|
||||
});
|
||||
QLAPI.systemNotify({ title: '123', content: '231' }).then((x) => {
|
||||
console.log('systemNotify', x);
|
||||
});
|
||||
console.log('test desc');
|
||||
|
|
|
@ -6,7 +6,9 @@ cron: 1 9 * * *
|
|||
"""
|
||||
|
||||
print("test script")
|
||||
QLAPI.notify("test script", "test desc")
|
||||
QLAPI.systemNotify({"title": "test script", "content": "dddd"})
|
||||
print(QLAPI.notify("test script", "test desc"))
|
||||
print("test systemNotify")
|
||||
print(QLAPI.systemNotify({"title": "test script", "content": "dddd"}))
|
||||
print("test getEnvs")
|
||||
print(QLAPI.getEnvs("1"))
|
||||
print("test desc")
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
const grpc = require('@grpc/grpc-js');
|
||||
const protoLoader = require('@grpc/proto-loader');
|
||||
|
||||
console.log(process.env.QL_DIR);
|
||||
const PROTO_PATH = `${process.env.QL_DIR}/back/protos/api.proto`;
|
||||
const options = {
|
||||
keepCase: true,
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
"noEmit": false,
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"include": ["./back/**/*"],
|
||||
"include": ["./back/**/*", "./back.d.ts"],
|
||||
"exclude": ["node_modules"],
|
||||
"files": ["./back/index.d.ts"]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user