From 3eb89216efb9bd5d97e929745673516c0330256b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Mon, 28 Sep 2020 09:42:37 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4send=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.js | 17 ++--------------- package.json | 3 --- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/index.js b/index.js index 7d9922c..51f294d 100644 --- a/index.js +++ b/index.js @@ -4,8 +4,6 @@ * @date 2020/09/24 15:45:17 */ -import { sha1 } from 'crypto.js' - export default class Controller { // 初始化方法, 取代原先的构造方法 __f_i_v_e__(ctx, req, res) { @@ -13,8 +11,6 @@ export default class Controller { this.name = req.app this.request = req this.response = res - - this.views = ctx.$$views } // 定义一个模板变量 @@ -25,13 +21,13 @@ export default class Controller { key += '' if (key) { - this.views.assign(key, val) + this.context.$$views.assign(key, val) } } // 模板渲染, 参数是模板名, 可不带后缀, 默认是 render(file, noParse = false) { - this.views + this.context.$$views .render(file, noParse) .then(html => { this.response.render(html) @@ -97,15 +93,6 @@ export default class Controller { } } - // resfull-api规范的纯API返回 - send(status = 200, msg = 'success', data = {}) { - if (typeof msg === 'object') { - data = msg - msg = 'success' - } - this.response.send(status, msg, data) - } - //针对框架定制的debug信息输出 xdebug(err) { var msg = err diff --git a/package.json b/package.json index e3d2f1f..c290f45 100644 --- a/package.json +++ b/package.json @@ -5,9 +5,6 @@ "description": "控制器基类。", "main": "index.js", "author": "yutent ", - "dependencies": { - "crypto.js": "^2.0.2" - }, "keywords": ["fivejs", "controller", "http"], "repository": "https://github.com/bytedo/gmf.controller.git", "license": "MIT"