From 071d30efe7363d9cd5ee85c1cb3c4cdf4fb3561c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 6 Dec 2019 18:33:50 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=A8=E5=BA=97=E4=BB=B7=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store.go | 10 +++++----- business/model/dao/store.go | 18 +++++++++++++++--- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 824a80f65..2260b1726 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -2413,16 +2413,16 @@ func StoreStatus2Chinese(status int) (str string) { } } -func GetStorePriceScore(ctx *jxcontext.Context, storeIDs []int, snapDate string, offset, pageSize int) (storeTotalScoreEx *model.StoreTotalScoreEx, err error) { +func GetStorePriceScore(ctx *jxcontext.Context, storeIDs []int, snapDate string, offset, pageSize int) (storePriceScoreEx *dao.StorePriceScoreEx, err error) { var snapDateParam time.Time db := dao.GetDB() if snapDate != "" { snapDateParam = utils.Str2Time(snapDate) } - storeTotalScore, totalCount, err := dao.GetStorePriceScore(db, storeIDs, snapDateParam, offset, pageSize) - storeTotalScoreEx = &model.StoreTotalScoreEx{ - StoreTotalScoreList: storeTotalScore, + storePriceScore, totalCount, err := dao.GetStorePriceScore(db, storeIDs, snapDateParam, offset, pageSize) + storePriceScoreEx = &dao.StorePriceScoreEx{ + StorePriceScoreList: storePriceScore, TotalCount: totalCount, } - return storeTotalScoreEx, err + return storePriceScoreEx, err } diff --git a/business/model/dao/store.go b/business/model/dao/store.go index 5f3758c9a..ab018cca7 100644 --- a/business/model/dao/store.go +++ b/business/model/dao/store.go @@ -56,6 +56,18 @@ type CityBrankBranch struct { PayeeBankCode string `orm:"size(8)" json:"payeeBankCode"` // 开户行代码 } +type StorePriceScore struct { + StoreID int `json:"storeID"` + StoreName string `json:"storeName"` + StoreScore float64 `json:"storeScore"` + CityName string `json:"cityName"` +} + +type StorePriceScoreEx struct { + StorePriceScoreList []*StorePriceScore `json:"storePriceScoreList"` + TotalCount int `json:"totalCount"` +} + func (s *StoreDetail) GetPricePerentage(price int) (pricePercentage int) { return pricePercentage } @@ -463,7 +475,7 @@ func GetStoreMapsListWithoutDisabled(db *DaoDB, vendorIDs []int, status int) (st return storeMapList, err } -func GetStorePriceScore(db *DaoDB, storeIDs []int, snapDate time.Time, offset, pageSize int) (storeTotalScore []*model.StoreTotalScore, totalCount int, err error) { +func GetStorePriceScore(db *DaoDB, storeIDs []int, snapDate time.Time, offset, pageSize int) (StorePriceScore []*StorePriceScore, totalCount int, err error) { sql := ` SELECT SQL_CALC_FOUND_ROWS t1.* FROM( @@ -494,8 +506,8 @@ func GetStorePriceScore(db *DaoDB, storeIDs []int, snapDate time.Time, offset, p sqlParams = append(sqlParams, pageSize, offset) Begin(db) defer Commit(db) - if err = GetRows(db, &storeTotalScore, sql, sqlParams...); err == nil { + if err = GetRows(db, &StorePriceScore, sql, sqlParams...); err == nil { totalCount = GetLastTotalRowCount(db) } - return storeTotalScore, totalCount, err + return StorePriceScore, totalCount, err }