<?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($l6tBV, $dMLhR = '', $hNo8v = true) { goto g1H0I; MttB9: return $dMLhR; goto ZZdno; qzosO: $Mczr_ = null; goto oXDIZ; XOoqB: $iC2Yt = self::CACHE_PREFIX . $l6tBV; goto qzosO; g1H0I: if (null === $dMLhR) { $dMLhR = ''; } goto XOoqB; GhsaN: if (null === $Mczr_) { $ts6kE = ModelUtil::get('config', array('key' => $l6tBV)); if ($ts6kE) { goto Szfhx; Szfhx: Cache::forever($iC2Yt, $ts6kE['value']); goto X2AuS; X2AuS: if (null === $ts6kE['value'] || '' === $ts6kE['value']) { return $dMLhR; } goto kpUj9; kpUj9: return $ts6kE['value']; goto Olcec; Olcec: } else { Cache::forever($iC2Yt, $dMLhR); } } goto MttB9; oXDIZ: if ($hNo8v) { $Mczr_ = Cache::get($iC2Yt); if (null !== $Mczr_) { if (null === $Mczr_ || '' === $Mczr_) { return $dMLhR; } return $Mczr_; } } goto GhsaN; ZZdno: } public function set($l6tBV, $Mczr_) { goto mprqf; rBYh4: Cache::forget($iC2Yt); goto ujO0J; tH3my: $iC2Yt = self::CACHE_PREFIX . $l6tBV; goto rBYh4; mprqf: $ts6kE = ModelUtil::get('config', array('key' => $l6tBV)); goto ingHD; ingHD: if ($ts6kE) { ModelUtil::update('config', array('id' => $ts6kE['id']), array('value' => $Mczr_)); } else { ModelUtil::insert('config', array('key' => $l6tBV, 'value' => $Mczr_)); } goto tH3my; ujO0J: } public function remove($l6tBV) { goto KParh; KParh: $ts6kE = ModelUtil::get('config', array('key' => $l6tBV)); goto CuIyU; CuIyU: if ($ts6kE) { ModelUtil::delete('config', array('id' => $ts6kE['id'])); } goto IwWqv; IwWqv: $iC2Yt = self::CACHE_PREFIX . $l6tBV; goto d9g8x; d9g8x: Cache::forget($iC2Yt); goto aWG4Z; aWG4Z: } public function has($l6tBV) { $ts6kE = ModelUtil::get('config', array('key' => $l6tBV)); return !!$ts6kE; } }