This commit is contained in:
COOL 2025-02-08 19:31:49 +08:00
parent bdb221ea15
commit 49ba7b54be
12 changed files with 37 additions and 9993 deletions

View File

@ -74,10 +74,13 @@
],
"assets": [
"public/**/*",
"typings/**/*"
"typings/**/*",
"src/locales/**/*"
],
"targets": [
"node20-macos-x64"
"node20-macos-x64",
"node20-linux-x64",
"node20-win-x64"
],
"outputPath": "build"
},

9860
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

BIN
public/Thumbs.db Normal file

Binary file not shown.

View File

@ -10,7 +10,7 @@ import { availablePort } from '../comm/port';
export default {
// 确保每个项目唯一,项目首次启动会自动生成
keys: '576848ea-bb0c-4c0c-ac95-c8602ef908b5',
keys: 'cool-admin-keys-xxxxxx',
koa: {
port: availablePort(8001),
},

View File

@ -10,36 +10,25 @@ export default {
typeorm: {
dataSource: {
default: {
type: 'sqlite',
// 数据库文件地址
database: pSqlitePath(),
type: 'mysql',
host: '127.0.0.1',
port: 3306,
username: 'root',
password: '123456',
database: 'cool',
// 自动建表 注意:线上部署的时候不要使用,有可能导致数据丢失
synchronize: true,
// 打印日志
logging: false,
// 字符集
charset: 'utf8mb4',
// 是否开启缓存
cache: true,
// 实体路径
entities: ['**/modules/*/entity'],
// 订阅者
subscribers: [TenantSubscriber],
},
// default: {
// type: 'mysql',
// host: '127.0.0.1',
// port: 3306,
// username: 'root',
// password: '123456',
// database: 'cool',
// // 自动建表 注意:线上部署的时候不要使用,有可能导致数据丢失
// synchronize: true,
// // 打印日志
// logging: false,
// // 字符集
// charset: 'utf8mb4',
// // 是否开启缓存
// cache: true,
// // 实体路径
// entities: ['**/modules/*/entity'],
// },
},
},
cool: {

View File

@ -1,7 +1,6 @@
import { CoolConfig } from '@cool-midway/core';
import { MidwayConfig } from '@midwayjs/core';
import { entities } from '../entities';
import { pSqlitePath } from '../comm/path';
import { TenantSubscriber } from '../modules/base/db/tenant';
/**
@ -11,13 +10,20 @@ export default {
typeorm: {
dataSource: {
default: {
type: 'sqlite',
// 数据库文件地址
database: pSqlitePath(),
type: 'mysql',
host: '127.0.0.1',
port: 3306,
username: 'root',
password: '123456',
database: 'cool',
// 自动建表 注意:线上部署的时候不要使用,有可能导致数据丢失
synchronize: true,
synchronize: false,
// 打印日志
logging: false,
// 字符集
charset: 'utf8mb4',
// 是否开启缓存
cache: true,
// 实体路径
entities,
// 订阅者
@ -27,12 +33,12 @@ export default {
},
cool: {
// 实体与路径跟生成代码、前端请求、swagger文档相关 注意:线上不建议开启,以免暴露敏感信息
eps: true,
eps: false,
// 是否自动导入模块数据库
initDB: true,
initDB: false,
// 判断是否初始化的方式
initJudge: 'db',
// 是否自动导入模块菜单
initMenu: true,
initMenu: false,
} as CoolConfig,
} as MidwayConfig;

View File

@ -27,7 +27,7 @@ export default () => {
// 单点登录
sso: false,
// 注意: 最好重新修改,防止破解
secret: 'e43675a9-0ce5-4d50-8dd0-549dff19334c',
secret: 'cool-admin-xxxxxx',
// token
token: {
// 2小时过期需要用刷新token

View File

@ -78,7 +78,7 @@ export class BaseTranslateService {
*
*/
async loadTranslations() {
if (!(this.config?.enable && this.app.getEnv() == 'local')) {
if (!this.config?.enable) {
return;
}
if (!this.basePath) {

View File

@ -308,6 +308,10 @@ export class TaskLocalService extends BaseService {
*
*/
async executor(task: any): Promise<void> {
// 如果不是开始时间之后的 则不执行
if (task.startDate && moment(task.startDate).isAfter(moment())) {
return;
}
try {
const currentTime = moment();
const lockExpireTime = moment().add(5, 'minutes');

View File

@ -28,7 +28,7 @@ export default () => {
// 刷新token 过期时间,单位秒
refreshExpire: 60 * 60 * 24 * 30,
// jwt 秘钥
secret: '52dee820-a5d9-46ed-858b-ea193c3f84e2x',
secret: 'cool-app-xxxxxx',
},
} as ModuleConfig;
};

96
typings/feishu.d.ts vendored
View File

@ -1,96 +0,0 @@
import { BasePlugin } from '@cool-midway/plugin-cli';
import axios from 'axios';
interface Message {
/** 类型 */
msg_type:
| 'text'
| 'post'
| 'image'
| 'file'
| 'audio'
| 'media'
| 'sticker'
| 'interactive'
| 'share_chat'
| 'share_user';
/** 内容 */
content: any;
}
/**
*
*/
export declare class CoolPlugin extends BasePlugin {
/**
* webHook消息
* @param message
* @returns
*/
sendByHook(message: Message): Promise<axios.AxiosResponse<any, any>>;
/**
*
* @param message
* @param options receive_id receive_id_type message_id ID uuid ID
* @returns
*/
sendByApp(
message: Message,
options: {
receive_id: string;
receive_id_type: 'open_id' | 'user_id' | 'chat_id' | 'union_id' | 'email';
message_id?: string;
uuid?: string;
},
): Promise<axios.AxiosResponse<any, any>>;
/**
*
* @param filePath
* @param image_type message avatar
* @returns
*/
uploadImage(
filePath: string,
image_type?: 'message' | 'avatar',
): Promise<any>;
/**
*
* @param filePath
* @param file_type
* @returns
*/
uploadFile(
filePath: any,
file_type?: 'opus' | 'mp4' | 'pdf' | 'doc' | 'xls' | 'ppt' | 'stream',
): Promise<any>;
/**
*
* @returns
*/
chatList(): Promise<any>;
/**
*
* @param options emails mobiles include_resigned
* @returns
*/
getUserInfos(options: {
emails?: string[];
mobiles?: string[];
include_resigned?: boolean;
}): Promise<any>;
/**
* 使 ID
* @param options emails mobiles include_resigned
* @returns
*/
getUserIds(options: {
emails?: string[];
mobiles?: string[];
include_resigned?: boolean;
}): Promise<any>;
/**
* token
* @returns
*/
getToken(): Promise<any>;
}
export declare const Plugin: typeof CoolPlugin;
export {};

2
typings/plugin.d.ts vendored
View File

@ -1,4 +1,3 @@
import * as feishu from './feishu';
import { BaseUpload, MODETYPE } from './upload';
type AnyString = string & {};
/**
@ -6,5 +5,4 @@ type AnyString = string & {};
*/
interface PluginMap {
upload: BaseUpload;
feishu: feishu.CoolPlugin;
}