- 重构createWaybillOn3rdProviders

This commit is contained in:
gazebo
2019-03-30 17:11:23 +08:00
parent 10a444c895
commit 96fb2d9535
11 changed files with 127 additions and 100 deletions

View File

@@ -158,3 +158,23 @@ func GetMissingDadaStores(db *DaoDB, storeID int, isMustHaveJdStore bool) (store
}
return nil, err
}
func GetStoreCourierList(db *DaoDB, storeID, status int) (courierStoreList []*model.StoreCourierMap, err error) {
sql := `
SELECT t1.*
FROM store_courier_map t1
WHERE t1.deleted_at = ? AND t1.store_id = ?
`
sqlParams := []interface{}{
utils.DefaultTimeValue,
storeID,
}
if status != model.StoreStatusAll {
sql += " AND t1.status = ?"
sqlParams = append(sqlParams, status)
}
if err = GetRows(db, &courierStoreList, sql, sqlParams...); err == nil {
return courierStoreList, nil
}
return nil, err
}

View File

@@ -4,6 +4,7 @@ import (
"testing"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/globals"
)
@@ -14,3 +15,11 @@ func TestGetStoreDetail(t *testing.T) {
}
globals.SugarLogger.Debug(utils.Format4Output(storeDetail, false))
}
func TestGetStoreCourierList(t *testing.T) {
storeCourierList, err := GetStoreCourierList(GetDB(), 100119, model.StoreStatusOpened)
if err != nil {
t.Fatal(err)
}
globals.SugarLogger.Debug(utils.Format4Output(storeCourierList, false))
}