差评补款

This commit is contained in:
苏尹岚
2019-12-26 18:36:58 +08:00
parent c22581636d
commit cfb1a2e052
4 changed files with 95 additions and 1 deletions

View File

@@ -746,3 +746,39 @@ func RefreshOrdersWithoutJxStoreID(ctx *jxcontext.Context, fromDate, toDate stri
}
return hint, err
}
func GetOrdersSupplement(ctx *jxcontext.Context, storIDs, vendorIDs []int, vendorOrderID, fromTime, toTime string, status, stype, offset, pageSize int) (pageInfo *model.PagedInfo, err error) {
var (
db = dao.GetDB()
fromTimeP time.Time
toTimeP time.Time
)
if fromTime != "" {
fromTimeP = utils.Str2Time(fromTime)
}
if toTime != "" {
toTimeP = utils.Str2Time(toTime)
}
result, totalCount, err := dao.GetOrdersSupplement(db, storIDs, vendorIDs, vendorOrderID, fromTimeP, toTimeP, status, stype, offset, pageSize)
pageInfo = &model.PagedInfo{
Data: result,
TotalCount: totalCount,
}
return pageInfo, err
}
func AddUpdateOrdersSupplement(ctx *jxcontext.Context, ordersSupplement *model.OrderSupplementFee) (num int, err error) {
var (
db = dao.GetDB()
id = ordersSupplement.ID
)
if id > 0 {
if ordersSupplement.Status == 1 {
return 0,fmt.Errorf("已结账的扣款信息不允许修改", a)
}
dao.UpdateEntity(db, ordersSupplement)
} else {
}
return num, err
}

View File

@@ -345,7 +345,22 @@ type OrderPayRefund struct {
type OrderSupplementFee struct {
ModelIDCULD
VendorOrderID string `orm:"column(vendor_order_id);index;size(48)" json:"vendorOrderID"`
StoreID int `orm:"column(store_id)" json:"storeID"`
VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"`
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
Status int `json:"status"` //账单状态,若已结账则不允许再修改 ,暂时 0为未结账1为已结账
LinkID int `orm:"column(link_id)" json:"linkID"` //作为冲账标志关联某条扣款记录
SupplementTime *time.Time `orm:"type(datetime);null" json:"supplementTime"`
Type int `json:"type"` //扣款类型1为差评订单补贴2为优惠券
SupplementFee int `json:"supplementFee"` //扣款金额
BillID string `orm:"column(bill_id);size(48)" json:"billID"` //账单ID
Comment string `orm:"size(255)" json:"comment"`
}
func (v *OrderSupplementFee) TableIndex() [][]string {
return [][]string{
[]string{"StoreID", "VendorOrderID", "SupplementTime", "VendorID", "BillID"},
}
}
// 判断是否是购买平台自有物流