<?php
namespace backend\models;

use Yii;

class LogsApi extends BaseApi
{
    public $apiUrl = 'logs';
    
    /**
     * 日志列表
     * @param array $data
     * @return array
     */
    public function getList($data)
    {
        $result = $this->post($this->apiUrl . '/list', $data);
        if ($result['code'] == 1) {
            return $this->returnArray(1, $result['data']);
        } else {
            return $this->returnArray(0, [], $result['message']);
        }
    }

    /**
     * 查看日志
     * @param array $data
     * @return array
     */
    public function view($data)
    {
        $result = $this->get($this->apiUrl . '/view', $data);
        if ($result['code'] == 1) {
            return $this->returnArray(1, $result['data'], $result['message']);
        } else {
            return $this->returnArray(0, $result['data'], $result['message']);
        }
    }

    /**
     * 清空日志
     * @param array $data
     * @return array
     */
    public function truncate($data)
    {
        $result = $this->get($this->apiUrl . '/truncate', $data);
        if ($result['code'] == 1) {
            return $this->returnArray(1, $result['data'], $result['message']);
        } else {
            return $this->returnArray(0, $result['data'], $result['message']);
        }
    }

}