| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- namespace addons\ElectronCoupon\common\services;
- use common\services\mall\BaseAdsSettingService;
- use addons\ElectronCoupon\common\enums\ElectronCouponEnums;
- use yii\helpers\Json;
- /**
- * 设置配置服务
- * @package addons\ElectronCoupon\common\services
- */
- class SettingService extends BaseAdsSettingService
- {
- /**
- * @return array
- */
- public function defaultSetting(): array
- {
- return [
- 'images' => [],
- 'goods_list' => [],
- ];
- }
- /**
- * @return string
- */
- public function getAddosName(): string
- {
- return ElectronCouponEnums::ADDONS_NAME;
- }
- /**
- * @param array $setting
- * @return array
- */
- public function beforeGetSetting(array $setting): array
- {
- !is_array($setting['images']) && $setting['images'] = !empty($setting['images']) ? Json::decode($setting['images']) : [];
- !is_array($setting['goods_list']) && $setting['goods_list'] = !empty($setting['goods_list']) ? Json::decode($setting['goods_list']) : [];
- return $setting;
- }
- }
|