634 lines
32 KiB
PHP
634 lines
32 KiB
PHP
<?php
|
|
/**
|
|
* SaaSMall商城系统 - 团队十年电商经验汇集巨献!
|
|
* =========================================================
|
|
* Copy right 2019-2029 成都SAAS云科技有限公司, 保留所有权利。
|
|
* ----------------------------------------------
|
|
* 官方网址: https://www.gobuysaas.com
|
|
* =========================================================
|
|
*/
|
|
|
|
namespace app\shop\controller;
|
|
|
|
use addon\weapp\model\Config as WeappConfig;
|
|
use app\model\diy\Template;
|
|
use app\model\diy\Theme;
|
|
use app\model\goods\GoodsCategory;
|
|
use app\model\shop\Shop as ShopModel;
|
|
use app\model\web\DiyView as DiyViewModel;
|
|
use addon\wechat\model\Config as WechatConfig;
|
|
use app\model\web\DiyViewLink;
|
|
|
|
/**
|
|
* 网站装修控制器
|
|
*/
|
|
class Diy extends BaseShop
|
|
{
|
|
|
|
public function __construct()
|
|
{
|
|
$this->app_module = input('app_module', SHOP_MODULE);
|
|
if ($this->app_module == 'store') {
|
|
$this->initConstructInfo(); // 加载构造函数重要信息
|
|
} else {
|
|
parent::__construct();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 管理预览
|
|
* @return mixed
|
|
*/
|
|
public function management()
|
|
{
|
|
|
|
$shop_model = new ShopModel();
|
|
$qrcode_info = $shop_model->qrcode($this->site_id)[ 'data' ];
|
|
$this->assign('qrcode_info', $qrcode_info[ 'path' ][ 'h5' ] ?? '');
|
|
|
|
$wechat_config_model = new WechatConfig();
|
|
$wechat_config_result = $wechat_config_model->getWechatConfig($this->site_id)[ "data" ][ 'value' ];
|
|
$this->assign('wechat_config', $wechat_config_result);
|
|
|
|
$weapp_config_model = new WeappConfig();
|
|
$weapp_config_result = $weapp_config_model->getWeappConfig($this->site_id)[ 'data' ][ 'value' ];
|
|
$this->assign('weapp_config', $weapp_config_result);
|
|
|
|
$store_business = 'shop'; // 店铺运营模式
|
|
|
|
// 检测店铺运营模式
|
|
if (addon_is_exit('store')) {
|
|
$config_model = new \addon\store\model\Config();
|
|
$business_config = $config_model->getStoreBusinessConfig($this->site_id)[ 'data' ][ 'value' ];
|
|
$store_business = $business_config[ 'store_business' ];
|
|
}
|
|
|
|
$this->assign('store_is_exit', addon_is_exit('store'));
|
|
$this->assign('store_business', $store_business);
|
|
|
|
return $this->fetch('diy/management');
|
|
}
|
|
|
|
/**
|
|
* 网站主页
|
|
*/
|
|
public function index()
|
|
{
|
|
$data = [
|
|
'site_id' => $this->site_id,
|
|
'name' => 'DIY_VIEW_INDEX',
|
|
'copy' => input('copy',0)
|
|
];
|
|
$edit_view = event('DiyViewEdit', $data, true);
|
|
return $edit_view;
|
|
}
|
|
|
|
/**
|
|
* 商品分类页面
|
|
*/
|
|
public function goodsCategory()
|
|
{
|
|
$data = [
|
|
'site_id' => $this->site_id,
|
|
'name' => 'DIY_VIEW_GOODS_CATEGORY'
|
|
];
|
|
$edit_view = event('DiyViewEdit', $data, true);
|
|
return $edit_view;
|
|
}
|
|
|
|
/**
|
|
* 会员中心
|
|
*/
|
|
public function memberIndex()
|
|
{
|
|
$data = [
|
|
'site_id' => $this->site_id,
|
|
'name' => 'DIY_VIEW_MEMBER_INDEX'
|
|
];
|
|
$edit_view = event('DiyViewEdit', $data, true);
|
|
return $edit_view;
|
|
}
|
|
|
|
/**
|
|
* 编辑
|
|
*/
|
|
public function edit()
|
|
{
|
|
if (request()->isAjax()) {
|
|
$res = 0;
|
|
$id = input('id', 0);
|
|
$name = input('name', '');
|
|
$title = input('title', '');
|
|
$value = input('value', '');
|
|
$template_id = input('template_id', 0); // 所属模板id
|
|
$page_type = input('page_type', ''); // 页面类型
|
|
if (!empty($name) && !empty($title) && !empty($value)) {
|
|
$diy_view = new DiyViewModel();
|
|
$data = [
|
|
'site_id' => $this->site_id,
|
|
'name' => $name,
|
|
'title' => $title,
|
|
'value' => $value,
|
|
'template_id' => $template_id,
|
|
'is_default' => 1,
|
|
];
|
|
if (!empty($page_type)) {
|
|
$diy_template_model = new Template();
|
|
$template_info = $diy_template_model->getTemplateInfo([ [ 'name', '=', $page_type ] ], 'title,name')[ 'data' ];
|
|
$data[ 'type' ] = $template_info[ 'name' ];
|
|
$data[ 'type_name' ] = $template_info[ 'title' ];
|
|
}
|
|
if ($id == 0) {
|
|
$res = $diy_view->addSiteDiyView($data);
|
|
} else {
|
|
$res = $diy_view->editSiteDiyView($data, [ [ 'id', '=', $id ] ]);
|
|
}
|
|
}
|
|
return $res;
|
|
} else {
|
|
$id = input('id', 0);
|
|
$template_id = input('template_id', 0);
|
|
$title = input('title', '');
|
|
$name = input('name', '');
|
|
$page_type = input('page_type', ''); // 页面类型
|
|
$data = [
|
|
'site_id' => $this->site_id,
|
|
'id' => $id,
|
|
'template_id' => $template_id,
|
|
'title' => $title,
|
|
'name' => $name,
|
|
'page_type' => $page_type
|
|
];
|
|
$edit_view = event('DiyViewEdit', $data, true);
|
|
return $edit_view;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 微页面
|
|
*/
|
|
public function lists()
|
|
{
|
|
$type = input('type', ''); // 页面类型
|
|
$diy_template_goods_model = new Template();
|
|
// 页面类型
|
|
$template_list = $diy_template_goods_model->getTemplateList([], 'id,title,name')[ 'data' ];
|
|
$template_list_arr = array_column($template_list, 'name');
|
|
if (request()->isAjax()) {
|
|
$page_index = input('page', 1);
|
|
$page_size = input('page_size', PAGE_LIST_ROWS);
|
|
$search_text = input('search_text', ''); // 页面名称
|
|
$template_id = input('template_id', 0); // 所属模板id
|
|
$condition = [
|
|
[ 'site_id', '=', $this->site_id ],
|
|
// [ 'name', 'like', [ '%DIY_VIEW_RANDOM_%', 'DIY_VIEW_INDEX' ], 'or' ]
|
|
];
|
|
|
|
if (!empty($search_text)) {
|
|
$condition[] = [ 'title', 'like', '%' . $search_text . '%' ];
|
|
}
|
|
|
|
if (!empty($type) && $type != 'ALL') {
|
|
$condition[] = [ 'type', '=', $type ];
|
|
}
|
|
|
|
if (!empty($template_id)) {
|
|
$condition[] = [ 'template_id', '=', $template_id ];
|
|
}
|
|
|
|
$field = 'id, name, title, template_id, template_item_id, type, type_name, click_num, is_default, sort, create_time';
|
|
|
|
$order_by = "is_default desc,INSTR('" . implode(',', $template_list_arr) . "', name) desc, create_time desc";
|
|
|
|
$diy_view = new DiyViewModel();
|
|
$list = $diy_view->getSiteDiyViewPageList($condition, $page_index, $page_size, $order_by, $field);
|
|
return $list;
|
|
} else {
|
|
if (empty($type)) {
|
|
$type = 'ALL';
|
|
}
|
|
$this->assign('type', $type);
|
|
// 店铺模板
|
|
$template_goods_list = $diy_template_goods_model->getTemplateGoodsList([], 'goods_id, title, name')[ 'data' ];
|
|
$this->assign('template_goods_list', $template_goods_list);
|
|
// 选择页面类型
|
|
$page_type_list = [];
|
|
foreach ($template_list as $k => $v) {
|
|
$icon = '';
|
|
if ($v[ 'name' ] == 'DIY_VIEW_INDEX') {
|
|
$icon = 'iconfont icondianpushouye';
|
|
} elseif ($v[ 'name' ] == 'DIY_VIEW_GOODS_CATEGORY') {
|
|
$icon = 'iconfont iconshangpinfenlei2';
|
|
} elseif ($v[ 'name' ] == 'DIY_VIEW_MEMBER_INDEX') {
|
|
$icon = 'iconfont iconhuiyuanzhongxin';
|
|
} elseif ($v[ 'name' ] == 'DIY_STORE') {
|
|
$icon = 'iconfont iconmendianzhuye';
|
|
}elseif ($v[ 'name' ] == 'DIY_BOTTOM'){
|
|
$icon = 'iconfont iconmendianzhuye';
|
|
}
|
|
$page_type_list[] = [
|
|
'title' => $v[ 'title' ],
|
|
'name' => $v[ 'name' ],
|
|
'preview' => 'public/static/ext/diyview/img/preview/' . strtolower($v[ 'name' ]) . '.jpg',
|
|
'icon' => $icon
|
|
];
|
|
}
|
|
$page_type_list[] = [
|
|
'title' => '自定义页面',
|
|
'name' => 'DIY_PAGE',
|
|
'preview' => 'public/static/ext/diyview/img/preview/diy_page.jpg',
|
|
'icon' => 'iconfont iconzidingyiyemian'
|
|
];
|
|
$this->assign('page_type_list', $page_type_list);
|
|
$this->getPageCount();
|
|
return $this->fetch('diy/lists');
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 获取页面数量
|
|
* @return array
|
|
*/
|
|
public function getPageCount()
|
|
{
|
|
$diy_view = new DiyViewModel();
|
|
$diy_template_goods_model = new Template();
|
|
$template_list = $diy_template_goods_model->getTemplateList([], 'id,title,name')[ 'data' ];
|
|
|
|
array_unshift($template_list, [
|
|
'id' => 0,
|
|
'title' => '全部页面',
|
|
'name' => 'ALL'
|
|
]);
|
|
$template_list[] = [
|
|
'id' => 0,
|
|
'title' => '自定义页面',
|
|
'name' => 'DIY_PAGE'
|
|
];
|
|
foreach ($template_list as $k => $v) {
|
|
$condition = [
|
|
[ 'site_id', '=', $this->site_id ]
|
|
];
|
|
if ($v[ 'name' ] != 'ALL') {
|
|
$condition[] = [ 'type', '=', $v[ 'name' ] ];
|
|
}
|
|
$template_list[ $k ][ 'count' ] = $diy_view->getSiteViewCount($condition)[ 'data' ];
|
|
}
|
|
if (request()->isAjax()) {
|
|
return success(0, '', $template_list);
|
|
} else {
|
|
$this->assign('template_list', $template_list);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 页面路径
|
|
* @return mixed
|
|
*/
|
|
public function route()
|
|
{
|
|
if (request()->isAjax()) {
|
|
$page_index = input('page', 1);
|
|
$page_size = input('page_size', PAGE_LIST_ROWS);
|
|
$search_text = input('search_text', '');
|
|
$condition = [
|
|
[ 'wap_url', '<>', '' ]
|
|
];
|
|
|
|
if (!empty($search_text)) {
|
|
$condition[] = [ 'title', 'like', '%' . $search_text . '%' ];
|
|
}
|
|
|
|
$order_by = 'id asc';
|
|
$field = 'id, name, title, wap_url';
|
|
|
|
$link_model = new DiyViewLink();
|
|
$list = $link_model->getLinkPageList($condition, $page_index, $page_size, $order_by, $field);
|
|
return $list;
|
|
} else {
|
|
$h5_domain = getH5Domain();
|
|
$this->assign('h5_domain', $h5_domain);
|
|
return $this->fetch('diy/route');
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 根据页面路径生成推广链接
|
|
* @return array
|
|
*/
|
|
public function promoteRoute()
|
|
{
|
|
if (request()->isAjax()) {
|
|
$name = input('name', ''); // 链接标识
|
|
$path = input('path', ''); // 链接地址
|
|
$app_type = input('app_type', 'all'); // 端口类型
|
|
$diy_view = new DiyViewModel();
|
|
$res = $diy_view->qrcodeRoute([
|
|
'site_id' => $this->site_id,
|
|
'name' => $name,
|
|
'path' => $path,
|
|
'app_type' => $app_type
|
|
]);
|
|
|
|
return $res;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 链接选择
|
|
*/
|
|
public function link()
|
|
{
|
|
if (request()->isAjax()) {
|
|
$link = input('link', '');
|
|
$link_model = new DiyViewLink();
|
|
$tree_params = [
|
|
'site_id' => $this->site_id,
|
|
];
|
|
$list = $link_model->getLinkTree($tree_params)[ 'data' ];
|
|
$this->assign('list', $list);
|
|
$select_link = json_decode($link, true);
|
|
$this->assign('select_link', $select_link);
|
|
// 商品分类
|
|
$goods_category_model = new GoodsCategory();
|
|
$goods_category_field = 'category_id,category_name,short_name,pid,level,image';
|
|
$category_list = $goods_category_model->getCategoryTree([
|
|
[ 'site_id', '=', $this->site_id ]
|
|
], $goods_category_field)[ 'data' ];
|
|
$this->assign('category_list', $category_list);
|
|
return $this->fetch('diy/link');
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* 删除自定义模板页面
|
|
*/
|
|
public function deleteSiteDiyView()
|
|
{
|
|
if (request()->isAjax()) {
|
|
$diy_view = new DiyViewModel();
|
|
$id_array = input('id', 0);
|
|
$condition = [
|
|
[ 'id', 'in', $id_array ]
|
|
];
|
|
$res = $diy_view->deleteSiteDiyView($condition);
|
|
return $res;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 复制自定义模板页面
|
|
*/
|
|
public function copySiteDiyView()
|
|
{
|
|
if (request()->isAjax()) {
|
|
$diy_view = new DiyViewModel();
|
|
$id_array = input('id', 0);
|
|
$condition = [
|
|
[ 'id', '=', $id_array ]
|
|
];
|
|
// 获取被复制数据
|
|
$data = $diy_view->getSiteDiyViewInfo($condition, '*');
|
|
$data = $data[ 'data' ];
|
|
unset($data[ 'id' ]);
|
|
// 对数据进行处理
|
|
$value = json_decode($data[ 'value' ], true);
|
|
$data[ 'title' ] .= '_副本';
|
|
$value[ 'global' ][ 'title' ] = $data[ 'title' ];
|
|
$data[ 'value' ] = json_encode($value, JSON_UNESCAPED_UNICODE);
|
|
$data[ 'create_time' ] = time();
|
|
$data[ 'click_num' ] = 0;
|
|
if ($data[ 'type' ] == 'DIY_PAGE') {
|
|
$data[ 'is_default' ] = 1;
|
|
$data[ 'name' ] = 'DIY_VIEW_RANDOM_' . time();
|
|
} else {
|
|
$data[ 'is_default' ] = 0; // 特定页面设为0
|
|
}
|
|
// 新增新数据
|
|
$res = $diy_view->addSiteDiyView($data);
|
|
return $res;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 底部导航
|
|
*/
|
|
public function bottomNavDesign()
|
|
{
|
|
$diy_view = new DiyViewModel();
|
|
if (request()->isAjax()) {
|
|
$value = json_decode(input("value", ""), true);
|
|
$res = $diy_view->setBottomNavConfig($value, $this->site_id);
|
|
return $res;
|
|
} else {
|
|
$bottom_nav_info = $diy_view->getBottomNavConfig($this->site_id);
|
|
$this->assign('bottom_nav_info', $bottom_nav_info[ 'data' ][ 'value' ]);
|
|
return $this->fetch('diy/bottom_nav_design');
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 店铺风格
|
|
*/
|
|
public function style()
|
|
{
|
|
$diy_view = new DiyViewModel();
|
|
$diy_theme_model = new Theme();
|
|
if (request()->isAjax()) {
|
|
$data = [
|
|
'id' => input('id', 0),
|
|
'title' => input('title', ''),
|
|
'name' => input('name', ''),
|
|
'main_color' => input('main_color', ''),
|
|
'aux_color' => input('aux_color', '')
|
|
];
|
|
$res = $diy_view->setStyleConfig($data, $this->site_id);
|
|
$bottom_nav = $diy_view->getBottomNavConfig($this->site_id)[ 'data' ][ 'value' ];
|
|
|
|
// 修改底部导航配色
|
|
if ($bottom_nav[ 'type' ] == 1 || $bottom_nav[ 'type' ] == 2) {
|
|
$bottom_nav[ 'textHoverColor' ] = $data[ 'main_color' ];
|
|
}
|
|
foreach ($bottom_nav[ 'list' ] as $k => $v) {
|
|
if ($v[ 'selected_icon_type' ] == 'icon') {
|
|
$bottom_nav[ 'list' ][ $k ][ 'selected_style' ][ 'iconColor' ] = [ $data[ 'main_color' ] ];
|
|
}
|
|
}
|
|
$diy_view->setBottomNavConfig($bottom_nav, $this->site_id);
|
|
return $res;
|
|
} else {
|
|
// 主题风格
|
|
$theme_list = $diy_theme_model->getThemeList([], 'id,title,name,main_color,aux_color,preview,color_img')[ 'data' ];
|
|
if (!empty($theme_list)) {
|
|
foreach ($theme_list as $k => $v) {
|
|
if (!empty($v[ 'preview' ])) {
|
|
$theme_list[ $k ][ 'preview' ] = explode(',', $v[ 'preview' ]);
|
|
}
|
|
}
|
|
}
|
|
$this->assign('theme_list', $theme_list);
|
|
|
|
$style = $diy_view->getStyleConfig($this->site_id)[ 'data' ][ 'value' ];
|
|
$this->assign('style', $style);
|
|
|
|
return $this->fetch('diy/style');
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 自定义模板选择
|
|
* @return array|mixed
|
|
*/
|
|
public function template()
|
|
{
|
|
$josn='{"global":{"title":"优选社区团购","pageBgColor":"#FFFFFF","topNavColor":"#FFFFFF","topNavBg":true,"navBarSwitch":true,"navStyle":"1","textNavColor":"#333333","topNavImg":"","moreLink":{"name":""},"openBottomNav":true,"textImgPosLink":"center","mpCollect":false,"popWindow":{"imageUrl":"","count":-1,"isFull":-1,"autoClose":0,"background":"#FFFFFF","show":0,"link":{"name":""},"imgWidth":"","imgHeight":"","global.popWindow.background":"#FFFFFF"},"bgUrl":"https://cdn1.sopvip.com/upload/1/common/images/20230810/20230810050131169165809153550.png","imgWidth":"750","imgHeight":"590","template":{"pageBgColor":"","textColor":"#303133","componentBgColor":"","componentAngle":"round","topAroundRadius":0,"bottomAroundRadius":0,"elementBgColor":"","elementAngle":"round","topElementAroundRadius":0,"bottomElementAroundRadius":0,"margin":{"top":0,"bottom":0,"both":1}}},"value":[{"style":1,"styleName":"风格一","backgroundColor":"","textColor":"#FAFAFA","defaultTextColor":"#333333","changeType":1,"id":"ry0ub6apss0","addonName":"communitybuy","componentName":"Community","componentTitle":"团长自提","isDelete":0,"pageBgColor":"","componentBgColor":"","componentAngle":"round","topAroundRadius":0,"bottomAroundRadius":0,"elementBgColor":"","elementAngle":"round","topElementAroundRadius":0,"bottomElementAroundRadius":0,"margin":{"top":0,"bottom":0,"both":1}},{"indicatorIsShow":true,"indicatorColor":"#ffffff","carouselStyle":"circle","indicatorLocation":"center","list":[{"imageUrl":"https://cdn1.sopvip.com/upload/1/common/images/20230810/20230810050257169165817723910.png","link":{"name":""},"imgWidth":"690","imgHeight":"250","id":"1zg9dir7fq1s0","imageMode":"scaleToFill"}],"id":"3vvkbbrv1ce0","addonName":"","componentName":"ImageAds","componentTitle":"图片广告","isDelete":0,"pageBgColor":"","componentBgColor":"","componentAngle":"round","topAroundRadius":0,"bottomAroundRadius":0,"topElementAroundRadius":0,"bottomElementAroundRadius":0,"margin":{"top":0,"bottom":0,"both":1}},{"indicatorIsShow":true,"indicatorColor":"#ffffff","carouselStyle":"circle","indicatorLocation":"center","list":[{"imageUrl":"https://cdn1.sopvip.com/upload/1/common/images/20230810/20230810050946169165858652211.png","link":{"name":""},"imgWidth":"690","imgHeight":"27","id":"wkvxwgzdozk0","imageMode":"scaleToFill"}],"id":"2wo1c66h54o0","addonName":"","componentName":"ImageAds","componentTitle":"图片广告","isDelete":0,"pageBgColor":"","componentBgColor":"","componentAngle":"round","topAroundRadius":0,"bottomAroundRadius":0,"topElementAroundRadius":0,"bottomElementAroundRadius":0,"margin":{"top":8,"bottom":8,"both":1}},{"indicatorIsShow":true,"indicatorColor":"#ffffff","carouselStyle":"circle","indicatorLocation":"center","list":[{"imageUrl":"https://cdn1.sopvip.com/upload/1/common/images/20230810/20230810051033169165863365922.png","link":{"name":""},"imgWidth":"690","imgHeight":"137","id":"1h1azbde8lc00","imageMode":"scaleToFill"}],"id":"3es5ww5d7t40","addonName":"","componentName":"ImageAds","componentTitle":"图片广告","isDelete":0,"pageBgColor":"","componentBgColor":"","componentAngle":"round","topAroundRadius":0,"bottomAroundRadius":0,"topElementAroundRadius":0,"bottomElementAroundRadius":0,"margin":{"top":3,"bottom":0,"both":8}},{"ornament":{"type":"default","color":"#EDEDED"},"list":[{"title":"生鲜素菜","style":{"fontSize":"60","iconBgColor":[],"iconBgColorDeg":0,"iconBgImg":"","bgRadius":0,"iconColor":["#000000"],"iconColorDeg":0},"link":{"name":"INDEX","title":"主页","wap_url":"/pages/index/index","parent":"MALL_LINK"},"icon":"","iconType":"img","imageUrl":"https://cdn1.sopvip.com/upload/1/common/images/20230810/20230810051411169165885131572.png","label":{"control":false,"text":"热门","textColor":"#FFFFFF","bgColorStart":"#F83287","bgColorEnd":"#FE3423"},"id":"7yxhbzzvdc40","imgWidth":"109","imgHeight":"109"},{"title":"肉禽蛋品","style":{"fontSize":"60","iconBgColor":[],"iconBgColorDeg":0,"iconBgImg":"","bgRadius":0,"iconColor":["#000000"],"iconColorDeg":0},"link":{"name":"INDEX","title":"主页","wap_url":"/pages/index/index","parent":"MALL_LINK"},"icon":"","iconType":"img","imageUrl":"https://cdn1.sopvip.com/upload/1/common/images/20230810/20230810051411169165885135626.png","label":{"control":false,"text":"热门","textColor":"#FFFFFF","bgColorStart":"#F83287","bgColorEnd":"#FE3423"},"id":"9wmfxtzo4rk0","imgWidth":"109","imgHeight":"109"},{"title":"海鲜水产","style":{"fontSize":"60","iconBgColor":[],"iconBgColorDeg":0,"iconBgImg":"","bgRadius":0,"iconColor":["#000000"],"iconColorDeg":0},"link":{"name":"INDEX","title":"主页","wap_url":"/pages/index/index","parent":"MALL_LINK"},"icon":"","iconType":"img","imageUrl":"https://cdn1.sopvip.com/upload/1/common/images/20230810/20230810051411169165885142145.png","label":{"control":false,"text":"热门","textColor":"#FFFFFF","bgColorStart":"#F83287","bgColorEnd":"#FE3423"},"id":"1gi3ykyh6jr40","imgWidth":"109","imgHeight":"109"},{"title":"时令水果","style":{"fontSize":"60","iconBgColor":[],"iconBgColorDeg":0,"iconBgImg":"","bgRadius":0,"iconColor":["#000000"],"iconColorDeg":0},"link":{"name":"INDEX","title":"主页","wap_url":"/pages/index/index","parent":"MALL_LINK"},"icon":"","iconType":"img","imageUrl":"https://cdn1.sopvip.com/upload/1/common/images/20230810/20230810051411169165885143288.png","label":{"control":false,"text":"热门","textColor":"#FFFFFF","bgColorStart":"#F83287","bgColorEnd":"#FE3423"},"id":"y6e1rfn1txc0","imgWidth":"109","imgHeight":"109"},{"title":"乳品烘焙","icon":"","imageUrl":"https://cdn1.sopvip.com/upload/1/common/images/20230810/20230810051411169165885137639.png","iconType":"img","style":{"fontSize":"60","iconBgColor":[],"iconBgColorDeg":0,"iconBgImg":"","bgRadius":0,"iconColor":["#000000"],"iconColorDeg":0},"link":{"name":"INDEX","title":"主页","wap_url":"/pages/index/index","parent":"MALL_LINK"},"label":{"control":false,"text":"热门","textColor":"#FFFFFF","bgColorStart":"#F83287","bgColorEnd":"#FE3423"},"id":"p4hypu76ka80","imgWidth":"109","imgHeight":"109"},{"title":"酒水饮料","icon":"","imageUrl":"https://cdn1.sopvip.com/upload/1/common/images/20230810/20230810051411169165885138863.png","iconType":"img","style":{"fontSize":"60","iconBgColor":[],"iconBgColorDeg":0,"iconBgImg":"","bgRadius":0,"iconColor":["#000000"],"iconColorDeg":0},"link":{"name":"INDEX","title":"主页","wap_url":"/pages/index/index","parent":"MALL_LINK"},"label":{"control":false,"text":"热门","textColor":"#FFFFFF","bgColorStart":"#F83287","bgColorEnd":"#FE3423"},"id":"1srl1a1unrkw0","imgWidth":"109","imgHeight":"109"},{"title":"休闲零食","icon":"","imageUrl":"https://cdn1.sopvip.com/upload/1/common/images/20230810/20230810051411169165885143814.png","iconType":"img","style":{"fontSize":"60","iconBgColor":[],"iconBgColorDeg":0,"iconBgImg":"","bgRadius":0,"iconColor":["#000000"],"iconColorDeg":0},"link":{"name":"INDEX","title":"主页","wap_url":"/pages/index/index","parent":"MALL_LINK"},"label":{"control":false,"text":"热门","textColor":"#FFFFFF","bgColorStart":"#F83287","bgColorEnd":"#FE3423"},"id":"49ka0if4qmg0","imgWidth":"109","imgHeight":"109"},{"title":"油粮调味","icon":"","imageUrl":"https://cdn1.sopvip.com/upload/1/common/images/20230810/20230810051411169165885146841.png","iconType":"img","style":{"fontSize":"60","iconBgColor":[],"iconBgColorDeg":0,"iconBgImg":"","bgRadius":0,"iconColor":["#000000"],"iconColorDeg":0},"link":{"name":"INDEX","title":"主页","wap_url":"/pages/index/index","parent":"MALL_LINK"},"label":{"control":false,"text":"热门","textColor":"#FFFFFF","bgColorStart":"#F83287","bgColorEnd":"#FE3423"},"id":"16ak9oyx8txc0","imgWidth":"218","imgHeight":"218"},{"title":"日用百货","icon":"","imageUrl":"https://cdn1.sopvip.com/upload/1/common/images/20230810/20230810051444169165888435956.png","iconType":"img","style":{"fontSize":"60","iconBgColor":[],"iconBgColorDeg":0,"iconBgImg":"","bgRadius":0,"iconColor":["#000000"],"iconColorDeg":0},"link":{"name":"INDEX","title":"主页","wap_url":"/pages/index/index","parent":"MALL_LINK"},"label":{"control":false,"text":"热门","textColor":"#FFFFFF","bgColorStart":"#F83287","bgColorEnd":"#FE3423"},"id":"1wdwu5g2vp5s","imgWidth":"109","imgHeight":"109"},{"title":"素食冻品","icon":"","imageUrl":"https://cdn1.sopvip.com/upload/1/common/images/20230810/20230810051411169165885149495.png","iconType":"img","style":{"fontSize":"60","iconBgColor":[],"iconBgColorDeg":0,"iconBgImg":"","bgRadius":0,"iconColor":["#000000"],"iconColorDeg":0},"link":{"name":"INDEX","title":"主页","wap_url":"/pages/index/index","parent":"MALL_LINK"},"label":{"control":false,"text":"热门","textColor":"#FFFFFF","bgColorStart":"#F83287","bgColorEnd":"#FE3423"},"id":"12upiusrsylc0","imgWidth":"109","imgHeight":"109"}],"mode":"graphic","type":"img","showStyle":"fixed","rowCount":5,"pageCount":2,"carousel":{"type":"circle","color":"#FFFFFF"},"imageSize":40,"aroundRadius":25,"font":{"size":14,"weight":"normal","color":"#303133"},"id":"5eq5t7y5oc00","addonName":"","componentName":"GraphicNav","componentTitle":"图文导航","isDelete":0,"pageBgColor":"","componentBgColor":"","componentAngle":"round","topAroundRadius":0,"bottomAroundRadius":0,"topElementAroundRadius":0,"bottomElementAroundRadius":0,"margin":{"top":0,"bottom":0,"both":1}},{"style":"style-1","sources":"initial","count":6,"goodsId":[],"goodsMarginType":"default","goodsMarginNum":10,"ornament":{"type":"default","color":"#EDEDED"},"nameLineMode":"single","template":"row1-of1","btnStyle":{"text":"去秒杀","textColor":"#FFFFFF","theme":"default","aroundRadius":25,"control":true,"support":true,"bgColorStart":"#FF7B1D","bgColorEnd":"#FF1544"},"imgAroundRadius":5,"saleStyle":{"color":"#999CA7","control":false,"support":false},"progressStyle":{"control":true,"support":true,"currColor":"#ff0400","bgColor":"#FFD5D5"},"titleStyle":{"backgroundImage":"","isShow":true,"leftStyle":"text","leftImg":"","style":"style-1","styleName":"风格1","leftText":"限时秒杀","fontSize":16,"fontWeight":true,"textColor":"#303133","bgColorStart":"#FFFFFF","bgColorEnd":"#FFFFFF","more":"查看更多","moreColor":"#999999","moreFontSize":12,"timeBgColor":"","timeImageUrl":"","moreSupport":true,"colonColor":"#303133","numBgColorStart":"#303133","numBgColorEnd":"#303133","numTextColor":"#FFFFFF"},"slideMode":"scroll","theme":"default","priceStyle":{"mainColor":"#FF1745","mainControl":true,"lineColor":"#999CA7","lineControl":true,"lineSupport":true},"goodsNameStyle":{"color":"#303133","control":true,"fontWeight":false},"id":"622qy8j5lf00","addonName":"seckill","componentName":"Seckill","componentTitle":"秒杀","isDelete":0,"pageBgColor":"","componentBgColor":"","componentAngle":"round","topAroundRadius":0,"bottomAroundRadius":0,"elementBgColor":"","elementAngle":"round","topElementAroundRadius":0,"bottomElementAroundRadius":0,"margin":{"top":0,"bottom":0,"both":1}},{"style":"style-2","sources":"initial","ornament":{"type":"default","color":"#EDEDED"},"template":"row1-of2","goodsMarginType":"default","goodsMarginNum":10,"count":6,"goodsId":[],"categoryId":0,"categoryName":"请选择","sortWay":"default","nameLineMode":"single","imgAroundRadius":0,"slideMode":"scroll","theme":"default","btnStyle":{"fontWeight":false,"padding":0,"cartEvent":"detail","text":"购买","textColor":"#FFFFFF","theme":"default","aroundRadius":25,"control":true,"support":true,"bgColor":"#FF6A00","style":"button","iconDiy":{"iconType":"icon","icon":"","style":{"fontSize":"60","iconBgColor":[],"iconBgColorDeg":0,"iconBgImg":"","bgRadius":0,"iconColor":["#000000"],"iconColorDeg":0}}},"tag":{"text":"隐藏","value":"hidden"},"goodsNameStyle":{"color":"#303133","control":true,"fontWeight":false},"saleStyle":{"color":"#999CA7","control":false,"support":true},"priceStyle":{"mainColor":"#FF6A00","mainControl":true,"lineColor":"#999CA7","lineControl":false,"lineSupport":true},"id":"598u831j5540","addonName":"","componentName":"GoodsList","componentTitle":"商品列表","isDelete":0,"pageBgColor":"","componentBgColor":"","componentAngle":"round","topAroundRadius":0,"bottomAroundRadius":0,"elementBgColor":"","elementAngle":"round","topElementAroundRadius":0,"bottomElementAroundRadius":0,"margin":{"top":0,"bottom":0,"both":1}}]}';
|
|
|
|
// var_export(json_decode($josn,true));
|
|
// die;
|
|
|
|
$diy_view = new DiyViewModel();
|
|
$diy_theme_model = new Theme();
|
|
|
|
// 主题风格
|
|
$theme_list = $diy_theme_model->getThemeList([], 'id,title,name,main_color,aux_color,preview,color_img')[ 'data' ];
|
|
if (!empty($theme_list)) {
|
|
foreach ($theme_list as $k => $v) {
|
|
if (!empty($v[ 'preview' ])) {
|
|
$theme_list[ $k ][ 'preview' ] = explode(',', $v[ 'preview' ]);
|
|
}
|
|
}
|
|
}
|
|
$this->assign('theme_list', $theme_list);
|
|
|
|
$style = $diy_view->getStyleConfig($this->site_id)[ 'data' ][ 'value' ];
|
|
$this->assign('style', $style);
|
|
|
|
$diy_template = new Template();
|
|
|
|
// 查询店铺正在使用的模板
|
|
$site_diy_template_info = $diy_template->getSiteDiyTemplateInfo([
|
|
[ 'is_default', '=', 1 ],
|
|
[ 'site_id', '=', $this->site_id ]
|
|
], 'id,name,template_goods_id')[ 'data' ];
|
|
|
|
$template_goods_list = $diy_template->getTemplateGoodsList([], 'goods_id,title,name,cover,preview,desc,goods_item_id')[ 'data' ];
|
|
if (!empty($site_diy_template_info)) {
|
|
foreach ($template_goods_list as $k => $v) {
|
|
$template_goods_list[ $k ][ 'is_default' ] = 0;
|
|
if ($v[ 'goods_id' ] == $site_diy_template_info[ 'template_goods_id' ]) {
|
|
$template_goods_list[ $k ][ 'is_default' ] = 1;
|
|
}
|
|
}
|
|
}
|
|
$this->assign('template', $template_goods_list);
|
|
|
|
return $this->fetch('diy/template');
|
|
}
|
|
|
|
/**
|
|
* 创建
|
|
*/
|
|
public function create()
|
|
{
|
|
if (request()->isAjax()) {
|
|
$goods_id = input('goods_id', 0);
|
|
$diy_template = new Template();
|
|
$res = $diy_template->useTemplate([
|
|
'site_id' => $this->site_id,
|
|
'goods_id' => $goods_id,
|
|
]);
|
|
return $res;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 设为使用
|
|
*/
|
|
public function setUse()
|
|
{
|
|
if (request()->isAjax()) {
|
|
$diy_view = new DiyViewModel();
|
|
$id = input('id', 0);
|
|
$res = $diy_view->setUse($id, $this->site_id);
|
|
return $res;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 修改排序
|
|
*/
|
|
public function modifySort()
|
|
{
|
|
if (request()->isAjax()) {
|
|
$sort = input('sort', 0);
|
|
$id = input('id', 0);
|
|
$diy_view = new DiyViewModel();
|
|
return $diy_view->modifyDiyViewSort($sort, $id);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 热区设置
|
|
*/
|
|
public function heatMap()
|
|
{
|
|
return $this->fetch('diy/heat_map');
|
|
}
|
|
|
|
/**
|
|
* 矢量图库
|
|
* @return array|mixed
|
|
*/
|
|
public function iconfont()
|
|
{
|
|
$diy_view = new DiyViewModel();
|
|
$icon = input('icon', '');
|
|
if (request()->isAjax()) {
|
|
$type = input('type', 'icon'); // 图标类型
|
|
$icon_list = $diy_view->getIconList($type);
|
|
return $icon_list;
|
|
} else {
|
|
$icon_type = $diy_view->getIconType();
|
|
$this->assign('icon_type', $icon_type);
|
|
$this->assign('icon', $icon);
|
|
return $this->fetch('diy/iconfont');
|
|
}
|
|
}
|
|
|
|
/**
|
|
* icon风格设置
|
|
* @return mixed
|
|
*/
|
|
public function iconStyleSet()
|
|
{
|
|
$icon = input('icon', '');
|
|
$this->assign('icon', $icon);
|
|
$this->assign('icon_style', ( new DiyViewModel() )->iconStyle());
|
|
return $this->fetch('diy/icon_style');
|
|
}
|
|
|
|
public function selectIconStyle()
|
|
{
|
|
$icon = input('icon', '');
|
|
$this->assign('icon', $icon);
|
|
$this->assign('icon_style', ( new DiyViewModel() )->iconStyle());
|
|
return $this->fetch('diy/select_icon_style');
|
|
}
|
|
|
|
public function selectLabel()
|
|
{
|
|
$this->assign('data', input());
|
|
return $this->fetch('diy/select_label');
|
|
}
|
|
|
|
public function getImgIcon()
|
|
{
|
|
$data = input('data', '');
|
|
$this->assign('data', urldecode($data));
|
|
$this->assign('id', 'id_' . time() . mt_rand(0000, 9999));
|
|
return $this->fetch('diy/icon_img_view');
|
|
}
|
|
|
|
}
|