<?php
/**
 * Created by PhpStorm.
 * User: tandunzhao
 * Date: 2017/12/6
 * Time: 下午7:13
 */

namespace App\Http\Controllers\Channel\Finance;


use App\Http\Controllers\Channel\Finance\Transformers\BankTransformer;
use App\Modules\Finance\Services\BankService;
use Illuminate\Http\Request;

class BankController extends BaseController
{


    /**
     * @apiDefine Finance 结算提现模块
     */


    /**
     * @apiVersion 1.0.0
     * @apiDescription 获取银行列表
     * @api {GET} banks 获取银行列表
     * @apiGroup Finance
     * @apiName banks
     * @apiSuccess   {Number}  id 姓名.
     * @apiSuccess   {String}  name 银行名称.
     * @apiSuccess   {String}  code 银行编号.
     * @apiSuccess   {String}  source 渠道支付来源.通联支付，连连支付
     * @apiSuccessExample {json} Success-Response:
     *
     *     {
     *         "code": 0,
     *         "msg": "",
     *         "data":[
     *              {
     *                   "id": 1,
     *                   "name": "中国邮政储蓄银行",
     *                   "code": "100",
     *                   "source": "通连支付"
     *               }
     *          ]
     *     }
     */
    function getBankList(Request $request)
    {
        //$channel_id = $this->getChannelId();
        //$channel_name = $this->getChannelName();
        //$banks = BankService::getBankList(ChannelService::getChannelBankSourceById($channel_id));
        $banks = BankService::getBankList(config('common.lianlianpay'));

        return response()->collection(new BankTransformer(), $banks);
    }

}