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/Config.php b/app/admin/controller/Config.php index 7f92ad5..62f218a 100755 --- a/app/admin/controller/Config.php +++ b/app/admin/controller/Config.php @@ -112,6 +112,7 @@ class Config extends Base $wechatofficialaccount_setting = getConfig('wechatofficialaccount_setting'); $rank_setting = getConfig('rank_setting'); $system_test = getConfig('system_test'); + $tencent_sms_config = getConfig('tencent_sms_config'); View::assign("key", "systemconfig"); View::assign("data", $config); @@ -122,6 +123,7 @@ class Config extends Base View::assign("infinite_multiple", $infinite_multiple); View::assign("rank_setting", $rank_setting); View::assign("system_test", $system_test); + View::assign("tencent_sms_config", $tencent_sms_config); return View::fetch('Config/systemconfig'); } @@ -225,6 +227,12 @@ class Config extends Base \app\common\helper\ConfigHelper::clearSystemTestCache(); } + if ($data['key'] == 'tencent_sms_config') { + //清除redis缓存:tencent_sms_config + $redis = new RedisHelper(); + ($redis->getRedis())->del('config:tencent_sms_config'); + } + $result = setConfig($data['key'], $data); if ($result) { return $this->renderSuccess('修改成功'); 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 3d84728..05a2ad5 100755 --- a/app/admin/view/Config/systemconfig.html +++ b/app/admin/view/Config/systemconfig.html @@ -34,7 +34,7 @@ -