Parcourir la source

fix(product): 修复产品排序逻辑

- 在排序规则中添加随机函数以解决排序重复问题
- 保持原有降序排序的同时增加随机性避免数据倾斜
shichen il y a 2 mois
Parent
commit
f94d870cb3
1 fichiers modifiés avec 1 ajouts et 1 suppressions
  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, RAND()');
172 172
         });
173 173
         return $query;
174 174
     }