<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/12/5/005
 * Time: 9:47
 */

namespace backend\models;


class ConfigApi extends BaseApi
{
    public $apiUrl = 'config';

    public function getConfig($data = [])
    {
        $result = $this->get($this->apiUrl.'/get-config', $data);
        if ($result['code'] == 1) {
            return $this->returnArray(1, $result['data'], '获取配置详情成功');
        } else {
            return $this->returnArray(0, [], $result['message']);
        }
    }

    public function update($data = [])
    {
        $result = $this->post($this->apiUrl.'/update', $data);
        if ($result['code'] == 1) {
            return $this->returnArray(1, $result['data'], $result['message']);
        } else {
            return $this->returnArray(0, [], '更新失败');
        }
    }
    
    public function clearCache()
    {
        $result = $this->get($this->apiUrl.'/clear-cache');
        if ($result['code'] == 1) {
            return $this->returnArray(1, $result['data'], $result['message']);
        } else {
            return $this->returnArray(0, [], '更新失败');
        }
    }
}