mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-13 23:59:19 +00:00
34 lines
841 B
JavaScript
34 lines
841 B
JavaScript
import path from 'path';
|
|
import fs from 'fs';
|
|
|
|
export default class Base {
|
|
static pluginName = (() => {
|
|
const packageJsonPath = path.join('./plugins', 'rc-plugin', 'package.json');
|
|
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
return packageJson.name;
|
|
})();
|
|
|
|
constructor(e = {}) {
|
|
this.e = e;
|
|
this.userId = e?.user_id;
|
|
this.model = Base.pluginName;
|
|
this._path = process.cwd().replace(/\\/g, '/');
|
|
}
|
|
|
|
get prefix() {
|
|
return `Yz:${Base.pluginName}:${this.model}:`;
|
|
}
|
|
|
|
/**
|
|
* 截图默认数据
|
|
*/
|
|
get screenData() {
|
|
return {
|
|
saveId: this.userId,
|
|
tplFile: `./plugins/${Base.pluginName}/resources/html/${this.model}/${this.model}.html`,
|
|
/** 绝对路径 */
|
|
pluResPath: `${this._path}/plugins/${Base.pluginName}/resources/`,
|
|
};
|
|
}
|
|
}
|