- orderUseNewTable almost ok.

This commit is contained in:
gazebo
2018-10-17 16:53:01 +08:00
parent 9c125a61a0
commit e56eb69b09
6 changed files with 81 additions and 10 deletions

View File

@@ -139,7 +139,7 @@ func AddStoreCategoryMap(db *DaoDB, storeID, categoryID int, vendorID int, vendo
return err
}
func GetStoreMapByStoreID(db *DaoDB, storeID, vendorID int) (storeMap *model.StoreMap) {
func GetStoreMapByStoreID(db *DaoDB, storeID, vendorID int) (storeMap *model.StoreMap, err error) {
if db == nil {
db = GetDB()
}
@@ -148,9 +148,35 @@ func GetStoreMapByStoreID(db *DaoDB, storeID, vendorID int) (storeMap *model.Sto
VendorID: vendorID,
}
storeMap.DeletedAt = utils.DefaultTimeValue
if err := GetEntity(db, storeMap, model.FieldStoreID, model.FieldVendorID, model.FieldDeletedAt); err != nil {
globals.SugarLogger.Warnf("getStoreDeliveryType read storefeature failed with error:%v", err)
return nil
if err = GetEntity(db, storeMap, model.FieldStoreID, model.FieldVendorID, model.FieldDeletedAt); err != nil {
globals.SugarLogger.Warnf("GetStoreMapByStoreID storeID:%d, vendorID:%d read storefeature failed with error:%v", storeID, vendorID, err)
return nil, err
}
return storeMap
return storeMap, nil
}
func GetStoreCouriersByStoreID(db *DaoDB, storeID, vendorID int) (storeMaps []*model.StoreMap, err error) {
if db == nil {
db = GetDB()
}
if err = utils.CallFuncLogError(func() error {
sql := `
SELECT *
FROM store_courier_map
WHERE store_id = ? AND status = ? AND deleted_at = ?
`
sqlParams := []interface{}{
storeID,
model.StoreStatusOpened,
utils.DefaultTimeValue,
}
if vendorID != -1 {
sql += " AND vendor_id = ?"
sqlParams = append(sqlParams, vendorID)
}
return GetRows(db, &storeMaps, sql, sqlParams...)
}, "GetStoreCouriersByStoreID storeID:%d, vendorID:%d", storeID, vendorID); err != nil {
return nil, err
}
return storeMaps, nil
}