This commit is contained in:
苏尹岚
2021-03-03 14:11:22 +08:00
parent f37545de19
commit 7fa0849e17
9 changed files with 123 additions and 44 deletions

View File

@@ -1124,3 +1124,34 @@ func GetStoreAcctExpendTotal(db *DaoDB, storeID, expendType int, fromTime, toTim
err = GetRow(db, &expend, sql, sqlParams)
return expend.ExpendPrice, err
}
func GetStoreAcctExpendMore(db *DaoDB, storeID, expendType int, vendorOrderID string, fromTime, toTime time.Time) (storeAcctExpends []*model.StoreAcctExpend, err error) {
sql := `
SELECT *
FROM store_acct_expend
WHERE 1 = 1
`
sqlParams := []interface{}{}
if storeID != 0 {
sql += " AND store_id = ?"
sqlParams = append(sqlParams, storeID)
}
if expendType != 0 {
sql += " AND type = ?"
sqlParams = append(sqlParams, expendType)
}
if vendorOrderID != "" {
sql += " AND vendor_order_id = ?"
sqlParams = append(sqlParams, vendorOrderID)
}
if utils.IsTimeZero(fromTime) {
sql += " AND created_at >= ?"
sqlParams = append(sqlParams, fromTime)
}
if utils.IsTimeZero(toTime) {
sql += " AND created_at <= ?"
sqlParams = append(sqlParams, toTime)
}
err = GetRows(db, &storeAcctExpends, sql, sqlParams)
return storeAcctExpends, err
}

View File

@@ -490,14 +490,15 @@ func (v *StoreCoupons) TableIndex() [][]string {
type StoreAcctOrder struct {
ModelIDCUL
VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"`
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
StoreID int `orm:"column(store_id)" json:"storeID"` // 外部系统里记录的 jxstoreid
ActualPayPrice int `json:"actualPayPrice"` // 单位为分 顾客实际支付
UserID string `orm:"column(user_id);size(48);index" json:"userID"`
OrderType int `json:"orderType"`
Status int `json:"status"` // 参见OrderStatus*相关的常量定义 // 重复新订单消息数这个一般不是由于消息重发造成的消息重发由OrderStatus过滤一般是业务逻辑造成的
OrderFinishedAt time.Time `orm:"type(datetime)" json:"orderFinishedAt"`
VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"`
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
StoreID int `orm:"column(store_id)" json:"storeID"` // 外部系统里记录的 jxstoreid
ActualPayPrice int `json:"actualPayPrice"` // 单位为分 顾客实际支付
UserID string `orm:"column(user_id);size(48);index" json:"userID"`
OrderType int `json:"orderType"`
Status int `json:"status"` // 参见OrderStatus*相关的常量定义
OrderFinishedAt time.Time `orm:"type(datetime)" json:"orderFinishedAt"`
GoodsVendorOrderID string `orm:"column(goods_vendor_order_id);size(48)" json:"goodsVendorOrderID"` //goodsOrder表的vendorOrderID主动充值此值为空从配送管理中余额不足充值则是该订单号
}
func (v *StoreAcctOrder) TableUnique() [][]string {

View File

@@ -807,10 +807,11 @@ func (*BrandStore) TableUnique() [][]string {
type StoreAcctIncome struct {
ModelIDCUL
StoreID int `orm:"column(store_id)" json:"storeID"` //门店ID
UserID string `orm:"column(user_id)" json:"userID"` //用户ID (谁消费的)
Type int `json:"type"` //收入类型
IncomePrice int `json:"incomePrice"` //收入金额
StoreID int `orm:"column(store_id)" json:"storeID"` //门店ID
VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"`
UserID string `orm:"column(user_id)" json:"userID"` //用户ID (谁消费的)
Type int `json:"type"` //收入类型
IncomePrice int `json:"incomePrice"` //收入金额
}
func (v *StoreAcctIncome) TableIndex() [][]string {