<?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($dwwIV, $UZN94 = '', $qxmvG = true) { goto G7TXq; qWOdL: $WmDRX = self::CACHE_PREFIX . $dwwIV; goto bQ2Ml; mSVYt: if ($qxmvG) { $wvO30 = Cache::get($WmDRX); if (null !== $wvO30) { if (null === $wvO30 || '' === $wvO30) { return $UZN94; } return $wvO30; } } goto w1Fre; CPWI3: return $UZN94; goto HCqm3; G7TXq: if (null === $UZN94) { $UZN94 = ''; } goto qWOdL; bQ2Ml: $wvO30 = null; goto mSVYt; w1Fre: if (null === $wvO30) { $jmXHX = ModelUtil::get('config', array('key' => $dwwIV)); if ($jmXHX) { goto xP6rZ; NI48y: if (null === $jmXHX['value'] || '' === $jmXHX['value']) { return $UZN94; } goto CBFjI; xP6rZ: Cache::forever($WmDRX, $jmXHX['value']); goto NI48y; CBFjI: return $jmXHX['value']; goto J7vBd; J7vBd: } else { Cache::forever($WmDRX, $UZN94); } } goto CPWI3; HCqm3: } public function set($dwwIV, $wvO30) { goto MlsuD; t5eOJ: $WmDRX = self::CACHE_PREFIX . $dwwIV; goto Im1oE; MlsuD: $jmXHX = ModelUtil::get('config', array('key' => $dwwIV)); goto a9Tqb; Im1oE: Cache::forget($WmDRX); goto hP9KH; a9Tqb: if ($jmXHX) { ModelUtil::update('config', array('id' => $jmXHX['id']), array('value' => $wvO30)); } else { ModelUtil::insert('config', array('key' => $dwwIV, 'value' => $wvO30)); } goto t5eOJ; hP9KH: } public function remove($dwwIV) { goto iee62; iee62: $jmXHX = ModelUtil::get('config', array('key' => $dwwIV)); goto N4E51; N4E51: if ($jmXHX) { ModelUtil::delete('config', array('id' => $jmXHX['id'])); } goto OMNkb; TT0kK: Cache::forget($WmDRX); goto ndjkF; OMNkb: $WmDRX = self::CACHE_PREFIX . $dwwIV; goto TT0kK; ndjkF: } public function has($dwwIV) { $jmXHX = ModelUtil::get('config', array('key' => $dwwIV)); return !!$jmXHX; } }