- handle [] in GetOrders
This commit is contained in:
@@ -276,25 +276,31 @@ func (c *OrderManager) GetOrders(fromDateStr, toDateStr string, params map[strin
|
||||
if err = utils.UnmarshalUseNumber([]byte(params["storeIDs"].(string)), &storeIDs); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
sqlWhere += " AND IF(t1.jx_store_id != 0, t1.jx_store_id, t1.store_id) IN (" + dao.GenQuestionMarks(len(storeIDs)) + ")"
|
||||
sqlParams = append(sqlParams, storeIDs)
|
||||
if len(storeIDs) > 0 {
|
||||
sqlWhere += " AND IF(t1.jx_store_id != 0, t1.jx_store_id, t1.store_id) IN (" + dao.GenQuestionMarks(len(storeIDs)) + ")"
|
||||
sqlParams = append(sqlParams, storeIDs)
|
||||
}
|
||||
}
|
||||
if params["statuss"] != nil {
|
||||
var statuss []int
|
||||
if err = utils.UnmarshalUseNumber([]byte(params["statuss"].(string)), &statuss); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
sqlWhere += " AND t1.status IN (" + dao.GenQuestionMarks(len(statuss)) + ")"
|
||||
sqlParams = append(sqlParams, statuss)
|
||||
if len(statuss) > 0 {
|
||||
sqlWhere += " AND t1.status IN (" + dao.GenQuestionMarks(len(statuss)) + ")"
|
||||
sqlParams = append(sqlParams, statuss)
|
||||
}
|
||||
}
|
||||
if params["cities"] != nil {
|
||||
var cities []int
|
||||
if err = utils.UnmarshalUseNumber([]byte(params["cities"].(string)), &cities); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
sql += " JOIN store st ON t1.store_id = st.id"
|
||||
sqlWhere += " AND st.city_code IN (" + dao.GenQuestionMarks(len(cities)) + ")"
|
||||
sqlParams = append(sqlParams, cities)
|
||||
if len(cities) > 0 {
|
||||
sql += " JOIN store st ON t1.store_id = st.id"
|
||||
sqlWhere += " AND st.city_code IN (" + dao.GenQuestionMarks(len(cities)) + ")"
|
||||
sqlParams = append(sqlParams, cities)
|
||||
}
|
||||
}
|
||||
|
||||
sql += sqlWhere
|
||||
|
||||
Reference in New Issue
Block a user