请求接口

package com.example.jd0807.utils;

import com.example.jd0807.bean.HomeLoopBean;
import com.example.jd0807.bean.LoginBean;
import com.example.jd0807.bean.RegistBean;
import com.example.jd0807.bean.ShopInfoBean;
import com.example.jd0807.bean.ShopList;
import com.example.jd0807.bean.SortLeft;
import com.example.jd0807.bean.SortRight;
import com.example.jd0807.bean.UserInfo;
import com.example.jd0807.cart.bean.CartBean;
import com.example.jd0807.cart.bean.UpdateCart;

import io.reactivex.Observable;
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Query;
import retrofit2.http.QueryMap;

/**
 * 请求接口对应方法
 */
public interface BaseApiInterface {

    //注册
    @POST("user/reg")
    Call<RegistBean> jdRegist(@Query("mobile") String mobile, @Query("password") String password, @Query("token") String token);

    //登录
    @POST("user/login")
    Call<LoginBean> jdLogin(@Query("mobile") String mobile, @Query("password") String password, @Query("token") String token);

    //获取用户信息
    @GET("user/getUserInfo")
    Observable<UserInfo> getUserInfo(@Query("uid") String uid);

    //首页链接
    @GET("ad/getAd")
    Observable<HomeLoopBean> getHomeLoopBean();

    //分类左
    @GET("product/getCatagory")
    Observable<SortLeft> getSortLeft();

    //分类右
    @GET("product/getProductCatagory")
    Observable<SortRight> getSortRight(@Query("cid") String cid);

    //右分类点击的商品列表  https://www.zhaoapi.cn/product/getProducts?pscid=1
    @GET("product/getProducts")
    Observable<ShopList> getShopList(@Query("pscid") String pscid);

    //商品的详情
    //https://www.zhaoapi.cn/product/getProductDetail?pid=1
    @GET("product/getProductDetail")
    Observable<ShopInfoBean> getShopInfo(@Query("pid") String pid);

    //搜索
    //https://www.zhaoapi.cn/product/searchProducts?keywords=笔记本
    @GET("product/searchProducts")
    Observable<ShopList> getShopKeyList(@Query("keywords") String keywords,@Query("page")String page);

    //查看购物车  product/getCarts?uid=16856
    @GET("product/getCarts")
    Observable<CartBean> getCartData(@Query("uid") String uid);

    //更新购物车    product/updateCarts?uid=16856&sellerid=17&pid=1&selected=0&num=10
    @GET("product/updateCarts")
    Observable<UpdateCart> updataCart(@Query("uid") String uid, @Query("sellerid") String sellerid,
                                      @Query("pid") String pid, @Query("selected") String selected,
                                      @Query("num") String num);


    //加入购物车https://www.zhaoapi.cn/product/addCart?uid=16856&pid=3
    @GET("product/addCart")
    Observable<UpdateCart> addCart(@Query("uid") String uid, @Query("pid") String pid);

    //删除购物车  https://www.zhaoapi.cn/product/deleteCart?uid=16856&pid=4
    @GET("product/deleteCart")
    Observable<UpdateCart> delCart(@Query("uid") String uid, @Query("pid") String pid);
}

猜你喜欢

转载自blog.csdn.net/Yang_Liu_1/article/details/82797507