package com.kym.miniapp.controller;

import com.kym.common.R;
import com.kym.entity.admin.queryParams.CommonQueryParam;
import com.kym.service.miniapp.RefundLogService;
import com.kym.service.miniapp.WalletDetailService;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 用户账户表 前端控制器
 * </p>
 *
 * @author skyline
 * @since 2023-08-07
 */
@RestController
@RequestMapping("/account/")
public class AccountController {

    private final WalletDetailService walletDetailService;

    private final RefundLogService refundLogService;

    public AccountController(WalletDetailService walletDetailService, RefundLogService refundLogService) {
        this.walletDetailService = walletDetailService;
        this.refundLogService = refundLogService;
    }

    /**
     * 钱包明细
     *
     * @param type
     * @return
     */
    @GetMapping("/walletDetail")
    public R<?> walletDetail(@RequestParam(name = "type", defaultValue = "0", required = false) int type) {
        return R.success(walletDetailService.listWalletDetail(type));
    }

    @PostMapping("/listRefund")
    public R<?> listRefund(@RequestBody CommonQueryParam params) {
        return R.success(refundLogService.listRefundLogForApp(params));
    }

}
