Bläddra i källkod

feat(product): 添加产品随机排序功能

- 在产品查询中添加了随机排序功能
- 使用 RAND() 函数实现随机排序
- 保持原有的 sort 排序作为基础排序规则
- 随机排序在原有排序基础上进行随机化处理
shichen 2 månader sedan
förälder
incheckning
4d975a1796
1 ändrade filer med 1 tillägg och 1 borttagningar
  1. 1 1
      app/common/dao/store/product/ProductDao.php

+ 1 - 1
app/common/dao/store/product/ProductDao.php

@@ -168,7 +168,7 @@ class ProductDao extends BaseDao
168 168
                 $query->order('rank DESC ,create_time DESC');
169 169
             });
170 170
         },function ($query){
171
-            $query->order('sort DESC');
171
+            $query->order('sort DESC')->orderRaw("RAND()");
172 172
         });
173 173
         return $query;
174 174
     }