package com.tmerclub.cloud.systemtest.api.platform;

import com.tmerclub.cloud.common.product.dto.SpuDTO;
import com.tmerclub.cloud.common.product.vo.app.SpuAppVO;
import com.moyuer.cloud.systemtest.constants.Constant;
import com.moyuer.cloud.systemtest.util.HttpUtil;
import com.moyuer.cloud.systemtest.util.UrlEnum;

/**
 * @author lpj
 */
public class ScoreProductApi {
    /**
     * 发布积分商品
     */
    public static Long createScoreProduct(SpuDTO spuDTO) {
        String url = Constant.API_URL + "/tmerclub_product/p/spu/score_save";
        return HttpUtil.post(url, spuDTO, UrlEnum.PLATFORM,Long.class);
    }

    /**
     * 删除积分商品
     */
    public static void deleteScoreProduct(Long spuId) {
        String url = Constant.API_URL + "/tmerclub_product/mp/spu?spuId=" + spuId;
        HttpUtil.delete(url,UrlEnum.PLATFORM);
    }

    /**
     * 获取积分商品详情
     */
    public static SpuAppVO getScoreProductInfo(Long spuId, Long userId){
        String url = Constant.API_URL + "/tmerclub_product/ma/spu/score_prod_info?spuId="+spuId+"&&userId="+userId;
        return HttpUtil.get(url, SpuAppVO.class,UrlEnum.API);
    }
}
