'基础组件', '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' => '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' => '其他组件', 'sub' => [ [ 'name' => '空白占位符', 'type' => 'line', 'icon' => 'container', 'param' => [ 'backgroundColor' => '#eeeeee', 'height' => 1 ] ] ] ], ]; /** * 获取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 = MchDiyTemplate::findOne([ 'id' => $id, 'store_id' => get_store_id(), 'is_delete' => 0, 'mch_id' => get_mch_id() ]); if ($page) { $page->toArray(); $page['template'] = $page['template'] ? Json::decode($page['template']) : []; return $page; } else { return []; } } $page = MchDiyTemplate::find() ->where([ 'store_id' => get_store_id(), 'is_delete' => 0, 'mch_id' => get_mch_id() ])->orderBy(['id' => SORT_ASC])->asArray()->all(); foreach ($page as &$val) { $val['template'] = $val['template'] ? Json::decode($page['template']) : []; } return $page; } }