Jelajahi Sumber

累计消费排序

shish 4 tahun lalu
induk
melakukan
0a031edb74

+ 5 - 1
app-ghs/controllers/CustomController.php

@@ -129,7 +129,11 @@ class CustomController extends BaseController
                 $where['name'] = ['like', $name];
             }
         }
-        $list = CustomService::getCustomList($where);
+        if ($type == 2) {
+            $list = CustomService::getCustomOrderList($where, 'buyAmount DESC');
+        } else {
+            $list = CustomService::getCustomList($where);
+        }
         $shop = $this->shop;
         $list['totalUser'] = $shop->totalUser ?? 0;
         $list['mayGatheringNum'] = $shop->mayGatheringNum ?? 0;

+ 12 - 0
biz-ghs/custom/services/CustomService.php

@@ -42,6 +42,18 @@ class CustomService extends BaseService
         return $data;
     }
 
+    //有带排序的列表 shish 20210913
+    public static function getCustomOrderList($where,$order)
+    {
+        $data = CustomClass::getList('*', $where, $order);
+        $list = isset($data['list']) && !empty($data['list']) ? $data['list'] : [];
+        if (empty($list)) {
+            return $data;
+        }
+        $data['list'] = CustomClass::groupBaseInfo($list);
+        return $data;
+    }
+
     //获取客户信息,包括商家头像和店长信息 ssh 2021.1.8
     public static function getCustomInfo($customId)
     {