New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sun, 29 Apr 2018 12:20:55 GMT logic deprecated logic's __after method is deprecated, it will be discarded in the next version at node_modules\_bluebird@3.3.5@bluebird\js\release\util.js:16:23 #1146
Comments
你有用 |
@lizheming 有用 |
你是什么场景用的?因为几乎没有场景, |
@lizheming 我去 居然要废掉... 我是用这个方法来对所有的logic层进行最后的处理 跟我controller里面继承的base __after一致 例如,所有的logic层的__before都会有下面的处理方法 const pathName = this.ctx.path.slice(this.ctx.path.lastIndexOf('/') + 1);
this.ctx.state.data = this.ctx.post() || this.ctx.param();
this.ctx.state.pathName = pathName; 获取到请求的路径名,获取提交或请求的数据; base的__after会这样写 this.body = {
[this.ctx.state.pathName]: await this.ctx.state.result
} 按照请求的路径名输出json {
pathName:data
} |
唔?你说的好像是 |
这个是__after |
你不写控制器的咩?控制器里有返回的话就会被魔术方法覆盖掉诶 |
let error;
try {
await transporter.sendMail(mailOptions);
this.model('verify/verify').addMailcode(field);
} catch (err) {
error = err.message
}
this.ctx.state.result = error || {verify_id: field.verify_id}; 最终会执行__after就可以了,反正我__after就是统一用来处理最后返回给客户端的数据 |
那你在 |
这.....但是不清真啊 🙄 |
为啥不清真?其实本来就是一回事... 在 controller 的控制器之后做一些事情而已。而且你这个操作真的好奇怪,控制器里不返回,把数据存到 state 里面,然后魔术方法里去返回。。。 |
@lizheming 有点儿道理 |
升级了node之后 就报这个错 |
@lizheming 在使用this.add()的时候 |
你用 |
@lizheming 完全没用 |
是一个很清真的
|
你的数据库用的是什么 |
@ mysql 5.7 |
那可能是哪个依赖模块用了吧,think-model 也没有使用过,摊手~ 哎呀 warning 忽略就好啦~ |
@lizheming 啦样子 很烦耶 又不能try catch |
依赖(甚至可能是依赖的依赖)写的,这个我们也很难办诶~ 摊手 ~ |
😂 好吧 |
安啦,时间会解决一切的(逃。。。 |
@lizheming 你们能在官网上加个页面 用来公布提前公布下一个版本的计划目标和阶段吗 |
太长远的计划不敢列诶,因为指不定就坑了... 2333 |
@newcomein @lizheming |
DESC
ENV
OS Platform:
Node.js Version: 10.0
ThinkJS Version:3.2.7
code
// your code here
error message
more description
// your detail description
The text was updated successfully, but these errors were encountered: