From a5be1563081340a692dd34491d778aa192d93eae Mon Sep 17 00:00:00 2001 From: liugang Date: Fri, 8 Nov 2024 09:23:59 +0800 Subject: [PATCH] * [refac] optimize error message. --- lib/cache/cache.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/cache/cache.class.php b/lib/cache/cache.class.php index 7454cc8831..1898a0a273 100644 --- a/lib/cache/cache.class.php +++ b/lib/cache/cache.class.php @@ -356,7 +356,7 @@ class cache /* 获取新增的数据。Get the new data. */ $object = $this->dao->select('*')->from($this->table)->where('id')->eq($objectID)->fetch(); - if(!$object) return $this->log('Failed to fetch the new object. The sql is: ' . $this->dao->get(), __FILE__, __LINE__); + if(!$object) return $this->log('Failed to fetch new object. The sql is: ' . $this->dao->get(), __FILE__, __LINE__); /* 把新增的数据保存到缓存中。Save the new data to cache. */ $rawCacheKey = $this->getRawCacheKey($code, $object->$field); @@ -475,7 +475,7 @@ class cache $key = $this->getResCacheKey($res->name); foreach($res->fields as $field) { - if(!isset($object->$field)) return $this->log("The {$field} field does not exist in table {$this->table}.", __FILE__, __LINE__); + if(!isset($object->$field)) return $this->log("Field {$field} does not exist in table {$this->table}.", __FILE__, __LINE__); $key .= $this->connector . $object->$field; } @@ -594,7 +594,7 @@ class cache */ public function fetch(string $table, int|string $id): object|bool { - if(!$this->checkTable($table)) return $this->log("The {$table} table is not set in the cache configuration", __FILE__, __LINE__); + if(!$this->checkTable($table)) return $this->log("Table {$table} is not set in the cache configuration", __FILE__, __LINE__); if(empty($table)) return $this->log('The table name is empty', __FILE__, __LINE__); if(empty($id)) return $this->log('The id is empty', __FILE__, __LINE__); @@ -671,7 +671,7 @@ class cache */ public function key($key, ...$args) { - if(empty($this->config->cache->keys[$key])) return $this->log("The {$key} key is not defined", __FILE__, __LINE__); + if(empty($this->config->cache->keys[$key])) return $this->log("Key {$key} is not defined", __FILE__, __LINE__); $cache = $this->config->cache->keys[$key]; if(!empty($cache->fields) && !empty($args)) @@ -679,7 +679,7 @@ class cache $tableFields = $this->dao->descTable($cache->table); foreach($cache->fields as $index => $field) { - if(!isset($tableFields[$field])) return $this->log("The {$field} field does not exist in table {$cache->table}", __FILE__, __LINE__); + if(!isset($tableFields[$field])) return $this->log("Field {$field} does not exist in table {$cache->table}", __FILE__, __LINE__); if(!isset($args[$index])) continue; $tableField = $tableFields[$field]; @@ -785,7 +785,7 @@ class cache public function saveByLabel(string $label, $value) { if(empty($label)) return $this->log('The label is empty', __FILE__, __LINE__); - if(empty($this->labels[$label])) return $this->log("The {$label} label is not set", __FILE__, __LINE__); + if(empty($this->labels[$label])) return $this->log("Label {$label} does not exist", __FILE__, __LINE__); return $this->cache->set($this->labels[$label], $value); }