Browse Source

网站配置

lizhen_gitee 10 months ago
parent
commit
1bc63b58af

+ 46 - 0
application/admin/controller/general/Config.php

@@ -86,6 +86,52 @@ class Config extends Backend
         $this->view->assign('groupList', ConfigModel::getGroupList());
         return $this->view->fetch();
     }
+    public function newindex()
+    {
+        $siteList = [];
+        $groupList = ConfigModel::newgetGroupList();
+        foreach ($groupList as $k => $v) {
+            $siteList[$k]['name'] = $k;
+            $siteList[$k]['title'] = $v;
+            $siteList[$k]['list'] = [];
+        }
+
+        foreach ($this->model->all() as $k => $v) {
+            if (!isset($siteList[$v['group']])) {
+                continue;
+            }
+            $value = $v->toArray();
+            $value['title'] = __($value['title']);
+            if (in_array($value['type'], ['select', 'selects', 'checkbox', 'radio'])) {
+                $value['value'] = explode(',', $value['value']);
+            }
+            $value['content'] = json_decode($value['content'], true);
+            if (in_array($value['name'], ['categorytype', 'configgroup', 'attachmentcategory'])) {
+                $dictValue = (array)json_decode($value['value'], true);
+                foreach ($dictValue as $index => &$item) {
+                    $item = __($item);
+                }
+                unset($item);
+                $value['value'] = json_encode($dictValue, JSON_UNESCAPED_UNICODE);
+            }
+            $value['tip'] = htmlspecialchars($value['tip']);
+            if ($value['name'] == 'cdnurl') {
+                //cdnurl不支持在线修改
+                continue;
+            }
+            $siteList[$v['group']]['list'][] = $value;
+        }
+        $index = 0;
+        foreach ($siteList as $k => &$v) {
+            $v['active'] = !$index ? true : false;
+            $index++;
+        }
+        $this->view->assign('siteList', $siteList);
+        $this->view->assign('typeList', ConfigModel::getTypeList());
+        $this->view->assign('ruleList', ConfigModel::getRegexList());
+        $this->view->assign('groupList', ConfigModel::getGroupList());
+        return $this->view->fetch();
+    }
 
     /**
      * 添加

+ 8 - 0
application/common/model/Config.php

@@ -103,6 +103,14 @@ class Config extends Model
         }
         return $groupList;
     }
+    public static function newgetGroupList()
+    {
+        $groupList = config('newconfiggroup');
+        foreach ($groupList as $k => &$v) {
+            $v = __($v);
+        }
+        return $groupList;
+    }
 
     public static function getArrayData($data)
     {

+ 6 - 0
application/config.php

@@ -354,6 +354,12 @@ return [
         'SecretKey' => '',
     ],
 
+    'newconfiggroup' =>    [
+        'siteconfig' => '网站配置',
+        'takecash' => '提现配置',
+        'wenzhen' => '问诊配置',
+    ],
+
     //腾讯cos
     /*'cos'                  => [
         'appid' => '',