diff --git a/application/index/controller/Admin.php b/application/index/controller/Admin.php index 42772db45687ec8dc83c272f039653a1f2e1e31f..87408591e205548b03cca7dbc416efa09d8a30b0 100644 --- a/application/index/controller/Admin.php +++ b/application/index/controller/Admin.php @@ -102,6 +102,15 @@ class Admin extends Controller{ ]); } + public function Color(){ + $options = Option::getValues(["basic"]); + return view('color', [ + 'options' => $this->siteOptions, + 'optionsForSet' => $options, + 'colors'=> \json_decode($options["themes"],true) + ]); + } + public function Theme(){ $fileName=input("?param.name") ? input("param.name") : "error"; $dir = ROOT_PATH."application/index/view/"; @@ -141,6 +150,10 @@ class Admin extends Controller{ return $this->adminObj->saveThemeFile(input('post.')); } + public function SaveColorSetting(){ + return $this->adminObj->saveColorSetting(input('post.')); + } + public function SettingMail(){ return view('mail_setting', [ 'options' => $this->siteOptions, @@ -344,7 +357,7 @@ class Admin extends Controller{ } public function DeleteShareMultiple(){ - return $this->adminObj->deleteShare(json_decode(input('post.id'),true)); + return $this->adminObj->deleteShare(\json_decode(input('post.id'),true)); } public function DeleteMultiple(){ @@ -380,7 +393,7 @@ class Admin extends Controller{ } public function DeleteUsers(){ - $uidGroup = json_decode(input('post.id'),true); + $uidGroup = \json_decode(input('post.id'),true); foreach ($uidGroup as $key => $value) { $this->adminObj->deleteUser($value,$this->userObj->uid); } @@ -468,7 +481,7 @@ class Admin extends Controller{ } public function About(){ - $verison = json_decode(file_get_contents(ROOT_PATH . "application/version.json"),true); + $verison = \json_decode(file_get_contents(ROOT_PATH . "application/version.json"),true); return view('about', [ 'options' => $this->siteOptions, 'programVersion' => $verison, @@ -477,7 +490,7 @@ class Admin extends Controller{ } public function Purchase(){ - $packData = json_decode(Option::getValue("pack_data"),true); + $packData = \json_decode(Option::getValue("pack_data"),true); return view('purchase', [ 'options' => $this->siteOptions, 'pack' => $packData, @@ -494,7 +507,7 @@ class Admin extends Controller{ } public function PurchaseGroup(){ - $groupData = json_decode(Option::getValue("group_sell_data"),true); + $groupData = \json_decode(Option::getValue("group_sell_data"),true); foreach ($groupData as $key => $value) { $groupData[$key]["group"] = Db::name("groups")->where("id",$value["goup_id"])->find(); } diff --git a/application/index/controller/Callback.php b/application/index/controller/Callback.php index 10ae2fea0e7cb3af0f9f555d294e488e90c1e60c..e934e4701ad6b36e0a363de91d70a95c309a1057 100644 --- a/application/index/controller/Callback.php +++ b/application/index/controller/Callback.php @@ -25,7 +25,6 @@ class Callback extends Controller{ public function Oss(){ ob_end_clean(); - error_log("sadasdasdsadsasadasasdasdasd"); header('Content-Type: application/json'); $handllerObj = new CallbackHandler(file_get_contents("php://input")); $handllerObj -> ossHandler(Request::instance()->header('Authorization'),Request::instance()->header('x-oss-pub-key-url')); diff --git a/application/index/model/AdminHandler.php b/application/index/model/AdminHandler.php index e26885ba080ca56360e61c2adcb36426ff608751..6698f98673e88df054a93d586be5b3a388a05391 100644 --- a/application/index/model/AdminHandler.php +++ b/application/index/model/AdminHandler.php @@ -102,6 +102,37 @@ class AdminHandler extends Model{ return $this->saveOptions($options); } + public function saveColorSetting($options){ + $colorOptions = []; + foreach ($options["color"] as $key => $value) { + $color = \json_decode($value,true); + $validate = ($color!==null)&&array_key_exists("palette",$color) && + array_key_exists("common",$color["palette"]) && + array_key_exists("black",$color["palette"]["common"]) && + array_key_exists("white",$color["palette"]["common"]) && + array_key_exists("background",$color["palette"]) && + array_key_exists("primary",$color["palette"]) && + array_key_exists("secondary",$color["palette"]) && + array_key_exists("error",$color["palette"]) && + array_key_exists("text",$color["palette"]) && + array_key_exists("explorer",$color["palette"]) && + array_key_exists("main",$color["palette"]["primary"]) && + array_key_exists("main",$color["palette"]["secondary"]); + if(!$validate){ + return ["error"=>1,"msg"=>"第 ".($key+1)." 行配色方案格式有误"]; + } + $colorOptions[$color["palette"]["primary"]["main"]] = $color; + } + if(!array_key_exists($options["header"],$colorOptions)){ + return ["error"=>1,"msg"=>"第 ".($key+1)." 默认配色不存在"]; + } + $optionsForSet = [ + "defaultTheme" => $options["header"], + "themes" => json_encode($colorOptions), + ]; + return $this->saveOptions($optionsForSet); + } + public function saveRegSetting($options){ foreach(["email_active","login_captcha","reg_captcha","forget_captcha"] as $key){ $options[$key] = array_key_exists($key,$options) ? $options[$key] : 0; diff --git a/application/index/view/admin/color.html b/application/index/view/admin/color.html new file mode 100644 index 0000000000000000000000000000000000000000..2c0bb9041d6f587fba866085cd7b65bac543a9a7 --- /dev/null +++ b/application/index/view/admin/color.html @@ -0,0 +1,98 @@ +{extend name="header_admin" /} +{block name="title"}基础设置- {$options.siteName}{/block} +{block name="content"} +
+
+ + + + +
+
+

配色方案

+ +
+
+
+
+
+ +
+
+
+
+
+ +
+
+ + + + + + + + + {volist name="colors" id="theme"} + + + + + {/volist} + + +
主色调颜色配置
{$key} +
+
+
+ +
+
+
+
+
+
+
+

+
+
+ + +

+
+
+
+ +
+
+ +
+
+
+ + +
+ +
+{/block} +{block name="js"} + + +{/block} \ No newline at end of file diff --git a/application/index/view/error.html b/application/index/view/error.html index 806ca31db7924a063053f087de8690cdf282ced6..94fcf7d30747e3bd5dc94975a90e32e40db5db50 100644 --- a/application/index/view/error.html +++ b/application/index/view/error.html @@ -1,4 +1,3 @@ - diff --git a/application/index/view/header_admin.html b/application/index/view/header_admin.html index 4966556ceb8bfc9a5879508fb29e713d9d9a2772..33a235317e0883502f249f83ff28333c99b24fe7 100644 --- a/application/index/view/header_admin.html +++ b/application/index/view/header_admin.html @@ -58,11 +58,19 @@ -