This commit is contained in:
COOL 2022-03-27 10:01:13 +08:00
parent 729eb94da2
commit 95d1ec4cf9
4 changed files with 48 additions and 26 deletions

View File

@ -5,40 +5,41 @@
"private": true, "private": true,
"dependencies": { "dependencies": {
"@cool-midway/core": "^5.0.6", "@cool-midway/core": "^5.0.6",
"@cool-midway/es": "^5.0.1", "@cool-midway/es": "^5.0.2",
"@cool-midway/file": "^5.0.1", "@cool-midway/file": "^5.0.2",
"@cool-midway/pay": "^5.0.0", "@cool-midway/pay": "^5.0.0",
"@cool-midway/rpc": "^5.0.1", "@cool-midway/rpc": "^5.0.1",
"@cool-midway/task": "^5.0.1", "@cool-midway/task": "^5.0.1",
"@midwayjs/bootstrap": "^3.1.1", "@midwayjs/bootstrap": "^3.2.0",
"@midwayjs/core": "^3.1.1", "@midwayjs/core": "^3.2.0",
"@midwayjs/decorator": "^3.0.0", "@midwayjs/decorator": "^3.1.6",
"@midwayjs/info": "^3.1.1", "@midwayjs/info": "^3.2.0",
"@midwayjs/koa": "^3.1.1", "@midwayjs/koa": "^3.2.0",
"@midwayjs/logger": "^2.16.3", "@midwayjs/logger": "^2.16.3",
"@midwayjs/orm": "^3.1.1", "@midwayjs/orm": "^3.2.0",
"@midwayjs/static-file": "^3.1.1", "@midwayjs/socketio": "^3.2.0",
"@midwayjs/validate": "^3.1.1", "@midwayjs/static-file": "^3.2.0",
"@midwayjs/view-ejs": "^3.1.1", "@midwayjs/validate": "^3.2.0",
"@midwayjs/view-ejs": "^3.2.0",
"ipip-ipdb": "^0.6.0", "ipip-ipdb": "^0.6.0",
"jsonwebtoken": "^8.5.1", "jsonwebtoken": "^8.5.1",
"mini-svg-data-uri": "^1.4.4", "mini-svg-data-uri": "^1.4.4",
"mysql2": "^2.3.3", "mysql2": "^2.3.3",
"svg-captcha": "^1.4.0", "svg-captcha": "^1.4.0",
"typeorm": "^0.2.45" "typeorm": "^0.3.3"
}, },
"devDependencies": { "devDependencies": {
"@midwayjs/cli": "^1.3.0", "@midwayjs/cli": "^1.3.1",
"@midwayjs/mock": "^3.1.1", "@midwayjs/mock": "^3.2.0",
"@types/jest": "^27.4.1", "@types/jest": "^27.4.1",
"@types/koa": "^2.13.4", "@types/koa": "^2.13.4",
"@types/node": "17", "@types/node": "17",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"jest": "^27.5.1", "jest": "^27.5.1",
"mwts": "^1.3.0", "mwts": "^1.3.0",
"swagger-ui-dist": "^4.6.1", "swagger-ui-dist": "^4.9.1",
"ts-jest": "^27.1.3", "ts-jest": "^27.1.4",
"typescript": "^4.6.2" "typescript": "^4.6.3"
}, },
"engines": { "engines": {
"node": ">=12.0.0" "node": ">=12.0.0"

View File

@ -8,6 +8,7 @@ import * as view from '@midwayjs/view-ejs';
import * as orm from '@midwayjs/orm'; import * as orm from '@midwayjs/orm';
import * as cool from '@cool-midway/core'; import * as cool from '@cool-midway/core';
import * as file from '@cool-midway/file'; import * as file from '@cool-midway/file';
// import * as socketio from '@midwayjs/socketio';
// import * as task from '@cool-midway/task'; // import * as task from '@cool-midway/task';
// import * as pay from '@cool-midway/pay'; // import * as pay from '@cool-midway/pay';
// import * as es from '@cool-midway/es'; // import * as es from '@cool-midway/es';
@ -25,6 +26,8 @@ import * as file from '@cool-midway/file';
staticFile, staticFile,
// typeorm https://typeorm.io 打不开? https://typeorm.biunav.com/zh/ // typeorm https://typeorm.io 打不开? https://typeorm.biunav.com/zh/
orm, orm,
// socketio http://www.midwayjs.org/docs/extensions/socketio
// socketio,
// cool-admin 官方组件 https://www.cool-js.com // cool-admin 官方组件 https://www.cool-js.com
cool, cool,
// 文件上传 阿里云存储 腾讯云存储 七牛云存储 // 文件上传 阿里云存储 腾讯云存储 七牛云存储

View File

@ -1,12 +1,4 @@
import { import { Provide, Body, Inject, Post, Get, Query } from '@midwayjs/decorator';
Provide,
Body,
ALL,
Inject,
Post,
Get,
Query,
} from '@midwayjs/decorator';
import { CoolController, BaseController, CoolEps } from '@cool-midway/core'; import { CoolController, BaseController, CoolEps } from '@cool-midway/core';
import { LoginDTO } from '../../dto/login'; import { LoginDTO } from '../../dto/login';
import { BaseSysLoginService } from '../../service/sys/login'; import { BaseSysLoginService } from '../../service/sys/login';

View File

@ -0,0 +1,26 @@
import {
WSController,
OnWSConnection,
Inject,
OnWSMessage,
} from '@midwayjs/decorator';
import { Context } from '@midwayjs/socketio';
/**
*
*/
@WSController('/')
export class HelloController {
@Inject()
ctx: Context;
@OnWSConnection()
async onConnectionMethod() {
console.log('on client connect', this.ctx.id);
this.ctx.emit('data', '连接成功');
}
@OnWSMessage('myEvent')
async gotMessage(data) {
console.log('on data got', this.ctx.id, data);
}
}