Async库的分支异步问题
 发布于 9 年前  作者 Chalin-Shi  3882 次预览  最后一次回复是 9 年前  来自 问答 

如题: 异步中出现if-else分支,如果使用Async库,该怎么处理并使用呢? 希望能给个实例,谢谢。 query.find().then(function(user){ if(user.length) return customer.follow(user.id); else return 0; }).then(function(res){ if(res) return user.follow(anotherId); else return 0; }) . . . }).then(function(j){ if(j) response.success(‘ok’); else response.success(‘err’); }, function(err){ console.err(err); });