mirror of
https://github.com/cool-team-official/cool-admin-midway.git
synced 2026-02-19 02:33:48 +00:00
整理文件夹
This commit is contained in:
parent
0d6883bc37
commit
7c536806bf
2
.gitignore
vendored
2
.gitignore
vendored
@ -15,4 +15,4 @@ run/
|
||||
.tsbuildinfo.*
|
||||
src/app/public/uploads/
|
||||
typings/
|
||||
resource/.cache
|
||||
.cache
|
||||
|
||||
2
f.yml
2
f.yml
@ -2,5 +2,7 @@ service: cool-admin ## 应用发布到云平台的名字,一般指应用名
|
||||
|
||||
provider:
|
||||
name: aliyun ## 发布的云平台,aliyun,tencent 等
|
||||
runtime: nodejs12
|
||||
memorySize: 512
|
||||
|
||||
deployType: egg ## 部署的应用类型
|
||||
@ -14,7 +14,7 @@
|
||||
"jsonwebtoken": "^8.5.1",
|
||||
"md5": "^2.3.0",
|
||||
"midwayjs-cool-alipay": "^1.0.1",
|
||||
"midwayjs-cool-core": "^3.0.13",
|
||||
"midwayjs-cool-core": "^3.0.15",
|
||||
"midwayjs-cool-oss": "^1.0.10",
|
||||
"midwayjs-cool-queue": "^1.0.3",
|
||||
"midwayjs-cool-redis": "^1.0.6",
|
||||
@ -25,6 +25,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@midwayjs/cli": "^1.2.41",
|
||||
"@midwayjs/cli-plugin-faas": "^1.2.49",
|
||||
"@midwayjs/egg-ts-helper": "^1.0.5",
|
||||
"@midwayjs/luckyeye": "^1.0.2",
|
||||
"@midwayjs/mock": "^2.7.7",
|
||||
|
||||
@ -736,82 +736,6 @@ BEGIN;
|
||||
INSERT INTO `demo_app_goods` VALUES (1, '2021-03-02 17:22:10.687462', '2021-03-02 17:22:10.687462', 'cool-mall商城', 'https://docs.cool-js.com/mall/show05.jpeg', 20.00);
|
||||
COMMIT;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for task_info
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `task_info`;
|
||||
CREATE TABLE `task_info` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||
`createTime` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) COMMENT '创建时间',
|
||||
`updateTime` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) COMMENT '更新时间',
|
||||
`repeatConf` varchar(1000) DEFAULT NULL COMMENT '任务配置',
|
||||
`name` varchar(255) NOT NULL COMMENT '名称',
|
||||
`cron` varchar(255) DEFAULT NULL COMMENT 'cron',
|
||||
`limitCount` int(11) DEFAULT NULL COMMENT '最大执行次数 不传为无限次',
|
||||
`every` int(11) DEFAULT NULL COMMENT '每间隔多少毫秒执行一次 如果cron设置了 这项设置就无效',
|
||||
`remark` varchar(255) DEFAULT NULL COMMENT '备注',
|
||||
`status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态 0:停止 1:运行',
|
||||
`startDate` datetime DEFAULT NULL COMMENT '开始时间',
|
||||
`endDate` datetime DEFAULT NULL COMMENT '结束时间',
|
||||
`data` varchar(255) DEFAULT NULL COMMENT '数据',
|
||||
`service` varchar(255) DEFAULT NULL COMMENT '执行的service实例ID',
|
||||
`type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '状态 0:系统 1:用户',
|
||||
`nextRunTime` datetime DEFAULT NULL COMMENT '下一次执行时间',
|
||||
`taskType` tinyint(4) NOT NULL DEFAULT '0' COMMENT '状态 0:cron 1:时间间隔',
|
||||
`jobId` varchar(255) DEFAULT NULL COMMENT '任务ID',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `IDX_6ced02f467e59bd6306b549bb0` (`createTime`),
|
||||
KEY `IDX_2adc6f9c241391126f27dac145` (`updateTime`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of task_info
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
INSERT INTO `task_info` VALUES (1, '2021-03-05 11:46:24.000000', '2021-03-05 16:33:44.081230', '{\"count\":1,\"id\":1,\"createTime\":\"2021-03-05 11:46:24\",\"updateTime\":\"2021-03-05 16:33:37\",\"jobId\":1,\"name\":\"测试\",\"every\":1000,\"status\":1,\"service\":\"demoOrderService.test()\",\"type\":\"0\",\"taskType\":1}', '测试', NULL, NULL, 1000, NULL, 0, NULL, NULL, NULL, 'demoOrderService.test()', 0, NULL, 1, 'repeat:73bac7c57dd4c1ffd6dc41c3c3cb40e1:1614932670000');
|
||||
COMMIT;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for task_log
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `task_log`;
|
||||
CREATE TABLE `task_log` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||
`createTime` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) COMMENT '创建时间',
|
||||
`updateTime` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) COMMENT '更新时间',
|
||||
`taskId` bigint(20) DEFAULT NULL COMMENT '任务ID',
|
||||
`status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '状态 0:失败 1:成功',
|
||||
`detail` text COMMENT '详情描述',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `IDX_b9af0e100be034924b270aab31` (`createTime`),
|
||||
KEY `IDX_8857d8d43d38bebd7159af1fa6` (`updateTime`),
|
||||
KEY `IDX_1142dfec452e924b346f060fda` (`taskId`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=541 DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of task_log
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
INSERT INTO `task_log` VALUES (521, '2021-03-05 16:32:09.017824', '2021-03-05 16:32:09.017824', 1, 1, '');
|
||||
INSERT INTO `task_log` VALUES (522, '2021-03-05 16:32:10.015478', '2021-03-05 16:32:10.015478', 1, 1, '');
|
||||
INSERT INTO `task_log` VALUES (523, '2021-03-05 16:32:11.017549', '2021-03-05 16:32:11.017549', 1, 1, '');
|
||||
INSERT INTO `task_log` VALUES (524, '2021-03-05 16:32:12.015647', '2021-03-05 16:32:12.015647', 1, 1, '');
|
||||
INSERT INTO `task_log` VALUES (525, '2021-03-05 16:32:35.349964', '2021-03-05 16:32:35.349964', 1, 1, '');
|
||||
INSERT INTO `task_log` VALUES (526, '2021-03-05 16:33:22.020797', '2021-03-05 16:33:22.020797', 1, 1, '');
|
||||
INSERT INTO `task_log` VALUES (527, '2021-03-05 16:33:23.015415', '2021-03-05 16:33:23.015415', 1, 1, '');
|
||||
INSERT INTO `task_log` VALUES (528, '2021-03-05 16:33:24.013962', '2021-03-05 16:33:24.013962', 1, 1, '');
|
||||
INSERT INTO `task_log` VALUES (529, '2021-03-05 16:33:29.017289', '2021-03-05 16:33:29.017289', 1, 1, '');
|
||||
INSERT INTO `task_log` VALUES (530, '2021-03-05 16:33:30.014388', '2021-03-05 16:33:30.014388', 1, 1, '');
|
||||
INSERT INTO `task_log` VALUES (531, '2021-03-05 16:33:31.019317', '2021-03-05 16:33:31.019317', 1, 1, '');
|
||||
INSERT INTO `task_log` VALUES (532, '2021-03-05 16:33:32.016401', '2021-03-05 16:33:32.016401', 1, 1, '');
|
||||
INSERT INTO `task_log` VALUES (533, '2021-03-05 16:33:33.014518', '2021-03-05 16:33:33.014518', 1, 1, '');
|
||||
INSERT INTO `task_log` VALUES (534, '2021-03-05 16:33:38.019010', '2021-03-05 16:33:38.019010', 1, 1, '');
|
||||
INSERT INTO `task_log` VALUES (535, '2021-03-05 16:33:39.015834', '2021-03-05 16:33:39.015834', 1, 1, '');
|
||||
INSERT INTO `task_log` VALUES (536, '2021-03-05 16:33:40.015489', '2021-03-05 16:33:40.015489', 1, 1, '');
|
||||
INSERT INTO `task_log` VALUES (537, '2021-03-05 16:33:41.013458', '2021-03-05 16:33:41.013458', 1, 1, '');
|
||||
INSERT INTO `task_log` VALUES (538, '2021-03-05 16:33:42.015814', '2021-03-05 16:33:42.015814', 1, 1, '');
|
||||
INSERT INTO `task_log` VALUES (539, '2021-03-05 16:33:43.014712', '2021-03-05 16:33:43.014712', 1, 1, '');
|
||||
INSERT INTO `task_log` VALUES (540, '2021-03-05 16:33:44.014487', '2021-03-05 16:33:44.014487', 1, 1, '');
|
||||
COMMIT;
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
16
src/app/modules/demo/config.ts
Normal file
16
src/app/modules/demo/config.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import { Application } from 'egg';
|
||||
import { ModuleConfig } from 'midwayjs-cool-core';
|
||||
|
||||
/**
|
||||
* 示例
|
||||
*/
|
||||
export default (app: Application) => {
|
||||
return {
|
||||
// 模块名称
|
||||
name: '测试模块',
|
||||
// 模块描述
|
||||
description: '演示示例',
|
||||
// 中间件
|
||||
middlewares: [],
|
||||
} as ModuleConfig;
|
||||
};
|
||||
99
src/app/modules/task/init.sql
Normal file
99
src/app/modules/task/init.sql
Normal file
@ -0,0 +1,99 @@
|
||||
/*
|
||||
Navicat Premium Data Transfer
|
||||
|
||||
Source Server : localhost_3306
|
||||
Source Server Type : MySQL
|
||||
Source Server Version : 50725
|
||||
Source Host : localhost:3306
|
||||
Source Schema : cool
|
||||
|
||||
Target Server Type : MySQL
|
||||
Target Server Version : 50725
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 05/03/2021 16:41:26
|
||||
*/
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for task_info
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `task_info`;
|
||||
CREATE TABLE `task_info` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||
`createTime` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) COMMENT '创建时间',
|
||||
`updateTime` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) COMMENT '更新时间',
|
||||
`repeatConf` varchar(1000) DEFAULT NULL COMMENT '任务配置',
|
||||
`name` varchar(255) NOT NULL COMMENT '名称',
|
||||
`cron` varchar(255) DEFAULT NULL COMMENT 'cron',
|
||||
`limitCount` int(11) DEFAULT NULL COMMENT '最大执行次数 不传为无限次',
|
||||
`every` int(11) DEFAULT NULL COMMENT '每间隔多少毫秒执行一次 如果cron设置了 这项设置就无效',
|
||||
`remark` varchar(255) DEFAULT NULL COMMENT '备注',
|
||||
`status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态 0:停止 1:运行',
|
||||
`startDate` datetime DEFAULT NULL COMMENT '开始时间',
|
||||
`endDate` datetime DEFAULT NULL COMMENT '结束时间',
|
||||
`data` varchar(255) DEFAULT NULL COMMENT '数据',
|
||||
`service` varchar(255) DEFAULT NULL COMMENT '执行的service实例ID',
|
||||
`type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '状态 0:系统 1:用户',
|
||||
`nextRunTime` datetime DEFAULT NULL COMMENT '下一次执行时间',
|
||||
`taskType` tinyint(4) NOT NULL DEFAULT '0' COMMENT '状态 0:cron 1:时间间隔',
|
||||
`jobId` varchar(255) DEFAULT NULL COMMENT '任务ID',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `IDX_6ced02f467e59bd6306b549bb0` (`createTime`),
|
||||
KEY `IDX_2adc6f9c241391126f27dac145` (`updateTime`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of task_info
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
INSERT INTO `task_info` VALUES (1, '2021-03-05 11:46:24.000000', '2021-03-05 16:33:44.081230', '{\"count\":1,\"id\":1,\"createTime\":\"2021-03-05 11:46:24\",\"updateTime\":\"2021-03-05 16:33:37\",\"jobId\":1,\"name\":\"测试\",\"every\":1000,\"status\":1,\"service\":\"demoOrderService.test()\",\"type\":\"0\",\"taskType\":1}', '测试', NULL, NULL, 1000, NULL, 0, NULL, NULL, NULL, 'demoOrderService.test()', 0, NULL, 1, 'repeat:73bac7c57dd4c1ffd6dc41c3c3cb40e1:1614932670000');
|
||||
COMMIT;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for task_log
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `task_log`;
|
||||
CREATE TABLE `task_log` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||
`createTime` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) COMMENT '创建时间',
|
||||
`updateTime` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) COMMENT '更新时间',
|
||||
`taskId` bigint(20) DEFAULT NULL COMMENT '任务ID',
|
||||
`status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '状态 0:失败 1:成功',
|
||||
`detail` text COMMENT '详情描述',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `IDX_b9af0e100be034924b270aab31` (`createTime`),
|
||||
KEY `IDX_8857d8d43d38bebd7159af1fa6` (`updateTime`),
|
||||
KEY `IDX_1142dfec452e924b346f060fda` (`taskId`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=541 DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of task_log
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
INSERT INTO `task_log` VALUES (521, '2021-03-05 16:32:09.017824', '2021-03-05 16:32:09.017824', 1, 1, '');
|
||||
INSERT INTO `task_log` VALUES (522, '2021-03-05 16:32:10.015478', '2021-03-05 16:32:10.015478', 1, 1, '');
|
||||
INSERT INTO `task_log` VALUES (523, '2021-03-05 16:32:11.017549', '2021-03-05 16:32:11.017549', 1, 1, '');
|
||||
INSERT INTO `task_log` VALUES (524, '2021-03-05 16:32:12.015647', '2021-03-05 16:32:12.015647', 1, 1, '');
|
||||
INSERT INTO `task_log` VALUES (525, '2021-03-05 16:32:35.349964', '2021-03-05 16:32:35.349964', 1, 1, '');
|
||||
INSERT INTO `task_log` VALUES (526, '2021-03-05 16:33:22.020797', '2021-03-05 16:33:22.020797', 1, 1, '');
|
||||
INSERT INTO `task_log` VALUES (527, '2021-03-05 16:33:23.015415', '2021-03-05 16:33:23.015415', 1, 1, '');
|
||||
INSERT INTO `task_log` VALUES (528, '2021-03-05 16:33:24.013962', '2021-03-05 16:33:24.013962', 1, 1, '');
|
||||
INSERT INTO `task_log` VALUES (529, '2021-03-05 16:33:29.017289', '2021-03-05 16:33:29.017289', 1, 1, '');
|
||||
INSERT INTO `task_log` VALUES (530, '2021-03-05 16:33:30.014388', '2021-03-05 16:33:30.014388', 1, 1, '');
|
||||
INSERT INTO `task_log` VALUES (531, '2021-03-05 16:33:31.019317', '2021-03-05 16:33:31.019317', 1, 1, '');
|
||||
INSERT INTO `task_log` VALUES (532, '2021-03-05 16:33:32.016401', '2021-03-05 16:33:32.016401', 1, 1, '');
|
||||
INSERT INTO `task_log` VALUES (533, '2021-03-05 16:33:33.014518', '2021-03-05 16:33:33.014518', 1, 1, '');
|
||||
INSERT INTO `task_log` VALUES (534, '2021-03-05 16:33:38.019010', '2021-03-05 16:33:38.019010', 1, 1, '');
|
||||
INSERT INTO `task_log` VALUES (535, '2021-03-05 16:33:39.015834', '2021-03-05 16:33:39.015834', 1, 1, '');
|
||||
INSERT INTO `task_log` VALUES (536, '2021-03-05 16:33:40.015489', '2021-03-05 16:33:40.015489', 1, 1, '');
|
||||
INSERT INTO `task_log` VALUES (537, '2021-03-05 16:33:41.013458', '2021-03-05 16:33:41.013458', 1, 1, '');
|
||||
INSERT INTO `task_log` VALUES (538, '2021-03-05 16:33:42.015814', '2021-03-05 16:33:42.015814', 1, 1, '');
|
||||
INSERT INTO `task_log` VALUES (539, '2021-03-05 16:33:43.014712', '2021-03-05 16:33:43.014712', 1, 1, '');
|
||||
INSERT INTO `task_log` VALUES (540, '2021-03-05 16:33:44.014487', '2021-03-05 16:33:44.014487', 1, 1, '');
|
||||
COMMIT;
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
@ -18,8 +18,8 @@ export abstract class TaskInfoQueue implements ICoolQueue {
|
||||
async data(job: any, done: any): Promise<void> {
|
||||
try {
|
||||
console.log('收到的数据', job.data);
|
||||
this.taskInfoService.invokeService(job.data.service);
|
||||
this.taskInfoService.record(job.data, 1);
|
||||
const result = await this.taskInfoService.invokeService(job.data.service);
|
||||
this.taskInfoService.record(job.data, 1, JSON.stringify(result));
|
||||
} catch (error) {
|
||||
this.taskInfoService.record(job.data, 0, error);
|
||||
}
|
||||
|
||||
@ -295,9 +295,9 @@ export class TaskInfoService extends BaseService {
|
||||
const lastArr = child.split('(');
|
||||
const param = lastArr[1].replace(')', '');
|
||||
if (!param) {
|
||||
service[lastArr[0]]();
|
||||
return service[lastArr[0]]();
|
||||
} else {
|
||||
service[lastArr[0]](JSON.parse(param));
|
||||
return service[lastArr[0]](JSON.parse(param));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1 +0,0 @@
|
||||
文件上传路径
|
||||
@ -7,11 +7,11 @@ export default (appInfo: EggAppInfo) => {
|
||||
|
||||
config.orm = {
|
||||
type: 'mysql',
|
||||
host: '127.0.0.1',
|
||||
host: '139.196.196.203',
|
||||
port: 3306,
|
||||
username: 'root',
|
||||
username: 'cooladmin',
|
||||
password: '123123',
|
||||
database: 'cool',
|
||||
database: 'cooladmin',
|
||||
// 自动建表 注意:线上部署的时候不要使用,有可能导致数据丢失
|
||||
synchronize: true,
|
||||
// 打印日志
|
||||
|
||||
@ -7,11 +7,11 @@ export default (appInfo: EggAppInfo) => {
|
||||
|
||||
config.orm = {
|
||||
type: 'mysql',
|
||||
host: '127.0.0.1',
|
||||
host: '139.196.196.203',
|
||||
port: 3306,
|
||||
username: 'root',
|
||||
username: 'cooladmin',
|
||||
password: '123123',
|
||||
database: 'cool-admin-next',
|
||||
database: 'cooladmin',
|
||||
// 自动建表 注意:线上部署的时候不要使用,有可能导致数据丢失
|
||||
synchronize: false,
|
||||
// 打印日志
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user