统计订单接口修改
This commit is contained in:
@@ -8,9 +8,13 @@ import (
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
)
|
||||
|
||||
type StatisticsForOrdersExists struct {
|
||||
StoreID int `orm:"column(storeID)" json:"storeID"`
|
||||
}
|
||||
|
||||
type StatisticsReportForOrdersList struct {
|
||||
StoreID int `orm:"column(storeID)" json:"storeID"`
|
||||
OrderCounts int `orm:"column(orderCounts)" json:"orderCounts"` //定单数
|
||||
StatisticsForOrdersExists
|
||||
OrderCounts int `orm:"column(orderCounts)" json:"orderCounts"` //订单数
|
||||
SalePrice int `orm:"column(salePrice)" json:"salePrice"` //GMV(售卖价)
|
||||
ActualPayPrice int `orm:"column(actualPayPrice)" json:"actualPayPrice"` //实付
|
||||
ShopPrice int `orm:"column(shopPrice)" json:"shopPrice"` //京西
|
||||
@@ -26,6 +30,40 @@ type StatisticsReportForOrdersList struct {
|
||||
CityManagerGrossProfit float32 `orm:"column(cityManagerGrossProfit)" json:"cityManagerGrossProfit"`
|
||||
}
|
||||
|
||||
//是否存在这个门店
|
||||
func IsStoreExist(db *DaoDB, storeID int) (StatisticsForOrdersExists *StatisticsForOrdersExists, err error) {
|
||||
sql := `
|
||||
SELECT *
|
||||
FROM store
|
||||
WHERE id = ?
|
||||
`
|
||||
sqlParams := []interface{}{}
|
||||
sqlParams = append(sqlParams, storeID)
|
||||
|
||||
if err = GetRow(db, &StatisticsForOrdersExists, sql, sqlParams...); err == nil {
|
||||
return StatisticsForOrdersExists, nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
//查询条件内是否存在订单
|
||||
func GetStatisticsForOrdersExist(db *DaoDB, storeID int) (StatisticsForOrdersExists *StatisticsForOrdersExists, err error) {
|
||||
sql := `
|
||||
SELECT store_id
|
||||
FROM goods_order a LEFT JOIN waybill b ON IF(a.waybill_vendor_id = -1,a.vendor_order_id,a.vendor_waybill_id) = b.vendor_waybill_id
|
||||
WHERE a.store_id = ?
|
||||
GROUP BY a.store_id
|
||||
`
|
||||
sqlParams := []interface{}{}
|
||||
sqlParams = append(sqlParams, storeID)
|
||||
|
||||
if err = GetRow(db, &StatisticsForOrdersExists, sql, sqlParams...); err == nil {
|
||||
return StatisticsForOrdersExists, nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
//查询统计订单信息
|
||||
func GetStatisticsReportForOrders(db *DaoDB, storeIDs []int, fromDate time.Time, toDate time.Time) (statisticsReportForOrdersList []*StatisticsReportForOrdersList, err error) {
|
||||
//排除已取消的订单
|
||||
status := strconv.Itoa(model.OrderStatusCanceled)
|
||||
|
||||
Reference in New Issue
Block a user