1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-08-10 00:11:38 +08:00

纠正单词评选错误

This commit is contained in:
xiaochong0302 2023-05-12 18:52:11 +08:00
parent 7322d1fc0d
commit e3e5d20a7c
2 changed files with 6 additions and 6 deletions

View File

@ -11,7 +11,7 @@ trait PageTrait
protected function insertPages(array $rows) protected function insertPages(array $rows)
{ {
foreach ($rows as $key => $row) { foreach ($rows as $key => $row) {
$exists = $this->pageExits($row['alias']); $exists = $this->pageExists($row['alias']);
if ($exists) unset($rows[$key]); if ($exists) unset($rows[$key]);
} }
@ -20,7 +20,7 @@ trait PageTrait
$this->table('kg_page')->insert($rows)->save(); $this->table('kg_page')->insert($rows)->save();
} }
protected function pageExits($alias) protected function pageExists($alias)
{ {
$row = $this->getQueryBuilder() $row = $this->getQueryBuilder()
->select('*') ->select('*')
@ -28,7 +28,7 @@ trait PageTrait
->where(['alias' => $alias]) ->where(['alias' => $alias])
->execute()->fetch(); ->execute()->fetch();
return $row ? true : false; return (bool)$row;
} }
} }

View File

@ -11,7 +11,7 @@ trait SettingTrait
protected function insertSettings(array $rows) protected function insertSettings(array $rows)
{ {
foreach ($rows as $key => $row) { foreach ($rows as $key => $row) {
$exists = $this->settingExits($row['section'], $row['item_key']); $exists = $this->settingExists($row['section'], $row['item_key']);
if ($exists) unset($rows[$key]); if ($exists) unset($rows[$key]);
} }
@ -20,7 +20,7 @@ trait SettingTrait
$this->table('kg_setting')->insert($rows)->save(); $this->table('kg_setting')->insert($rows)->save();
} }
protected function settingExits($section, $itemKey) protected function settingExists($section, $itemKey)
{ {
$row = $this->getQueryBuilder() $row = $this->getQueryBuilder()
->select('*') ->select('*')
@ -28,7 +28,7 @@ trait SettingTrait
->where(['section' => $section, 'item_key' => $itemKey]) ->where(['section' => $section, 'item_key' => $itemKey])
->execute()->fetch(); ->execute()->fetch();
return $row ? true : false; return (bool)$row;
} }
} }