<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Config\Driver; use Illuminate\Support\Facades\Cache; use ModStart\Core\Config\MConfig; use ModStart\Core\Dao\ModelUtil; class DatabaseMConfig extends MConfig { const CACHE_PREFIX = 'config:'; public function get($ax5t3, $eS4om = '', $G9CrC = true) { goto PGBZC; y4FXM: if ($G9CrC) { $FT9zA = Cache::get($lt4bP); if (null !== $FT9zA) { if (null === $FT9zA || '' === $FT9zA) { return $eS4om; } return $FT9zA; } } goto aa5cV; iPLjR: $FT9zA = null; goto y4FXM; JPljm: return $eS4om; goto VsKlC; PGBZC: $lt4bP = self::CACHE_PREFIX . $ax5t3; goto iPLjR; aa5cV: if (null === $FT9zA) { $b1rpR = ModelUtil::get('config', array('key' => $ax5t3)); if ($b1rpR) { goto MWf9h; MWf9h: Cache::forever($lt4bP, $b1rpR['value']); goto L3MsI; HVDBA: return $b1rpR['value']; goto K0kxV; L3MsI: if (null === $b1rpR['value'] || '' === $b1rpR['value']) { return $eS4om; } goto HVDBA; K0kxV: } else { Cache::forever($lt4bP, $eS4om); } } goto JPljm; VsKlC: } public function set($ax5t3, $FT9zA) { goto bYVyV; bYVyV: $b1rpR = ModelUtil::get('config', array('key' => $ax5t3)); goto ROJ9M; ROJ9M: if ($b1rpR) { ModelUtil::update('config', array('id' => $b1rpR['id']), array('value' => $FT9zA)); } else { ModelUtil::insert('config', array('key' => $ax5t3, 'value' => $FT9zA)); } goto bSyfM; bSyfM: $lt4bP = self::CACHE_PREFIX . $ax5t3; goto RHIRy; RHIRy: Cache::forget($lt4bP); goto C_XZe; C_XZe: } public function remove($ax5t3) { goto ZclZp; AfD3j: if ($b1rpR) { ModelUtil::delete('config', array('id' => $b1rpR['id'])); } goto Uklhq; ZclZp: $b1rpR = ModelUtil::get('config', array('key' => $ax5t3)); goto AfD3j; Pv9V4: Cache::forget($lt4bP); goto dQ8Mz; Uklhq: $lt4bP = self::CACHE_PREFIX . $ax5t3; goto Pv9V4; dQ8Mz: } }