From 5b575d2eca2e83053da8cee4fc711adfa05c9ab6 Mon Sep 17 00:00:00 2001 From: wangxiaowei Date: Tue, 23 Jul 2024 22:31:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=95=86=E5=9F=8E=E5=BF=AB?= =?UTF-8?q?=E8=AE=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/logic/MallNewsLogic.php | 35 ++++++++---------- app/admin/view/mall_news/add.html | 17 ++++++++- app/admin/view/mall_news/audit.html | 19 ++++++++-- app/admin/view/mall_news/lists.html | 1 + app/api/logic/IndexLogic.php | 55 ++++++++++++++++------------- 5 files changed, 80 insertions(+), 47 deletions(-) diff --git a/app/admin/logic/MallNewsLogic.php b/app/admin/logic/MallNewsLogic.php index 72b7c67e..afda23f1 100644 --- a/app/admin/logic/MallNewsLogic.php +++ b/app/admin/logic/MallNewsLogic.php @@ -182,12 +182,6 @@ class MallNewsLogic extends Logic return false; } - // 选择商品 - public static function selectGoods() - { - - } - private static function checkForm(&$form) { if (empty($form)) { @@ -197,30 +191,31 @@ class MallNewsLogic extends Logic $file = []; unset($form['file']); - if (!is_numeric($form['sort'])) { + if (!empty($form['sort']) && !is_numeric($form['sort'])) { return ['code' => -1, 'msg' => '请输入整数']; } - if ($form['type'] == 0 && isset($form['mall_news_images'])) { + if ($form['type'] == 0) { // 文章类型 - $file = $form['mall_news_images']; - - if (count($form['mall_news_images']) > 6) { - return ['code' => -1, 'msg' => '上传图片数量超过限制']; + if (isset($form['mall_news_images'])) { + $file = $form['mall_news_images']; + if (count($form['mall_news_images']) > 6) { + return ['code' => -1, 'msg' => '上传图片数量超过限制']; + } + unset($form['mall_news_images']) ; } - unset($form['mall_news_images']); unset($form['video_file']); - } else if ($form['type'] == 1 && !empty($form['video_file'])) { + } else if ($form['type'] == 1) { // 视频类型 - $file = $form['video_file']; - - if (!$form['video_file']) { - return ['code' => -1, 'msg' => '请上传视频']; + if (!empty($form['video_file'])) { + $file = $form['video_file']; + unset($form['video_file']); } - unset($form['mall_news_images']); - unset($form['video_file']); + if (isset($form['mall_news_images'])) { + unset($form['mall_news_images']) ; + } } return ['code' => 1, 'data' => $file]; diff --git a/app/admin/view/mall_news/add.html b/app/admin/view/mall_news/add.html index cd7eb2bd..b3e65d23 100644 --- a/app/admin/view/mall_news/add.html +++ b/app/admin/view/mall_news/add.html @@ -22,6 +22,7 @@ border-radius: 50%; background: hsla(0, 0%, 60%, .6) } + .select-goods {margin-left: 10px}
@@ -34,6 +35,14 @@
+
+ +
+ +
+
+
@@ -227,7 +236,13 @@ switchTab($(item).attr("switch-tab")); return "请填写标题"; } - } + }, + desc: function (value, item) { + if (!value) { + switchTab($(item).attr("switch-tab")); + return "请填写文章概述"; + } + }, }); function switchTab(number) { diff --git a/app/admin/view/mall_news/audit.html b/app/admin/view/mall_news/audit.html index 9d496859..5b871f41 100644 --- a/app/admin/view/mall_news/audit.html +++ b/app/admin/view/mall_news/audit.html @@ -22,6 +22,7 @@ border-radius: 50%; background: hsla(0, 0%, 60%, .6) } + .select-goods {margin-left: 10px}
@@ -35,6 +36,14 @@
+
+ +
+ +
+
+
@@ -80,7 +89,7 @@
-
{$detail.shop['name']}
+
{$detail.shop ? $detail.shop['name'] : ''}
选择商品
@@ -260,7 +269,13 @@ switchTab($(item).attr("switch-tab")); return "请填写标题"; } - } + }, + desc: function (value, item) { + if (!value) { + switchTab($(item).attr("switch-tab")); + return "请填写文章概述"; + } + }, }); function switchTab(number) { diff --git a/app/admin/view/mall_news/lists.html b/app/admin/view/mall_news/lists.html index 89cd7335..28c7be02 100644 --- a/app/admin/view/mall_news/lists.html +++ b/app/admin/view/mall_news/lists.html @@ -126,6 +126,7 @@ , {field: 'title', title: '标题', width: 300} , {field: 'type', title: '文章类型', width: 200, align: 'center',templet: '#news-type'} , {field: 'is_top', title: '是否置顶', width: 320, align: 'center', templet: '#news-top'} + , {field: 'sort', title: '排序', width: 320, align: 'center'} , {fixed: 'right', title: '操作', width: 400, align: 'center', toolbar: '#operation'} ]); } diff --git a/app/api/logic/IndexLogic.php b/app/api/logic/IndexLogic.php index b0f78937..efbfd0ef 100644 --- a/app/api/logic/IndexLogic.php +++ b/app/api/logic/IndexLogic.php @@ -19,6 +19,7 @@ use app\api\logic\SeckillGoodsLogic; use think\facade\Db; use app\common\model\activity_area\ActivityArea; use think\facade\Event; +use app\common\model\MallNews; class IndexLogic extends Logic @@ -79,7 +80,7 @@ class IndexLogic extends Logic $set_price_type = 3; } if ($set['set_pro'] != 0) { -// $set_price_type = 1; + // $set_price_type = 1; if ($set['set_pro_type'] == 1) { $hots[$key]['purchase_price'] = round($value['purchase_price'] * (100 + $set['set_pro']) / 100, 2); } @@ -88,7 +89,7 @@ class IndexLogic extends Logic } } if ($set['set_issued'] != 0) { -// $set_price_type = 2; + // $set_price_type = 2; if ($set['set_issued_type'] == 1) { $hots[$key]['issuing_price'] = round($value['issuing_price'] * (100 + $set['set_issued']) / 100, 2); } @@ -97,7 +98,7 @@ class IndexLogic extends Logic } } if ($set['set_wholesale'] != 0) { -// $set_price_type = 3; + // $set_price_type = 3; if ($set['set_wholesale_type'] == 1) { $hots[$key]['wholesale_price'] = round($value['wholesale_price'] * (100 + $set['set_wholesale']) / 100, 2); } @@ -121,7 +122,7 @@ class IndexLogic extends Logic $set_price_type = 3; } if ($set['set_pro'] != 0) { -// $set_price_type = 1; + // $set_price_type = 1; if ($set['set_pro_type'] == 1) { $news[$key]['purchase_price'] = round($value['purchase_price'] * (100 + $set['set_pro']) / 100, 2); } @@ -130,7 +131,7 @@ class IndexLogic extends Logic } } if ($set['set_issued'] != 0) { -// $set_price_type = 2; + // $set_price_type = 2; if ($set['set_issued_type'] == 1) { $news[$key]['issuing_price'] = round($value['issuing_price'] * (100 + $set['set_issued']) / 100, 2); } @@ -139,7 +140,7 @@ class IndexLogic extends Logic } } if ($set['set_wholesale'] != 0) { -// $set_price_type = 3; + // $set_price_type = 3; if ($set['set_wholesale_type'] == 1) { $news[$key]['wholesale_price'] = round($value['wholesale_price'] * (100 + $set['set_wholesale']) / 100, 2); } @@ -166,7 +167,7 @@ class IndexLogic extends Logic $set_price_type = 3; } if ($set['set_pro'] != 0) { -// $set_price_type = 1; + // $set_price_type = 1; if ($set['set_pro_type'] == 1) { $shopRecommend[$k]['goods_list'][$key]['purchase_price'] = round($value['purchase_price'] * (100 + $set['set_pro']) / 100, 2); } @@ -175,7 +176,7 @@ class IndexLogic extends Logic } } if ($set['set_issued'] != 0) { -// $set_price_type = 2; + // $set_price_type = 2; if ($set['set_issued_type'] == 1) { $shopRecommend[$k]['goods_list'][$key]['issuing_price'] = round($value['issuing_price'] * (100 + $set['set_issued']) / 100, 2); } @@ -184,7 +185,7 @@ class IndexLogic extends Logic } } if ($set['set_wholesale'] != 0) { -// $set_price_type = 3; + // $set_price_type = 3; if ($set['set_wholesale_type'] == 1) { $shopRecommend[$k]['goods_list'][$key]['wholesale_price'] = round($value['wholesale_price'] * (100 + $set['set_wholesale']) / 100, 2); } @@ -507,15 +508,15 @@ class IndexLogic extends Logic if($set['price_type']==3){ $set_price_type = 3; } -// if ($set['set_pro'] != 0) { -// $set_price_type = 1; -// } -// if ($set['set_issued'] != 0) { -// $set_price_type = 2; -// } -// if ($set['set_wholesale'] != 0) { -// $set_price_type = 3; -// } + // if ($set['set_pro'] != 0) { + // $set_price_type = 1; + // } + // if ($set['set_issued'] != 0) { + // $set_price_type = 2; + // } + // if ($set['set_wholesale'] != 0) { + // $set_price_type = 3; + // } } } return [ @@ -618,7 +619,7 @@ class IndexLogic extends Logic $set_price_type = 3; } if ($set['set_pro'] != 0) { -// $set_price_type = 1; + // $set_price_type = 1; if ($set['set_pro_type'] == 1) { $lists[$key]['purchase_price'] = round($value['purchase_price'] * (100 + $set['set_pro']) / 100, 2); } @@ -627,7 +628,7 @@ class IndexLogic extends Logic } } if ($set['set_issued'] != 0) { -// $set_price_type = 2; + // $set_price_type = 2; if ($set['set_issued_type'] == 1) { $lists[$key]['issuing_price'] = round($value['issuing_price'] * (100 + $set['set_issued']) / 100, 2); } @@ -636,7 +637,7 @@ class IndexLogic extends Logic } } if ($set['set_wholesale'] != 0) { -// $set_price_type = 3; + // $set_price_type = 3; if ($set['set_wholesale_type'] == 1) { $lists[$key]['wholesale_price'] = round($value['wholesale_price'] * (100 + $set['set_wholesale']) / 100, 2); } @@ -706,7 +707,7 @@ class IndexLogic extends Logic $set_price_type = 3; } if ($set['set_pro'] != 0) { -// $set_price_type = 1; + // $set_price_type = 1; if ($set['set_pro_type'] == 1) { $lists[$key]['purchase_price'] = round($value['purchase_price'] * (100 + $set['set_pro']) / 100, 2); } @@ -715,7 +716,7 @@ class IndexLogic extends Logic } } if ($set['set_issued'] != 0) { -// $set_price_type = 2; + // $set_price_type = 2; if ($set['set_issued_type'] == 1) { $lists[$key]['issuing_price'] = round($value['issuing_price'] * (100 + $set['set_issued']) / 100, 2); } @@ -724,7 +725,7 @@ class IndexLogic extends Logic } } if ($set['set_wholesale'] != 0) { -// $set_price_type = 3; + // $set_price_type = 3; if ($set['set_wholesale_type'] == 1) { $lists[$key]['wholesale_price'] = round($value['wholesale_price'] * (100 + $set['set_wholesale']) / 100, 2); } @@ -762,6 +763,7 @@ class IndexLogic extends Logic 'mnp_share_title' => '', 'mnp_share_image' => '' ]); + if (empty($share_mnp['mnp_share_image'])) { $share_mnp['mnp_share_image'] = ''; } else { @@ -780,6 +782,9 @@ class IndexLogic extends Logic $center_top_bg = UrlServer::getFileUrl($center_top_bg); } + // 商城快讯 + $mall_news = MallNews::where('delete_time', 0)->order('sort desc, create_time desc')->limit(3)->select(); + $config = [ 'shop_hide_goods' => ConfigServer::get('decoration', 'shop_hide_goods', 0), //商品详细是否显示店铺 'shop_street_hide' => ConfigServer::get('decoration', 'shop_street_hide', 0), //是否显示店铺街 @@ -805,6 +810,8 @@ class IndexLogic extends Logic 'android_download' => ConfigServer::get('app', 'line_android', ''),//安卓下载链接 'download_doc' => ConfigServer::get('app', 'download_doc', ''),//app下载文案 'cate_style' => ConfigServer::get('decoration', 'layout_no', 1),//分类页面风格 + 'mall_news' => $mall_news, + 'show_mall_news' => true, 'index_setting' => [ // 首页设置 // 热销榜单 'host_show' => ConfigServer::get('decoration_index', 'host_show', 1),