小编Fai*_*aiz的帖子

RxJava 分页

我对 rxJava 相当陌生。在我的 api 响应中,我获得了有关总页数和当前页码的信息,例如:

 "pages": 22,
 "page": 1,
Run Code Online (Sandbox Code Playgroud)

我正在使用 Retrofit 在数据层进行 api 调用,我的 api 服务如下:

@GET("/story")
    Observable <StoryCollectionEntity> storyCollection(
              @Query("feed_ids") String feed_items, 
              @Query("page") int  page);
Run Code Online (Sandbox Code Playgroud)

然后:

   public Observable<StoryCollectionEntity> storyCollection() {
        return mUserApi.storyCollection(items,page);
}
Run Code Online (Sandbox Code Playgroud)

我在域层进行了这样的订阅:

public void execute(Subscriber UseCaseSubscriber) {
        this.subscription = this.buildUseCaseObservable()
                 .subscribeOn(Schedulers.from(threadExecutor))
                .observeOn(postExecutionThread.getScheduler())
                .subscribe(UseCaseSubscriber);

    }
 @Override public Observable buildUseCaseObservable() {
    return this.userRepository.stories();
  }
Run Code Online (Sandbox Code Playgroud)

我正在弄清楚如何通过发出下一页的结果让这个观察者对 recyclerView 滚动事件做出反应。即第 2 页到第二个滚动事件和第 3 页在第 3 次滚动...等

android rx-java rx-android

2
推荐指数
1
解决办法
4351
查看次数

使用 Guzzle 在 post 请求中传递数组

我正在尝试在发布请求负载中传递数组。

url = http://IP:PortNo/index.php/v1/login
Run Code Online (Sandbox Code Playgroud)

有效负载:

data={ "terminal_id": "terminal_id", "api_login": "api_login", "api_key": "api_key", "merchant_code": "merchant_code" }
Run Code Online (Sandbox Code Playgroud)

我所做的是:

$data = ['terminal_id' => $this->terminal_id , 'api_login' => $this->api_login,
        'api_key' => $this->api_key , 'merchant_code' => $this->merchant_code];
$response = $this->client->post($url, array('data' => $data));
Run Code Online (Sandbox Code Playgroud)

但我得到的回应是:

“未找到请求数据”

这意味着我的数据有效负载格式不正确。任何想法?

php guzzle guzzle6

-1
推荐指数
1
解决办法
1万
查看次数

标签 统计

android ×1

guzzle ×1

guzzle6 ×1

php ×1

rx-android ×1

rx-java ×1