| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- /**
- * 重庆赤晓店信息科技有限公司
- * https://www.chixiaodian.com
- * Copyright (c) 2023 赤店商城 All rights reserved.
- */
- namespace app\modules\admin\controllers;
- use app\constants\NavbarLink;
- use app\models\AppNavbar;
- use app\models\Option;
- use yii\helpers\Json;
- /**
- * Class NavbarController
- * @package app\modules\admin\controllers
- */
- class NavbarController extends BaseController
- {
- /**
- * 获取默认数据
- */
- public function actionGetInfo()
- {
- $default = [
- 'frontColor' => '#000000',
- 'backgroundColor' => '#ffffff',
- 'bottomBackgroundColor' => '#ffffff',
- ];
- $navigation_bar_color = Option::get('navigation_bar_color', get_store_id(), 'navbar', Json::encode($default));
- $navbar = AppNavbar::getNavbar(get_store_id());
- return $this->asJson([
- 'code' => 0,
- 'data' => [
- 'navbar' => $navbar,
- 'navigation_bar_color' => Json::decode($navigation_bar_color['value']),
- 'link_list' => NavbarLink::getLink()
- ],
- ]);
- }
- public function actionSaveInfo()
- {
- $post = post_params();
- Option::set('navigation_bar_color', Json::encode($post['navigation_bar_color']), get_store_id(), 'navbar');
- Option::set('navbar', Json::encode($post['navbar']), get_store_id(), 'navbar');
- return $this->asJson([
- 'code' => 0,
- 'msg' => '保存成功'
- ]);
- }
- }
|