package com.ruoyi.web.app;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ruoyi.bst.channel.service.ChannelService;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;

import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("/app/channel")
public class AppChannelController extends BaseController {

    @Autowired
    private ChannelService channelService;

    @ApiOperation("获取可用支付渠道列表")
    @GetMapping("/list")
    @Anonymous
    public AjaxResult list(Long areaId, Long appId, String bstType) {
        Long userId = null;
        try {
            userId = getUserId();
        } catch (Exception e) {
            userId = null;
        }
        return success(channelService.selectPayChannelList(userId, areaId, appId, bstType));
    }

    @ApiOperation("获取骑行费可用的支付渠道")
    @GetMapping("/rideFee")
    public AjaxResult rideFeeChannel(Long orderId) {
        return success(channelService.getRideFeePayChannelList(orderId));
    }
}
