From 4772f5e9960c79ed0671214c6447c6091b5ed689 Mon Sep 17 00:00:00 2001 From: youda Date: Wed, 23 Apr 2025 15:15:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 6 +- .../controller/GoodsOffshelfController.php | 83 ++++++ app/admin/route/app.php | 6 +- app/admin/view/Config/systemconfig.html | 11 +- app/admin/view/Goods/goods.html | 39 ++- app/admin/view/Goods/goods_add.html | 7 + app/admin/view/Goods/goods_edit.html | 9 +- app/admin/view/Goods/offshelf/log.html | 39 ++- app/api/controller/Login.php | 256 +++++++++++++++++- app/api/controller/Warehouse.php | 33 ++- app/api/route/app.php | 6 +- app/command/AutoGoodsOffshelf.php | 43 ++- app/common.php | 22 +- app/common/helper/ConfigHelper.php | 18 +- app/common/service/CommonService.php | 51 ++++ 15 files changed, 587 insertions(+), 42 deletions(-) create mode 100644 app/admin/controller/GoodsOffshelfController.php diff --git a/.env b/.env index a15c551..d30629e 100644 --- a/.env +++ b/.env @@ -6,9 +6,9 @@ DEFAULT_TIMEZONE = Asia/Shanghai [DATABASE] TYPE = mysql HOSTNAME = 127.0.0.1 -DATABASE = youda -USERNAME = youda -PASSWORD = youda +DATABASE = youda_test +USERNAME = youda_test +PASSWORD = youda_test HOSTPORT = 3306 CHARSET = utf8 DEBUG = false diff --git a/app/admin/controller/GoodsOffshelfController.php b/app/admin/controller/GoodsOffshelfController.php new file mode 100644 index 0000000..b5e3a25 --- /dev/null +++ b/app/admin/controller/GoodsOffshelfController.php @@ -0,0 +1,83 @@ +param('goods_id')) { + $query[] = ['goods_id', '=', $goodsId]; + } + + $startTime = $request->param('start_time'); + $endTime = $request->param('end_time'); + + if ($startTime) { + $query[] = ['create_time', '>=', strtotime($startTime)]; + } + + if ($endTime) { + $query[] = ['create_time', '<=', strtotime($endTime . ' 23:59:59')]; + } + + // 查询数据 + $list = Db::name('goods_offshelf_log') + ->alias('a') + ->join('goods g', 'a.goods_id = g.id', 'left') + ->field('a.*, g.title as goods_title, g.status as goods_status') + ->where($query) + ->order('a.id desc') + ->paginate(15); + + $count = $list->total(); + + // 处理数据 + foreach ($list as &$item) { + $item['create_time_text'] = date('Y-m-d H:i:s', $item['create_time']); + } + + View::assign('list', $list); + View::assign('count', $count); + View::assign('page', $list->render()); + + return View::fetch(); + } + + /** + * 标记下架日志为已读 + */ + public function read() + { + // 获取当前显示的所有未读记录并标记为已读 + Db::name('goods_offshelf_log') + ->where('is_read', 0) + ->update(['is_read' => 1]); + + return json(['status' => 1, 'msg' => '标记成功']); + } + + /** + * 获取未读下架日志的数量 + */ + public function getUnreadCount() + { + $count = Db::name('goods_offshelf_log') + ->where('is_read', 0) + ->count(); + + return json(['status' => 1, 'count' => $count]); + } +} \ No newline at end of file diff --git a/app/admin/route/app.php b/app/admin/route/app.php index 074f438..23bc525 100755 --- a/app/admin/route/app.php +++ b/app/admin/route/app.php @@ -429,4 +429,8 @@ Route::rule('statistics_shipmentList', 'Statistics/shipmentList', 'GET'); Route::rule('statistics_productsOverview', 'Statistics/productsOverview', 'GET'); Route::rule('statistics_getBoxStatistics', 'Statistics/getBoxStatistics', 'GET'); Route::rule('statistics_getSummaryStatistics', 'Statistics/getSummaryStatistics', 'GET'); -Route::rule('statistics_exportProfit', 'Statistics/exportProfit', 'GET'); \ No newline at end of file +Route::rule('statistics_exportProfit', 'Statistics/exportProfit', 'GET'); + +// 盒子下架日志相关路由 +Route::post('goods_offshelf_read', 'GoodsOffshelfController/read'); +Route::get('goods_offshelf_unread_count', 'GoodsOffshelfController/getUnreadCount'); \ No newline at end of file diff --git a/app/admin/view/Config/systemconfig.html b/app/admin/view/Config/systemconfig.html index f18c314..05a2ad5 100755 --- a/app/admin/view/Config/systemconfig.html +++ b/app/admin/view/Config/systemconfig.html @@ -34,7 +34,7 @@ -
每天允许兑换几次,0不限次数
+
每天允许购买几次,0不限次数
@@ -150,6 +150,15 @@
每日消费达到此金额后可签到,0表示不限制
+
+ +
+ +
当用户消费满足金额后,才显示兑换达达卷按钮。0不做限制
+
+
diff --git a/app/admin/view/Goods/goods.html b/app/admin/view/Goods/goods.html index 579ee3b..7ebc6cd 100755 --- a/app/admin/view/Goods/goods.html +++ b/app/admin/view/Goods/goods.html @@ -35,7 +35,10 @@ - +
默认不显示福利屋数据,查看福利屋盒子,请在盒子类型选择福利屋单独查看。 @@ -85,6 +88,10 @@

+ {{# if(d.xiajia_jine > 0){ }} + +
+ {{# } }} {{# } else { }} @@ -247,6 +254,12 @@ layer = layui.layer; laytpl = layui.laytpl; + // 加载未读下架日志数量 + loadUnreadOffshelfLogCount(); + + // 定时刷新未读数量(每60秒) + setInterval(loadUnreadOffshelfLogCount, 60000); + // 加载盒子类型数据 $.ajax({ url: '{:url("/admin/api/goods/types")}', @@ -470,6 +483,10 @@ shade: 0.3, area: ['90%', '90%'], content: url, + end: function() { + // 日志页面关闭后刷新未读数量 + loadUnreadOffshelfLogCount(); + } }); } @@ -707,6 +724,26 @@ content: '
' }); } + + // 加载未读下架日志数量 + function loadUnreadOffshelfLogCount() { + var $ = layui.$; + $.ajax({ + url: '{:url("/admin/goods_offshelf_unread_count")}', + type: 'GET', + success: function(res) { + if (res.status === 1) { + if (res.count > 0) { + $('#offshelfLogCount').text(res.count).removeClass('layui-hide'); + + } else { + $('#offshelfLogCount').addClass('layui-hide'); + + } + } + } + }); + }