| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507 |
- <?php
- /**
- * 重庆赤晓店信息科技有限公司
- * https://www.chixiaodian.com
- * Copyright (c) 2023 赤店商城 All rights reserved.
- */
- namespace app\models\common\diy;
- use app\models\DiyPage;
- use app\models\DiyTemplate;
- use yii\helpers\Json;
- class DiyConfig extends \yii\db\ActiveRecord
- {
- const DIY_CONFIG = [
- [
- 'name' => '基础组件',
- 'sub' => [
- [
- 'name' => '搜索',
- 'type' => 'search',
- 'icon' => 'search',
- 'param' => [
- 'backgroundColorW' => '#eeeeee',
- 'backgroundColor' => '#ffffff',
- 'borderRadius' => 4,
- 'color' => '#b2b2b2',
- 'textPosition' => 'left',
- 'text' => '搜索'
- ]
- ],
- [
- 'name' => '导航图标',
- 'type' => 'nav',
- 'icon' => 'menu',
- 'param' => [
- 'backgroundColor' => '#efeff4',
- 'count' => 3,
- 'col' => 1,
- 'list' => [],
- 'is_slide' => 1
- ]
- ],
- [
- 'name' => '轮播广告',
- 'type' => 'banner',
- 'icon' => 'block',
- 'param' => [
- 'bg_color' => '#ffffff',
- 'style' => 1,
- 'fill' => 1,
- 'list' => [],
- 'height' => 280
- ]
- ],
- [
- 'name' => '公告',
- 'type' => 'notice',
- 'icon' => 'sound',
- 'param' => [
- 'bg_color' => '#f67f79',
- 'color' => '#ffffff',
- 'icon' => '',
- 'name' => '公告',
- 'content' => ''
- ]
- ],
- [
- 'name' => '专题',
- 'type' => 'topic',
- 'icon' => 'reconciliation',
- 'param' => [
- 'count' => 1,
- 'logo_1' => '',
- 'logo_2' => '',
- 'heated' => '',
- 'style' => 0,
- 'list' => [],
- 'is_cat' => 0
- ]
- ],
- [
- 'name' => '关联连接',
- 'type' => 'link',
- 'icon' => 'link',
- 'param' => [
- 'backgroundColor' => '#ffffff',
- 'color' => '#353535',
- 'name' => '',
- 'icon' => '',
- 'is_icon' => 1,
- 'url' => '',
- 'left' => 0,
- 'is_jiantou' => 1,
- 'page_name' => '',
- 'position' => 0
- ]
- ],
- [
- 'name' => '图片广告',
- 'type' => 'rubik',
- 'icon' => 'file-image',
- 'param' => [
- 'style' => 0,
- 'fill' => 1,
- 'space' => 0,
- 'width' => 4,
- 'height' => 4,
- 'minHeight' => 360,
- 'new_minHeight' => 360,
- 'list' => []
- ]
- ],
- [
- 'name' => '视频',
- 'type' => 'video',
- 'icon' => 'video-camera',
- 'param' => [
- 'url' => '',
- 'pic_url' => ''
- ]
- ],
- [
- 'name' => '商品',
- 'type' => 'goods',
- 'icon' => 'wallet',
- 'param' => [
- 'is_cat' => 0,
- 'cat_position' => 0,
- 'cat_style' => 0,
- 'list' => [],
- 'goods_list' => [],
- 'list_style' => 0,
- 'fill' => 1,
- 'per' => 0,
- 'style' => 0,
- 'name' => 1,
- 'price' => 1,
- 'old_price' => 1,
- 'buy' => 1,
- 'buy_list' => [],
- 'buy_content' => '',
- 'mark' => 0,
- 'mark_list' => 4,
- 'mark_url' => '',
- 'cat_index' => 0,
- 'buy_default' => '购买'
- ]
- ],
- [
- 'name' => '门店信息',
- 'type' => 'shop_info',
- 'icon' => 'contacts',
- 'param' => [
- 'bg_color' => '#ffffff',
- 'default_search_text' => '搜索',
- 'font_color' => '#ffffff',
- 'btn_1_img' => '',
- 'btn_1_text' => '',
- 'btn_1_page_name' => '',
- 'btn_1_url' => '',
- 'btn_1_open_type' => '',
- 'btn_2_img' => '',
- 'btn_2_text' => '',
- 'btn_2_page_name' => '',
- 'btn_2_url' => '',
- 'btn_2_open_type' => '',
- ]
- ],
- [
- 'name' => '门店',
- 'type' => 'shop',
- 'icon' => 'bank',
- 'param' => [
- 'list' => [],
- 'name' => 1,
- 'score' => 1,
- 'mobile' => 1,
- 'distance' => 1
- ]
- ],
- [
- 'name' => '超级品牌',
- 'type' => 'super_brand',
- 'icon' => 'sketch',
- 'param' => [
- 'name' => '超级品牌周',
- 'list' => []
- ]
- ],
- [
- 'name' => '附近店铺',
- 'type' => 'nearby_mch',
- 'icon' => 'shop',
- 'param' => [
- 'show_num' => 3,
- 'show_goods_num' => 6
- ]
- ],
- [
- 'name' => '图片活动',
- 'type' => 'plate',
- 'icon' => 'picture',
- 'param' => [
- 'list' => [],
- 'padding_top' => 0,
- 'padding_bottom' => 0
- ]
- ],
- [
- 'name' => '快捷导航',
- 'type' => 'fast_nav',
- 'icon' => 'monitor',
- 'param' => [
- 'list' => [],
- 'padding_top' => 0,
- 'padding_bottom' => 0,
- 'bg_color' => '#F50A0A'
- ]
- ],
- [
- 'name' => '推荐商品',
- 'type' => 'recommend_goods',
- 'icon' => 'import',
- 'param' => [
- 'list' => []
- ]
- ]
- ]
- ],
- [
- 'name' => '营销组件',
- 'sub' => [
- [
- 'name' => '优惠券',
- 'type' => 'coupon',
- 'icon' => 'account-book',
- 'param' => [
- 'bg' => '',
- 'bg_1' => '',
- 'color' => '#ffffff'
- ]
- ],
- [
- 'name' => '倒计时',
- 'type' => 'time',
- 'icon' => 'hourglass',
- 'param' => [
- 'pic_url' => '',
- 'url' => '',
- 'open_type' => '',
- 'start_time' => '',
- 'end_time' => '',
- 'date_start' => '',
- 'date_end' => '',
- 'pic_url_1' => ''
- ]
- ],
- [
- 'name' => '拼团',
- 'type' => 'pintuan',
- 'icon' => 'build',
- 'param' => [
- 'list' => []
- ]
- ],
- [
- 'name' => '秒杀',
- 'type' => 'miaosha',
- 'icon' => 'history',
- 'param' => [
- 'list' => [],
- 'list_style' => 0,
- 'fill' => 1,
- 'per' => 0,
- 'style' => 0,
- 'time' => 1,
- 'name' => 1,
- 'price' => 1,
- 'old_price' => 1,
- 'buy' => 1,
- 'buy_list' => 2,
- 'buy_content' => '',
- 'mark' => 0,
- 'mark_list' => 4,
- 'mark_url' => '',
- 'buy_default' => '马上秒'
- ]
- ],
- [
- 'name' => '预约',
- 'type' => 'book',
- 'icon' => 'dashboard',
- 'param' => [
- 'list' => [],
- 'list_style' => 0,
- 'fill' => 1,
- 'per' => 0,
- 'style' => 0,
- 'name' => 1,
- 'price' => 1,
- 'buy' => 1,
- 'buy_list' => 2,
- 'buy_content' => '',
- 'mark' => 0,
- 'mark_list' => 4,
- 'mark_url' => '',
- 'buy_default' => '预约'
- ]
- ],
- [
- 'name' => '砍价',
- 'type' => 'bargain',
- 'icon' => 'thunderbolt',
- 'param' => [
- 'list' => [],
- 'list_style' => 0,
- 'fill' => 1,
- 'per' => 0,
- 'style' => 0,
- 'time' => 1,
- 'name' => 1,
- 'price' => 1,
- 'old_price' => 1,
- 'buy' => 1,
- 'buy_list' => 2,
- 'buy_content' => '',
- 'mark' => 0,
- 'mark_list' => 4,
- 'mark_url' => '',
- 'buy_default' => '去参与'
- ]
- ],
- [
- 'name' => '好店推荐',
- 'type' => 'mch',
- 'icon' => 'trophy',
- 'param' => [
- 'is_goods' => 0,
- 'list' => [],
- 'price' => 1
- ]
- ],
- [
- 'name' => '积分商城',
- 'type' => 'integral',
- 'icon' => 'property-safety',
- 'param' => [
- 'bg_1' => '',
- 'color' => '#ffffff',
- 'is_coupon' => 1,
- 'is_goods' => 1,
- 'list' => [],
- 'list_style' => 0,
- 'fill' => 1,
- 'per' => 0,
- 'style' => 0,
- 'name' => 1,
- 'price' => 1,
- 'buy' => 1,
- 'buy_list' => 2,
- 'buy_content' => '',
- 'mark' => 0,
- 'mark_list' => 0,
- 'mark_url' => '',
- 'buy_default' => '立即兑换'
- ]
- ],
- [
- 'name' => '抽奖',
- 'type' => 'lottery',
- 'icon' => 'gift',
- 'param' => [
- 'list' => [],
- 'list_style' => 0,
- 'fill' => 1,
- 'per' => 0,
- 'style' => 0,
- 'time' => 1,
- 'name' => 1,
- 'price' => 1,
- 'old_price' => 1,
- 'buy' => 1,
- 'buy_list' => 2,
- 'buy_content' => '',
- 'mark' => 0,
- 'mark_list' => 4,
- 'mark_url' => '',
- 'buy_default' => '去参与'
- ]
- ],
- [
- 'name' => '整点秒杀',
- 'type' => 'hourly_miaosha',
- 'icon' => 'history',
- 'param' => [
- 'goods_list' => [],
- 'show_num' => 3
- ]
- ],
- [
- 'name' => '首页推荐',
- 'type' => 'index_recommend',
- 'icon' => 'like',
- 'param' => [
- 'list' => [
- [
- 'name' => '',
- 'title' => '',
- 'title_color' => '#ff0000',
- 'icon' => '',
- 'img_1' => '',
- 'img_1_page_name' => '',
- 'img_1_url' => '',
- 'img_1_open_type' => '',
- 'img_2' => '',
- 'img_2_page_name' => '',
- 'img_2_url' => '',
- 'img_2_open_type' => ''
- ]
- ]
- ]
- ]
- ]
- ],
- [
- 'name' => '其他组件',
- 'sub' => [
- [
- 'name' => '空白占位符',
- 'type' => 'line',
- 'icon' => 'container',
- 'param' => [
- 'backgroundColor' => '#eeeeee',
- 'height' => 1
- ]
- ],
- [
- 'name' => '流量主',
- 'type' => 'ad',
- 'icon' => 'tags',
- 'param' => [
- 'id' => ''
- ]
- ],
- [
- 'name' => '弹窗广告',
- 'type' => 'modal',
- 'icon' => 'tablet',
- 'param' => [
- 'show' => 0,
- 'pic_url' => '',
- 'url' => '',
- 'open_type' => '',
- 'status' => 0,
- 'pic_width' => 650,
- 'pic_height' => 700,
- 'list' => []
- ]
- ],
- ]
- ],
- ];
- /**
- * 获取diy配置
- */
- public static function getConfig()
- {
- return self::DIY_CONFIG;
- }
- /**
- * 获取diy配置
- * @param $id
- * @return DiyTemplate|array|\yii\db\ActiveRecord[]|null
- */
- public static function getSetting($id = 0)
- {
- if ($id) {
- $page = DiyTemplate::findOne([
- 'id' => $id,
- 'store_id' => get_store_id(),
- 'is_delete' => 0
- ]);
- if ($page) {
- $page->toArray();
- $page['template'] = $page['template'] ? Json::decode($page['template']) : [];
- return $page;
- } else {
- return [];
- }
- }
- $page = DiyTemplate::find()
- ->where([
- 'store_id' => get_store_id(),
- 'is_delete' => 0
- ])->orderBy(['id' => SORT_ASC])->asArray()->all();
- foreach ($page as &$val) {
- $val['template'] = $val['template'] ? Json::decode($page['template']) : [];
- }
- return $page;
- }
- }
|