+ partner.ListOrders

+ AmendMissingOrders
This commit is contained in:
gazebo
2019-07-18 18:46:14 +08:00
parent 9db41bb15a
commit d5752381c7
10 changed files with 309 additions and 5 deletions

View File

@@ -21,6 +21,30 @@ type StoresOrderSaleInfo struct {
EarningPrice int64 `json:"earningPrice"` // 预估结算给门店老板的钱
}
func QueryOrders(db *DaoDB, vendorIDs []int, storeID int, orderCreatedAtBegin, orderCreatedAtEnd time.Time) (orderList []*model.GoodsOrder, err error) {
sql := `
SELECT t1.*
FROM goods_order t1
WHERE t1.order_created_at >= ?`
sqlParams := []interface{}{
orderCreatedAtBegin,
}
if len(vendorIDs) > 0 {
sql += " AND t1.vendor_id IN (" + GenQuestionMarks(len(vendorIDs)) + ")"
sqlParams = append(sqlParams, vendorIDs)
}
if storeID > 0 {
sql += " AND IF(t1.jx_store_id <> 0, t1.jx_store_id, t1.store_id) = ?"
sqlParams = append(sqlParams, storeID)
}
if !utils.IsTimeZero(orderCreatedAtEnd) {
sql += " AND t1.order_created_at <= ?"
sqlParams = append(sqlParams, orderCreatedAtEnd)
}
// sql += " ORDER BY t1.order_created_at DESC, t1.id DESC;"
return orderList, GetRows(db, &orderList, sql, sqlParams...)
}
func GetStoreOrderAfterTime(db *DaoDB, storeID int, orderTime time.Time, lastOrderSeqID int64) (orderList []*model.GoodsOrderExt, err error) {
sql := `
SELECT t1.*,