From 90cbc5c81fe6bbd053c7ec5b7517870511a5e69b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 26 Dec 2019 09:05:19 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=A8=E5=BA=97=E4=BF=83=E9=94=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store.go | 5 +++-- business/jxstore/report/report.go | 3 +++ business/model/dao/store.go | 16 +++++++--------- controllers/cms_store.go | 6 ++---- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 713226b5f..ee40f141a 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -2548,13 +2548,13 @@ func StoreStatus2Chinese(status int) (str string) { } } -func GetStorePriceScore(ctx *jxcontext.Context, storeIDs, vendorIDs []int, fromScore, toScore, sort, directSort, secKillSort int, snapDate string, offset, pageSize int) (pagedInfo *model.PagedInfo, err error) { +func GetStorePriceScore(ctx *jxcontext.Context, storeIDs, vendorIDs []int, fromScore, toScore, sort int, snapDate string, offset, pageSize int) (pagedInfo *model.PagedInfo, err error) { var snapDateParam time.Time db := dao.GetDB() if snapDate != "" { snapDateParam = utils.Str2Time(snapDate) } - storePriceScore, totalCount, err := dao.GetStorePriceScore(db, storeIDs, vendorIDs, fromScore, toScore, sort, directSort, secKillSort, snapDateParam, offset, pageSize) + storePriceScore, totalCount, err := dao.GetStorePriceScore(db, storeIDs, vendorIDs, fromScore, toScore, sort, snapDateParam, offset, pageSize) pagedInfo = &model.PagedInfo{ Data: storePriceScore, TotalCount: totalCount, @@ -2589,6 +2589,7 @@ func CreateStorePriceScore(ctx *jxcontext.Context) (err error) { } } dao.Commit(db) + globals.SugarLogger.Debugf("CreateStorePriceScore") } return err } diff --git a/business/jxstore/report/report.go b/business/jxstore/report/report.go index 016bf0679..cc78fbe71 100644 --- a/business/jxstore/report/report.go +++ b/business/jxstore/report/report.go @@ -6,6 +6,8 @@ import ( "math" "time" + "git.rosy.net.cn/jx-callback/globals" + "git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/jx-callback/business/jxutils/jxcontext" "git.rosy.net.cn/jx-callback/business/model" @@ -76,6 +78,7 @@ func BeginSavePriceRefer(ctx *jxcontext.Context, cityCodes, skuIDs []int) (err e } } dao.Commit(db) + globals.SugarLogger.Debugf("CreatePriceRefer") } return err } diff --git a/business/model/dao/store.go b/business/model/dao/store.go index 96ee15a7c..2f50e083b 100644 --- a/business/model/dao/store.go +++ b/business/model/dao/store.go @@ -489,7 +489,7 @@ func GetStoreMapsListWithoutDisabled(db *DaoDB, vendorIDs []int, status int) (st return storeMapList, err } -func GetStorePriceScore(db *DaoDB, storeIDs, vendorIDs []int, fromScore, toScore, sort, directSort, secKillSort int, snapDate time.Time, offset, pageSize int) (StorePriceScore []*StorePriceScore, totalCount int, err error) { +func GetStorePriceScore(db *DaoDB, storeIDs, vendorIDs []int, fromScore, toScore, sort int, snapDate time.Time, offset, pageSize int) (StorePriceScore []*StorePriceScore, totalCount int, err error) { sql := ` SELECT SQL_CALC_FOUND_ROWS a.store_id,score store_score,e.name city_name,b.name store_name FROM store_price_score_snapshot a @@ -533,19 +533,17 @@ func GetStorePriceScore(db *DaoDB, storeIDs, vendorIDs []int, fromScore, toScore sql += " AND a.snapshot_at = ?" sqlParams = append(sqlParams, snapDate) } - if sort == 0 { + if sort == 1 { sql += " ORDER BY a.score" - } else if sort == 1 { + } else if sort == -1 { sql += " ORDER BY a.score DESC" - } - if directSort == 0 { + } else if sort == 2 { sql += " ORDER BY t1.direct_down_count" - } else if directSort == 1 { + } else if sort == -2 { sql += " ORDER BY t1.direct_down_count DESC" - } - if secKillSort == 0 { + } else if sort == 3 { sql += " ORDER BY t1.sec_kill_count" - } else if secKillSort == 1 { + } else if sort == -3 { sql += " ORDER BY t1.sec_kill_count DESC" } sql += " LIMIT ? OFFSET ?" diff --git a/controllers/cms_store.go b/controllers/cms_store.go index 29d2b36df..180344e6b 100644 --- a/controllers/cms_store.go +++ b/controllers/cms_store.go @@ -593,9 +593,7 @@ func (c *StoreController) GetVendorStoreInfo() { // @Param snapDate formData string true "时间,默认前一天(格式2006-01-02" // @Param fromScore formData int false "分数范围开始 默认0" // @Param toScore formData int false "分数范围结束 默认100" -// @Param sort formData int false "分数排序,默认降序,0为降序,1为升序,-1为忽略" -// @Param directSort formData int false "直降排序,默认降序,0为降序,1为升序,-1为忽略" -// @Param secKillSort formData int false "秒杀排序,默认降序,0为降序,1为升序,-1为忽略" +// @Param sort formData int false "分数排序,-1降序,-升序 ,直降排序,-2降序,2升序,秒杀排序,-3降序,3升序" // @Param offset formData int false "门店列表起始序号(以0开始,缺省为0)" // @Param pageSize formData int false "门店列表页大小(缺省为50,-1表示全部)" // @Success 200 {object} controllers.CallResult @@ -605,7 +603,7 @@ func (c *StoreController) GetStorePriceScore() { var storeIDList, vendorIDList []int c.callGetStorePriceScore(func(params *tStoreGetStorePriceScoreParams) (retVal interface{}, errCode string, err error) { if jxutils.Strings2Objs(params.StoreIDs, &storeIDList, params.VendorIDs, &vendorIDList); err == nil { - retVal, err = cms.GetStorePriceScore(params.Ctx, storeIDList, vendorIDList, params.FromScore, params.ToScore, params.Sort, params.DirectSort, params.SecKillSort, params.SnapDate, params.Offset, params.PageSize) + retVal, err = cms.GetStorePriceScore(params.Ctx, storeIDList, vendorIDList, params.FromScore, params.ToScore, params.Sort, params.SnapDate, params.Offset, params.PageSize) } return retVal, "", err })