diff --git a/client/containers/Project/Interface/InterfaceList/Edit.js b/client/containers/Project/Interface/InterfaceList/Edit.js index e0e2b3fb..221ff48a 100644 --- a/client/containers/Project/Interface/InterfaceList/Edit.js +++ b/client/containers/Project/Interface/InterfaceList/Edit.js @@ -49,6 +49,8 @@ class InterfaceEdit extends Component{ s.onopen = (e)=>{ console.log('open',e) s.send('abc') + //s.close() + s.send('aaaaa') } s.onclose = (e)=>{ diff --git a/package.json b/package.json index 0972c053..944111e1 100644 --- a/package.json +++ b/package.json @@ -59,6 +59,7 @@ "koa-bodyparser": "^3.2.0", "koa-logger": "^3.0.0", "koa-mysql-session": "0.0.2", + "koa-route": "^3.2.0", "koa-router": "^7.0.1", "koa-send": "^3.2.0", "koa-session-minimal": "^3.0.3", diff --git a/server/controllers/interface.js b/server/controllers/interface.js index 197eeab6..8ac07ca6 100644 --- a/server/controllers/interface.js +++ b/server/controllers/interface.js @@ -314,6 +314,10 @@ class interfaceController extends baseController { // do something with the message from client console.log(message); }); + + ctx.websocket.on('close', function(){ + console.log('websocket: close') + }) } } diff --git a/server/models/interface.js b/server/models/interface.js index 3c3f12ee..c1e706f0 100644 --- a/server/models/interface.js +++ b/server/models/interface.js @@ -13,7 +13,7 @@ class interfaceModel extends baseModel { path: { type: String, required: true }, method: { type: String, required: true }, project_id: { type: Number, required: true }, - edit_uid: {type: Number}, + edit_uid: {type: Number, default: 0}, status: {type: String, enum: ['undone', 'done'], default: 'undone'}, desc: String, add_time: Number, diff --git a/server_dist/controllers/interface.js b/server_dist/controllers/interface.js index fedf23ff..c148d038 100644 --- a/server_dist/controllers/interface.js +++ b/server_dist/controllers/interface.js @@ -615,7 +615,11 @@ var interfaceController = function (_baseController) { console.log(message); }); - case 5: + ctx.websocket.on('close', function () { + console.log('websocket: close'); + }); + + case 6: case 'end': return _context6.stop(); } diff --git a/server_dist/models/interface.js b/server_dist/models/interface.js index e596c40f..f3a98dc1 100644 --- a/server_dist/models/interface.js +++ b/server_dist/models/interface.js @@ -52,7 +52,7 @@ var interfaceModel = function (_baseModel) { path: { type: String, required: true }, method: { type: String, required: true }, project_id: { type: Number, required: true }, - edit_uid: { type: Number }, + edit_uid: { type: Number, default: 0 }, status: { type: String, enum: ['undone', 'done'], default: 'undone' }, desc: String, add_time: Number,