admin/model/setting/store.php
(开头部分) 4KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
class ModelSettingStore extends Model {
public function addStore($data) {
$this->db->query("INSERT INTO " . DB_PREFIX . "store SET name = '" . $this->db->escape((string)$data['config_name']) . "', `url` = '" . $this->db->escape((string)$data['config_url']) . "'");
$store_id = $this->db->getLastId();
// Layout Route
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "layout_route WHERE store_id = '0'");
foreach ($query->rows as $layout_route) {
$this->db->query("INSERT INTO " . DB_PREFIX . "layout_route SET layout_id = '" . (int)$layout_route['layout_id'] . "', route = '" . $this->db->escape($layout_route['route']) . "', store_id = '" . (int)$store_id . "'");
}
$this->cache->delete('store');
return $store_id;
}
public function editStore($store_id, $data) {
$this->db->query("UPDATE " . DB_PREFIX . "store SET name = '" . $this->db->escape((string)$data['config_name']) . "', `url` = '" . $this->db->escape((string)$data['config_url']) . "' WHERE store_id = '" . (int)$store_id . "'");
$this->cache->delete('store');
}
public function deleteStore($store_id) {
$this->db->query("DELETE FROM " . DB_PREFIX . "store WHERE store_id = '" . (int)$store_id . "'");
$this->db->query("DELETE FROM " . DB_PREFIX . "layout_route WHERE store_id = '" . (int)$store_id . "'");
$this->cache->delete('store');
}
public function getStore($store_id) {
$query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "store WHERE store_id = '" . (int)$store_id . "'");
return $query->row;
}
public function getStores($data = array()) {
$store_data = $this->cache->get('store');
if (!$store_data) {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "store ORDER BY url");
$store_data = $query->rows;
$this->cache->set('store', $store_data);
}
return $store_data;
}
public function getTotalStores() {
$query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "store");
return $query->row['total'];
}
public function getTotalStoresByLayoutId($layout_id) {
$query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "setting WHERE `key` = 'config_layout_id' AND `value` = '" . (int)$layout_id . "' AND store_id != '0'");
后面还有 48 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
