diff --git a/app/index/controller/Product.php b/app/index/controller/Product.php index abc84bcb..92610575 100644 --- a/app/index/controller/Product.php +++ b/app/index/controller/Product.php @@ -104,7 +104,7 @@ class Product extends Common ->onSale(true) ->onShelves(true) ->append(['p' => $list[0]['id']]) - ->order(['sort' => 'asc', 'id' => 'desc']) + ->order(['sort' => 'asc', 'created_at' => 'desc', 'id' => 'desc']) ->limit(5) ->buildSql(); $query = \think\facade\Db::table("($sql) as a"); @@ -126,7 +126,7 @@ class Product extends Common ->enabled(true) ->onSale(true) ->onShelves(true) - ->order(['sort' => 'asc', 'id' => 'desc']) + ->order(['sort' => 'asc', 'created_at' => 'desc', 'id' => 'desc']) ->limit(5); }); } @@ -192,7 +192,7 @@ class Product extends Common ->enabled(true) ->onSale(true) ->onShelves(true) - ->order(['sort' => 'asc', 'id' => 'desc']) + ->order(['sort' => 'asc', 'created_at' => 'desc', 'id' => 'desc']) ->select(); if (!$products->isEmpty()) { // 获取sku信息