We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
比如我有一个发短信的service: msg_service 当我想用,user_service 调用他的时候,我需要这么写
think.service('msg_serivce', 'user');
而不能:
this.service('msg_service');
现在有两种方式:
let msg_service = new (think.service('msg_serivce', 'user'))();
this.msg_service = new (think.service('msg_serivce', 'user'))();
然后在每个方法里调用
this.msg_service.functions();
请问,有没有更好的解决方案,或者能够优化这部分的架构,因为这样操作觉得不舒服。。
Platform: mac
Node.js Version: 5.10
ThinkJS Version: 2.2
The text was updated successfully, but these errors were encountered:
恩,后续版本里考虑添加 this.service 方法
this.service
Sorry, something went wrong.
a5e676e
No branches or pull requests
关于 service 调用其他 service 时,不能用this
比如我有一个发短信的service: msg_service
当我想用,user_service 调用他的时候,我需要这么写
而不能:
另一个问题:比如我在一个service 里,多个方法都需要调用 发短信的服务 msg_service
现在有两种方式:
1.每个方法里都写一句
2.在 init(...args) 的初始化方法里,写一句
然后在每个方法里调用
请问,有没有更好的解决方案,或者能够优化这部分的架构,因为这样操作觉得不舒服。。
ENV
Platform: mac
Node.js Version: 5.10
ThinkJS Version: 2.2
The text was updated successfully, but these errors were encountered: