<?php 
/**
 * Created by PhpStorm.
 * User: chenkuan
 * Date: 2017/11/6
 * Time: 下午6:48
 */

namespace backend\models;


class TransferApi extends BaseApi
{
    public $apiUrl = 'transfer';

    public function transfer($member_id)
    {
        $result = $this->get($this->apiUrl.'/transfer', ['member_id' => $member_id]);
        if ($result['code'] == 1) {
            return $this->returnArray(1, $result['data'], $result['message']);
        } else {
            return $this->returnArray(0, [], $result['message']);
        }
    }

    public function getTransferList($data = [])
    {
        $result = $this->get($this->apiUrl.'/index', $data);
        if ($result['code'] == 1) {
            return $this->returnArray(1, $result['data'], '获取公告记录成功');
        } else {
            return $this->returnArray(0, [], '获取公告记录失败');
        }
    }

    /**
     * 同名转账申请
     */
    public function addTransfer($data = [])
    {
        $result = $this->post($this->apiUrl.'/add-transfer', $data);
        if ($result['code'] == 1) {
            return $this->returnArray(1, $result['data'], $result['message']);
        } else {
            return $this->returnArray(0, [], $result['message']);
        }
    }

    public function updateType($data = [])
    {
        $result = $this->post($this->apiUrl.'/update-type', $data);
        if ($result['code'] == 1) {
            return $this->returnArray(1, $result['data'], '成功');
        } else {
            return $this->returnArray(0, [], $result['message']);
        }
    }

    public function memo($data = [])
    {
        $result = $this->get($this->apiUrl.'/memo', $data);
        if ($result['code'] == 1) {
            return $this->returnArray(1, $result['data'], '成功');
        } else {
            return $this->returnArray(0, [], $result['message']);
        }
    }

    public function memoUpdate($data = [])
    {
        $result = $this->post($this->apiUrl.'/memo-update', $data);
        if ($result['code'] == 1) {
            return $this->returnArray(1, $result['data'], '成功');
        } else {
            return $this->returnArray(0, [], $result['message']);
        }
    }
    
    public function isIbUser($data = [])
    {
        $result = $this->get($this->apiUrl.'/is-ib-user', $data);
        if ($result['code'] == 1) {
            return $this->returnArray(1, $result['data']);
        } else {
            return $this->returnArray(0, [], $result['message']);
        }
    }
    
}

