- GetPlaces don't support vendorID.

This commit is contained in:
gazebo
2018-09-17 21:31:06 +08:00
parent 6c683d5cf2
commit 80d76ba94f
2 changed files with 8 additions and 21 deletions

View File

@@ -29,20 +29,16 @@ var (
ErrCanNotFindVendor = errors.New("vendorID参数不合法")
)
func GetPlaces(parentCode int, vendorID int, includeDisabled bool) ([]*model.Place, error) {
func GetPlaces(parentCode int, includeDisabled bool) ([]*model.Place, error) {
db := dao.GetDB()
places := []*model.Place{}
sql := "SELECT * FROM place WHERE enabled = 1 "
if includeDisabled {
sql = "1 = 1 "
cond := map[string]interface{}{
"ParentCode": parentCode,
}
if vendorID >= 0 {
if vendorID == model.VendorIDJD {
return places, dao.GetRows(db, &places, sql+"AND jd_code <> 0 AND level >= 2")
}
return nil, ErrHaveNotImplementedYet
if !includeDisabled {
cond["Enabled"] = 1
}
return places, dao.GetRows(db, &places, sql+"AND parent_code = ?", parentCode)
return places, dao.GetEntities(db, &places, cond, false)
}
func UpdatePlaces(places []map[string]interface{}, userName string) (num int64, err error) {