<?php
namespace backend\controllers;

use backend\models\Member;
use Yii;
use backend\models\MemberBankInfo;

/**
 * 银行卡信息
 */
class MemberBankInfoController extends BaseController
{
    
    /**
     * 修改银行卡信息
     */
    public function actionUpdate()
    {
        $model = new MemberBankInfo();
        $result = $model->updateBankInfo(Yii::$app->request->post());
        if ($result['code']) {
            return $this->outJson(1, $result['data'], $result['message']);
        } else {
            return $this->outJson(0, [], $result['message']);
        }
    }
    
    /**
     * 获取银行卡信息
     */
    public function actionGetBankInfo()
    {
        $member_id = (int) Yii::$app->request->post('member_id');
        $bank_info = MemberBankInfo::getBankInfoByMemberId($member_id);
        if ($bank_info) {
            return $this->outJson(1, $bank_info);
        } else {
            return $this->outJson(0);
        }
    }
    
}


