mirror of
https://github.com/ctrlcvs/xiaoyao-cvs-plugin.git
synced 2024-12-23 03:20:52 +08:00
Merge branch 'master' of https://gitee.com/Ctrlcvs/xiaoyao-cvs-plugin
This commit is contained in:
commit
249e73999a
@ -22,3 +22,22 @@ export async function render (app = '', tpl = '', data = {}, imgType = 'jpeg') {
|
|||||||
data.pluResPath = data._res_path
|
data.pluResPath = data._res_path
|
||||||
return await puppeteer.screenshot(`${plugin}/${app}/${tpl}`, data)
|
return await puppeteer.screenshot(`${plugin}/${app}/${tpl}`, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getRender () {
|
||||||
|
return async function render (app = '', tpl = '', data = {}, imgType = 'jpeg') {
|
||||||
|
// 在data中保存plugin信息
|
||||||
|
data._plugin = plugin
|
||||||
|
if (lodash.isUndefined(data._res_path)) {
|
||||||
|
data._res_path = `../../../../../plugins/${plugin}/resources/`
|
||||||
|
}
|
||||||
|
if(imgType == "png"){
|
||||||
|
data.omitBackground=true;
|
||||||
|
}
|
||||||
|
data.imgType=imgType;
|
||||||
|
Data.createDir(_path + '/data/', `html/${plugin}/${app}/${tpl}`)
|
||||||
|
data.saveId = data.saveId || data.save_id || tpl
|
||||||
|
data.tplFile = `./plugins/${plugin}/resources/${app}/${tpl}.html`
|
||||||
|
data.pluResPath = data._res_path
|
||||||
|
return await puppeteer.screenshot(`${plugin}/${app}/${tpl}`, data)
|
||||||
|
}
|
||||||
|
}
|
10
apps/Note.js
10
apps/Note.js
@ -16,6 +16,7 @@ import {
|
|||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import MysApi from "../model/mys/mysApi.js";
|
import MysApi from "../model/mys/mysApi.js";
|
||||||
import utils from "../model/mys/utils.js";
|
import utils from "../model/mys/utils.js";
|
||||||
|
import {getRender} from "../adapter/render.js"
|
||||||
const _path = process.cwd();
|
const _path = process.cwd();
|
||||||
let role_user = Data.readJSON(`${_path}/plugins/xiaoyao-cvs-plugin/resources/dailyNote/json/`, "dispatch_time");
|
let role_user = Data.readJSON(`${_path}/plugins/xiaoyao-cvs-plugin/resources/dailyNote/json/`, "dispatch_time");
|
||||||
|
|
||||||
@ -352,7 +353,13 @@ export async function DailyNoteTask() {
|
|||||||
redis.set(sendkey, "1", {
|
redis.set(sendkey, "1", {
|
||||||
EX: sendCD
|
EX: sendCD
|
||||||
});
|
});
|
||||||
// await Note(e, getPluginRender("xiaoyao-cvs-plugin"));
|
if(isV3){
|
||||||
|
await Note(e, {render:await getRender()});
|
||||||
|
}else{
|
||||||
|
let {getPluginRender} = await import(`file://${_path}/lib/render.js`);
|
||||||
|
await Note(e, {render:await getPluginRender()});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -361,6 +368,7 @@ export async function pokeNote(e,{render}) {
|
|||||||
if (!Cfg.get("note.poke")) {
|
if (!Cfg.get("note.poke")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// return await Note(e,{render:await getRender()}, "poke");
|
||||||
return await Note(e,{render}, "poke");
|
return await Note(e,{render}, "poke");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user