From 410517d623388cc5cab61df4fb93cc351f9c25b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 3 Mar 2020 11:16:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=9D=E8=AF=95=E5=81=9Alist=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=EF=BC=8CGetTopSkusByStoreIDs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 6af502c40..8fb94671f 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -2337,6 +2337,15 @@ func GetTopSkusByStoreIDs(ctx *jxcontext.Context, storeIDs []int) (storeSkuNameE for _, v := range skuMap { storeSkuNameExt2 = append(storeSkuNameExt2, v) } + for i := 0; i < len(storeSkuNameExt2)-1; i++ { + for j := 0; j < len(storeSkuNameExt2)-i-1; j++ { + if storeSkuNameExt2[i].Count < storeSkuNameExt2[i+1].Count { + tmp := storeSkuNameExt2[i] + storeSkuNameExt2[i] = storeSkuNameExt2[i+1] + storeSkuNameExt2[i+1] = tmp + } + } + } return storeSkuNameExt2, err }