<?php
namespace backend\models;

use Yii;

class PasswordApi extends BaseApi
{
    public $apiUrl = 'password';

    /**
     * @param array $data
     * @param int $type
     * @return array
     */
    public function changePassword($data, $type)
    {
        $data['member_id']  = Yii::$app->user->id;
        $data['type'] = $type;
        $result = $this->post($this->apiUrl . '/change-password', $data);
        if ($result['code'] == 1) {
            return $this->returnArray(1, $result['data']);
        } else {
            return $this->returnArray(0, [], $result['message']);
        }
    }
    
}