<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace app\controller;

use app\BaseController;
use think\facade\Cache;
use app\services\system\DictionaryService;

class Base extends BaseController{
	
	public $data = ['code' => 1, 'data' => '', 'message' => ''];

	public function initialize(){
		$this->cacheData($this->request); //缓存基础数据
	}

	protected function cacheData($request) {
		$diction = Cache::get('diction');
		if(!$diction){
			$service = app()->make(DictionaryService::class);
			$data = $service->getDictionaryAll();
			Cache::set('diction', $data);
		}
	}
}