- 使用GetPricePercentage
This commit is contained in:
@@ -183,6 +183,7 @@ func GetStoreMapByStoreID(db *DaoDB, storeID, vendorID int) (storeMap *model.Sto
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
storeMap.PricePercentagePackObj = PricePercentagePack2Obj(storeMap.PricePercentagePack)
|
||||
return storeMap, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package dao
|
||||
|
||||
import (
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
@@ -72,9 +73,7 @@ func getStoreDetail(db *DaoDB, storeID, vendorID int, vendorStoreID string) (sto
|
||||
storeDetail = &StoreDetail{}
|
||||
if err = GetRow(db, storeDetail, sql, sqlParams...); err == nil {
|
||||
storeDetail.Place.Name = storeDetail.DistrictName
|
||||
if storeDetail.PricePercentagePack != "" {
|
||||
utils.UnmarshalUseNumber([]byte(storeDetail.PricePercentagePack), &storeDetail.PricePercentagePackObj)
|
||||
}
|
||||
storeDetail.PricePercentagePackObj = PricePercentagePack2Obj(storeDetail.PricePercentagePack)
|
||||
return storeDetail, nil
|
||||
}
|
||||
return nil, err
|
||||
@@ -227,6 +226,9 @@ func GetStoresMapList(db *DaoDB, vendorIDs, storeIDs []int, status, isSync int)
|
||||
}
|
||||
sql += " ORDER BY t1.store_id, t1.vendor_id"
|
||||
if err = GetRows(db, &storeMapList, sql, sqlParams...); err == nil {
|
||||
for _, v := range storeMapList {
|
||||
v.PricePercentagePackObj = PricePercentagePack2Obj(v.PricePercentagePack)
|
||||
}
|
||||
return storeMapList, nil
|
||||
}
|
||||
return nil, err
|
||||
@@ -312,3 +314,12 @@ func GetRebindPrinterStoreList(db *DaoDB) (storeList []*model.Store, err error)
|
||||
`, utils.DefaultTimeValue, model.VendorIDPrinterBegin)
|
||||
return storeList, err
|
||||
}
|
||||
|
||||
func PricePercentagePack2Obj(packStr string) (obj model.PricePercentagePack) {
|
||||
if packStr != "" {
|
||||
if err := utils.UnmarshalUseNumber([]byte(packStr), &obj); err == nil {
|
||||
sort.Sort(obj)
|
||||
}
|
||||
}
|
||||
return obj
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user