diff --git a/app/api/model/Goods.php b/app/api/model/Goods.php index b7df66f1..14e2da17 100644 --- a/app/api/model/Goods.php +++ b/app/api/model/Goods.php @@ -157,8 +157,9 @@ class Goods extends GoodsModel $end_time = date('Y-m-d'); $start_time = date('Y-m-d', strtotime($end_time . ' - 15 days')); $list = $model->with(['sku', 'goods', 'images.file']) - ->where('ctime', '>=', $start_time) - ->where('ctime', '<=', $end_time) + ->whereBetween('ctime', [$start_time, $end_time]) +// ->where('ctime', '>=', $start_time) +// ->where('ctime', '<=', $end_time) ->order('ctime', 'desc') ->where(['user_id' => $userId]) ->select(); diff --git a/app/api/model/GoodsBrowseLog.php b/app/api/model/GoodsBrowseLog.php index 85899fa0..d49315ee 100644 --- a/app/api/model/GoodsBrowseLog.php +++ b/app/api/model/GoodsBrowseLog.php @@ -52,7 +52,10 @@ class GoodsBrowseLog extends GoodsSpecRelModel // 当前用户ID $userId = UserService::getCurrentLoginUserId(); // 查询数据 + $end_time = date('Y-m-d'); + $start_time = date('Y-m-d', strtotime($end_time . ' - 15 days')); return self::where('user_id', '=', $userId) + ->whereBetween('ctime', [$start_time, $end_time]) ->count(); }