123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- <?php
- // +----------------------------------------------------------------------
- // | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
- // +----------------------------------------------------------------------
- // | Copyright (c) 2017~2021 https://www.yiovo.com All rights reserved.
- // +----------------------------------------------------------------------
- // | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
- // +----------------------------------------------------------------------
- // | Author: 萤火科技 <admin@yiovo.com>
- // +----------------------------------------------------------------------
- declare (strict_types = 1);
- namespace app\api\service;
- use app\common\library\helper;
- use app\common\service\BaseService;
- use app\api\model\Setting as SettingModel;
- use app\common\enum\Setting as SettingEnum;
- /**
- * 服务类:商城设置
- * Class Setting
- * @package app\api\service
- */
- class Setting extends BaseService
- {
- /**
- * 商城公共设置
- * 这里的商城设置仅暴露可公开的设置项 例如分类页模板、积分名称
- * @return array
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- public function getPublic()
- {
- $data = [];
- //分类页模板设置
- // $data[SettingEnum::PAGE_CATEGORY_TEMPLATE] = $this->getCatTplStyle();
- // 积分设置
- // $data[SettingEnum::POINTS] = $this->getPoints();
- // 充值设置
- // $data[SettingEnum::RECHARGE] = $this->getRecharge();
- // 品牌文化
- $data[SettingEnum::BRAND_CULTURE] = $this->getBrandCulture();
- return $data;
- }
- /**
- * 积分设置 (积分名称、积分描述)
- * @return array
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- private function getPoints()
- {
- $values = SettingModel::getItem(SettingEnum::POINTS);
- return helper::pick($values, ['points_name', 'describe']);
- }
- /**
- * 积分设置 (积分名称、积分描述)
- * @return array
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- private function getRecharge()
- {
- $values = SettingModel::getItem(SettingEnum::RECHARGE);
- return helper::pick($values, ['is_entrance', 'is_custom', 'describe']);
- }
- /**
- * 品牌文化
- * @return array|mixed
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- private function getBrandCulture()
- {
- $values = SettingModel::getItem(SettingEnum::BRAND_CULTURE);
- return $values;
- }
- /**
- * 获取分类页模板设置
- * @return array|mixed
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- private function getCatTplStyle()
- {
- return SettingModel::getItem(SettingEnum::PAGE_CATEGORY_TEMPLATE);
- }
- }
|