<?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($rvTrU, $K5eKM = '', $ewYo6 = true) { goto Y0jm1; khBjE: $gwXrh = null; goto F1S0Z; X0Cut: return $K5eKM; goto qFji7; bI34U: if (null === $gwXrh) { $eYjRX = ModelUtil::get('config', array('key' => $rvTrU)); if ($eYjRX) { goto eNt_g; QZXIX: return $eYjRX['value']; goto bz8Fu; eNt_g: Cache::forever($zMpTQ, $eYjRX['value']); goto VSdT9; VSdT9: if (null === $eYjRX['value'] || '' === $eYjRX['value']) { return $K5eKM; } goto QZXIX; bz8Fu: } else { Cache::forever($zMpTQ, $K5eKM); } } goto X0Cut; Y0jm1: if (null === $K5eKM) { $K5eKM = ''; } goto FjyBj; F1S0Z: if ($ewYo6) { $gwXrh = Cache::get($zMpTQ); if (null !== $gwXrh) { if (null === $gwXrh || '' === $gwXrh) { return $K5eKM; } return $gwXrh; } } goto bI34U; FjyBj: $zMpTQ = self::CACHE_PREFIX . $rvTrU; goto khBjE; qFji7: } public function set($rvTrU, $gwXrh) { goto EPmTu; Zi9KN: Cache::forget($zMpTQ); goto KdXAt; EPmTu: $eYjRX = ModelUtil::get('config', array('key' => $rvTrU)); goto lSd4j; svolU: $zMpTQ = self::CACHE_PREFIX . $rvTrU; goto Zi9KN; lSd4j: if ($eYjRX) { ModelUtil::update('config', array('id' => $eYjRX['id']), array('value' => $gwXrh)); } else { ModelUtil::insert('config', array('key' => $rvTrU, 'value' => $gwXrh)); } goto svolU; KdXAt: } public function remove($rvTrU) { goto FyrYh; ksOs2: $zMpTQ = self::CACHE_PREFIX . $rvTrU; goto danD5; t0kuF: if ($eYjRX) { ModelUtil::delete('config', array('id' => $eYjRX['id'])); } goto ksOs2; danD5: Cache::forget($zMpTQ); goto i8SMu; FyrYh: $eYjRX = ModelUtil::get('config', array('key' => $rvTrU)); goto t0kuF; i8SMu: } public function has($rvTrU) { $eYjRX = ModelUtil::get('config', array('key' => $rvTrU)); return !!$eYjRX; } }