移除send方法

v1
宇天 2020-09-28 09:42:37 +08:00
parent 20d03cd84c
commit 3eb89216ef
2 changed files with 2 additions and 18 deletions

View File

@ -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

View File

@ -5,9 +5,6 @@
"description": "控制器基类。",
"main": "index.js",
"author": "yutent <yutent.io@gmail.com>",
"dependencies": {
"crypto.js": "^2.0.2"
},
"keywords": ["fivejs", "controller", "http"],
"repository": "https://github.com/bytedo/gmf.controller.git",
"license": "MIT"