package com.ruoyi.applet.contoller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.model.service.IAppTransactionDetailsService;
import com.ruoyi.model.service.IAppWalletService;
import com.ruoyi.model.service.IAppWithdrawalConfigService;
import com.ruoyi.model.service.ITransactionDetailsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(description = "钱包")
@RestController
@RequestMapping("/applet/wallet")
public class AppletWalletController extends BaseController {

    //钱包
    @Autowired
    private IAppWalletService appWalletService;

    //钱包提现配置
    @Autowired
    private IAppWithdrawalConfigService appWithdrawalConfigService;

    @Autowired
    private IAppTransactionDetailsService appTransactionDetailsService;

    @ApiOperation("钱包列表")
    @GetMapping("/getWalletList/{userId}")
    public TableDataInfo getAppWalletByUserId(@PathVariable Long userId){
        return getDataTable(appWalletService.getAppWalletByUserId(userId));
    }
    @Autowired
    private ITransactionDetailsService transactionDetailsService;

    @ApiOperation("交易明细记录列表")
    @GetMapping("/getTransactionDetailsList")
    public TableDataInfo getTransactionDetailsList(){
        return getDataTable(transactionDetailsService.getTransactionDetailsList());
    }

    @ApiOperation("钱包提现规则")
    @GetMapping("/getAppWithdrawal")
    public AjaxResult getAppWithdrawalConfig(){
        return AjaxResult.success(appWithdrawalConfigService.getAppWithdrawalConfig());
    }

    @ApiOperation("交易明细记录")
    @GetMapping("/getTransactionDetails/{wid}")
    public TableDataInfo getAppTransactionDetailsByWid(@PathVariable Long wid){
        return getDataTable(appTransactionDetailsService.getAppTransactionDetailsByWid(wid));
    }
}
