我正在使用调度这样做:
private def buildSearchReq(searchTerm: String, lat: Double, long: Double): Req = {
val consumer = new ConsumerKey(consumerKey, consumerSecret)
val requestToken = new RequestToken(token, tokenSecret)
val req = url(searchUrl)
.addQueryParameter("term", searchTerm)
.addQueryParameter("radius_filter", "40000")
.addQueryParameter("ll", s"$lat,$long")
new SigningVerbs(req).sign(consumer, requestToken)
}
如果你愿意,你也可以做更多这样的事情:
private def buildSearchReq(searchTerm: String, lat: Double, long: Double): Req = {
val req = url(searchUrl) <<? Map("term" -> searchTerm, "radius_filter" -> "40000", "ll" -> s"$lat,$long")
new SigningVerbs(req).sign(new ConsumerKey(consumerKey, consumerSecret), new RequestToken(token, tokenSecret))
}
可能还有更简洁的方法,但你明白了。