$zym_1 ) { if ( in_array( $zym_2, $FIELDS ) ) { $model = $configModel->getOne( array( "where" => "`config_name`='".$zym_2."'" ) ); $config_value = serialize( $zym_1 ); if ( $model ) { if ( $model->config_value != $config_value ) { $model->config_value = $config_value; $model->update( ); } } else { $model = new MilConfig( ); $model->config_name = $zym_2; $model->config_value = $config_value; $model->config_group = $GROUP; $model->insert( ); } } } ( $GROUP ); } public static function loadConfig( $GROUP = "system" ) { $configModel = new MilConfig( ); $models = $configModel->find( array( "where" => "`config_group`='".$GROUP."'" ) ); $FIELDS = ( $GROUP ); $datas = array( ); foreach ( $FIELDS as $Field ) { $datas[$Field] = ""; } foreach ( $models as $model ) { if ( isset( $datas[$model->config_name] ) ) { $datas[$model->config_name] = unserialize( @$model->config_value ); } } return $datas; } public static function getGroupFields( $GROUP = "system" ) { $FIELDS = array( "system" => array( "siteTitle", "siteKeywords", "siteDescription", "siteFooter", "siteWelcome", "wordTitle", "wordKeywords", "wordDescription", "wordWelcome", "wordFooter", "clickUrl", "taodianjinPid", "searchFormType", "goodsCacheTime", "indexCacheTime" ), "app" => array( "currentVersion" ), "api" => array( "apiUsername", "apiPassword" ), "ad" => array( "topMenu", "indexTopAd" ) ); if ( isset( $FIELDS[$GROUP] ) ) { return $FIELDS[$GROUP]; } return array( ); } public static function updateCache( $GROUP = "system" ) { $configs = ( $GROUP ); ( )->setIn( "config", $GROUP, $configs ); } public static function loadCache( $GROUP ) { $configs = ( )->getIn( "config", $GROUP ); if ( $configs ) { return $configs; } return ( $GROUP ); } public static function loadApiConfig( ) { $configs = ( "api" ); if ( isset( $configs['apiUsername'], $configs['apiUsername'] ) ) { exit( "no api config!" ); } return $configs; } } ?>