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.IAppBondConfigService;
import com.ruoyi.model.service.IAppDepositService;
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/bond")
public class AppletBondController extends BaseController {

    @Autowired
    private IAppBondConfigService appBondConfigService;

    @Autowired
    private IAppDepositService appDepositService;

    @ApiOperation("保证金规则")
    @GetMapping("/bondConfig")
    public AjaxResult getAppBondConfig(){
        return AjaxResult.success(appBondConfigService.getAppBondConfig());
    }

    @ApiOperation("保证金记录")
    @GetMapping("/getDeposit{userId}")
    public TableDataInfo getDepositByUserId(@PathVariable Long userId){
        return getDataTable(appDepositService.getAppDepositListByUserId(userId));
    }
}
