ztt 9 months ago
parent f587bbb766
commit 2fa9595730
  1. 5
      app/api/model/Goods.php
  2. 3
      app/api/model/GoodsBrowseLog.php

@ -157,8 +157,9 @@ class Goods extends GoodsModel
$end_time = date('Y-m-d'); $end_time = date('Y-m-d');
$start_time = date('Y-m-d', strtotime($end_time . ' - 15 days')); $start_time = date('Y-m-d', strtotime($end_time . ' - 15 days'));
$list = $model->with(['sku', 'goods', 'images.file']) $list = $model->with(['sku', 'goods', 'images.file'])
->where('ctime', '>=', $start_time) ->whereBetween('ctime', [$start_time, $end_time])
->where('ctime', '<=', $end_time) // ->where('ctime', '>=', $start_time)
// ->where('ctime', '<=', $end_time)
->order('ctime', 'desc') ->order('ctime', 'desc')
->where(['user_id' => $userId]) ->where(['user_id' => $userId])
->select(); ->select();

@ -52,7 +52,10 @@ class GoodsBrowseLog extends GoodsSpecRelModel
// 当前用户ID // 当前用户ID
$userId = UserService::getCurrentLoginUserId(); $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) return self::where('user_id', '=', $userId)
->whereBetween('ctime', [$start_time, $end_time])
->count(); ->count();
} }

Loading…
Cancel
Save