<?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($jPfeB, $pdVyN = '', $ElyDV = true) { goto omicR; omicR: if (null === $pdVyN) { $pdVyN = ''; } goto OsBGY; OsBGY: $qaqkm = self::CACHE_PREFIX . $jPfeB; goto h2mgA; HmGho: if (null === $Gttsd) { $O348k = ModelUtil::get('config', array('key' => $jPfeB)); if ($O348k) { goto o2PuD; Nsq_X: return $O348k['value']; goto mbEGZ; sG17j: if (null === $O348k['value'] || '' === $O348k['value']) { return $pdVyN; } goto Nsq_X; o2PuD: Cache::forever($qaqkm, $O348k['value']); goto sG17j; mbEGZ: } else { Cache::forever($qaqkm, $pdVyN); } } goto TN5n6; TN5n6: return $pdVyN; goto hCoHN; LxBRg: if ($ElyDV) { $Gttsd = Cache::get($qaqkm); if (null !== $Gttsd) { if (null === $Gttsd || '' === $Gttsd) { return $pdVyN; } return $Gttsd; } } goto HmGho; h2mgA: $Gttsd = null; goto LxBRg; hCoHN: } public function set($jPfeB, $Gttsd) { goto w2urw; rwsah: if ($O348k) { ModelUtil::update('config', array('id' => $O348k['id']), array('value' => $Gttsd)); } else { ModelUtil::insert('config', array('key' => $jPfeB, 'value' => $Gttsd)); } goto FyJL8; hkF9x: Cache::forget($qaqkm); goto j8qfZ; FyJL8: $qaqkm = self::CACHE_PREFIX . $jPfeB; goto hkF9x; w2urw: $O348k = ModelUtil::get('config', array('key' => $jPfeB)); goto rwsah; j8qfZ: } public function remove($jPfeB) { goto RECTP; Gpj7E: $qaqkm = self::CACHE_PREFIX . $jPfeB; goto ncbxY; WJuVq: if ($O348k) { ModelUtil::delete('config', array('id' => $O348k['id'])); } goto Gpj7E; RECTP: $O348k = ModelUtil::get('config', array('key' => $jPfeB)); goto WJuVq; ncbxY: Cache::forget($qaqkm); goto JmPsU; JmPsU: } public function has($jPfeB) { $O348k = ModelUtil::get('config', array('key' => $jPfeB)); return !!$O348k; } }