1
This commit is contained in:
@@ -1693,17 +1693,55 @@ func GetStoreBaseByVendorStoreID(vendorStoreID string, vendorID int) (storeDetai
|
||||
}
|
||||
|
||||
type StatisticsStore struct {
|
||||
Count int64 `json:"count"` // 条数
|
||||
Status int `json:"status"` // 状态
|
||||
Count int `json:"count"` // 条数
|
||||
Status int `json:"status"` // 状态
|
||||
}
|
||||
|
||||
// StatisticsStoreInfo 统计所有的门店信息
|
||||
func StatisticsStoreInfo() ([]*StatisticsStore, error) {
|
||||
func StatisticsStoreInfo(db *DaoDB) ([]*StatisticsStore, error) {
|
||||
statistics := make([]*StatisticsStore, 0, 0)
|
||||
|
||||
sql := ` select count(s.status) , s.status from store s GROUP BY s.status `
|
||||
if err := GetRows(GetDB(), &statistics, sql, nil); err != nil {
|
||||
sql := ` SELECT count(s.status) count, s.status FROM store s GROUP BY s.status `
|
||||
if err := GetRows(db, &statistics, sql, nil); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return statistics, nil
|
||||
}
|
||||
|
||||
type StatisticsOrder struct {
|
||||
Count int `json:"count"` // 条数
|
||||
Status int `json:"status"` // 状态
|
||||
TotalShopMoney int `json:"total_shop_money"` // 订单金额
|
||||
}
|
||||
|
||||
// StatisticsOrderInfo 统计订单信息
|
||||
func StatisticsOrderInfo(db *DaoDB, startTime, endTime time.Time, storeId int) ([]*StatisticsOrder, error) {
|
||||
sql := ` SELECT count(g.vendor_order_id) count,g.status status ,sum(g.total_shop_money) total_shop_money FROM goods_order g WHERE g.order_created_at >= ? AND g.order_created_at <= ? `
|
||||
parma := []interface{}{startTime, endTime}
|
||||
if storeId != model.NO {
|
||||
sql += ` AND IF(g.store_id <> 0,g.store_id,g.jx_store_id) = ?`
|
||||
parma = append(parma, storeId)
|
||||
}
|
||||
sql += ` GROUP BY g.status `
|
||||
orderStatistics := make([]*StatisticsOrder, 0, 0)
|
||||
if err := GetRows(GetDB(), &orderStatistics, sql, parma...); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return orderStatistics, nil
|
||||
}
|
||||
|
||||
// StatisticsAfsOrderInfo 售后单信息统计
|
||||
func StatisticsAfsOrderInfo(db *DaoDB, startTime, endTime time.Time, storeId int) ([]*StatisticsOrder, error) {
|
||||
sql := `SELECT count(a.vendor_order_id) count,a.status status ,sum(a.afs_total_shop_money) total_shop_money FROM afs_order a WHERE a.afs_created_at >= ? AND a.afs_created_at <= ? `
|
||||
parma := []interface{}{startTime, endTime}
|
||||
if storeId != model.NO {
|
||||
sql += ` AND IF(a.store_id <> 0,a.store_id,a.jx_store_id) = 100743`
|
||||
parma = append(parma, storeId)
|
||||
}
|
||||
sql += ` GROUP BY a.status`
|
||||
orderStatistics := make([]*StatisticsOrder, 0, 0)
|
||||
if err := GetRows(GetDB(), &orderStatistics, sql, parma...); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return orderStatistics, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user