package com.sckw.example.controller;

import com.sckw.payment.api.dubbo.PayCenterDubboService;
import com.sckw.payment.api.dubbo.PaymentDubboService;
import com.sckw.payment.api.model.dto.MemberDetail;
import com.sckw.payment.api.model.dto.WalletDto;
import com.sckw.payment.api.model.dto.common.R;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/test")
public class TestController {
    @DubboReference(version = "1.0.0", group = "design", check = false)
    private PayCenterDubboService payCenterDubboService;
    @DubboReference(version = "1.0.0", group = "design", check = false)
    private PaymentDubboService paymentDubboService;

    @GetMapping("/detail")
    public R<MemberDetail> download(/*@RequestParam("uid")*/ Long uid, String channel) {
        return null;//payCenterDubboService.memberDetail(uid, ChannelEnum.HF);
    }

    @GetMapping("/wall")
    public R<List<WalletDto>> wall(@RequestParam("uid") Long uid, String channel, Long filter) {
        return payCenterDubboService.wallet(uid, null, filter);
    }

    @GetMapping("/test")
    public R<Object> test(@RequestParam("entId") Long entId,Integer type) {
        return R.ok(paymentDubboService.countSell(entId, type));
    }
    @GetMapping("/test1")
    public R<Object> test1(@RequestParam("entId") Long entId,Integer type) {
        return R.ok(paymentDubboService.countPurchase(entId, type));
    }
    @GetMapping("/test2")
    public R<Object> test2(@RequestParam("entId") Long entId,Integer type) {
        return R.ok(paymentDubboService.countCarrier(entId, type));
    }
    @GetMapping("/test3")
    public R<Object> test3(@RequestParam("entId") Long entId,Integer type) {
        return R.ok(paymentDubboService.countShipper(entId, type));
    }

}
