功能更新

This commit is contained in:
2020-03-30 21:16:28 +08:00
parent b16e4ab920
commit f31f3b99fa
23 changed files with 464 additions and 230 deletions
+10 -13
View File
@@ -69,7 +69,7 @@ class Config extends Base {
ConfigM::update(['value' => $value], ['name' => $key]);
}
//清除db_config_data缓存
cache('system_config_data', null);
Cache::pull('system_config_data');
return $this->success("更新成功!");
} else {
$list = $config->where(array('status' => 1, 'group' => $id))->field('id,name,title,extra,value,remark,type')->order('sort')->select();
@@ -91,7 +91,7 @@ class Config extends Base {
if ($data) {
$result = ConfigM::create($data);
if (false !== $result) {
Cache::pull('db_config_data');
Cache::pull('system_config_data');
return $this->success('新增成功', url('/admin/config/index'));
} else {
return $this->error('新增失败');
@@ -115,8 +115,7 @@ class Config extends Base {
if ($data) {
$result = ConfigM::update($data, array('id' => $data['id']));
if (false !== $result) {
Cache::pull('db_config_data');
//记录行为
Cache::pull('system_config_data');
return $this->success('更新成功', Cookie('__forward__'));
} else {
return $this->error('更新失败!');
@@ -148,7 +147,7 @@ class Config extends Base {
$Config->where($map)->setField('value', $value);
}
}
cache('db_config_data', null);
Cache::pull('system_config_data');
return $this->success('保存成功!');
}
@@ -165,9 +164,7 @@ class Config extends Base {
$map = array('id' => array('in', $id));
if (db('Config')->where($map)->delete()) {
cache('DB_CONFIG_DATA', null);
//记录行为
action_log('update_config', 'config', $id, session('user_auth.uid'));
Cache::pull('system_config_data');
return $this->success('删除成功');
} else {
return $this->error('删除失败!');
@@ -213,9 +210,9 @@ class Config extends Base {
* @title 主题选择
*/
public function themes(ConfigM $config) {
$list = $config->getThemesList();
$pc = config('system_config.pc_themes');
$mobile = config('system_config.mobile_themes');
$list = $config->getThemesList($this->request);
$pc = config('config.pc_themes');
$mobile = config('config.mobile_themes');
$this->data = array(
'pc' => $pc,
@@ -231,9 +228,9 @@ class Config extends Base {
* @return json
*/
public function setthemes($name, $id) {
$result = db('Config')->where('name', $name . '_themes')->setField('value', $id);
$result = ConfigM::where('name', $name . '_themes')->setField('value', $id);
if (false !== $result) {
\think\Cache::clear();
Cache::pull('system_config_data');
return $this->success('设置成功!');
} else {
return $this->error('设置失败!');