差评补款
This commit is contained in:
@@ -770,6 +770,9 @@ func GetOrdersSupplement(ctx *jxcontext.Context, storIDs, vendorIDs []int, vendo
|
||||
if toTime != "" {
|
||||
toTimeP = utils.Str2Time(toTime)
|
||||
}
|
||||
if fromTimeP.After(toTimeP) {
|
||||
return nil, fmt.Errorf("时间范围不合法!开始时间:[%v],结束时间:[%v]", fromTimeP, toTimeP)
|
||||
}
|
||||
result, totalCount, err := dao.GetOrdersSupplement(db, storIDs, vendorIDs, vendorOrderID, fromTimeP, toTimeP, status, stype, offset, pageSize)
|
||||
pageInfo = &model.PagedInfo{
|
||||
Data: result,
|
||||
@@ -778,18 +781,37 @@ func GetOrdersSupplement(ctx *jxcontext.Context, storIDs, vendorIDs []int, vendo
|
||||
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 {
|
||||
|
||||
// }
|
||||
func AddUpdateOrdersSupplement(ctx *jxcontext.Context, ordersSupplement *model.OrderSupplementFee) (num int64, err error) {
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
id = ordersSupplement.ID
|
||||
)
|
||||
now := time.Now()
|
||||
ordersSupplement.SupplementTime = &now
|
||||
defer func() {
|
||||
if r := recover(); r != nil || err != nil {
|
||||
dao.Rollback(db)
|
||||
if r != nil {
|
||||
panic(r)
|
||||
}
|
||||
}
|
||||
}()
|
||||
if id > 0 {
|
||||
if ordersSupplement.Status == 1 {
|
||||
return 0, fmt.Errorf("已结账的扣款信息不允许修改!门店ID:[%v],订单号:[%v]", ordersSupplement.StoreID, ordersSupplement.VendorOrderID)
|
||||
}
|
||||
ordersSupplement.UpdatedAt = time.Now()
|
||||
ordersSupplement.LastOperator = ctx.GetUserName()
|
||||
if ordersSupplement.Status == -1 {
|
||||
ordersSupplement.DeletedAt = time.Now()
|
||||
} else {
|
||||
ordersSupplement.DeletedAt = utils.DefaultTimeValue
|
||||
}
|
||||
num, err = dao.UpdateEntity(db, ordersSupplement)
|
||||
} else {
|
||||
dao.WrapAddIDCULDEntity(ordersSupplement, ctx.GetUserName())
|
||||
err = dao.CreateEntity(db, ordersSupplement)
|
||||
}
|
||||
dao.Commit(db)
|
||||
return num, err
|
||||
}
|
||||
|
||||
@@ -347,8 +347,8 @@ type OrderSupplementFee struct {
|
||||
ModelIDCULD
|
||||
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为已结账
|
||||
VendorID *string `orm:"column(vendor_id)" json:"vendorID"`
|
||||
Status int `json:"status"` //账单状态,若已结账则不允许再修改 ,暂时 0为未结账,1为已结账,-1为作废
|
||||
LinkID int `orm:"column(link_id)" json:"linkID"` //作为冲账标志关联某条扣款记录
|
||||
SupplementTime *time.Time `orm:"type(datetime);null" json:"supplementTime"`
|
||||
Type int `json:"type"` //扣款类型,1为差评订单补贴,2为优惠券
|
||||
|
||||
@@ -929,12 +929,12 @@ func (c *OrderController) ComplaintRider() {
|
||||
// @Title 查询门店订单扣款记录
|
||||
// @Description 查询门店订单扣款记录
|
||||
// @Param token header string true "认证token"
|
||||
// @Param storeIDs query string true "门店ID列表"
|
||||
// @Param vendorOrderID query string true "订单ID"
|
||||
// @Param vendorIDs query string true "订单所属厂商ID列表"
|
||||
// @Param storeIDs query string false "门店ID列表"
|
||||
// @Param vendorOrderID query string false "订单ID"
|
||||
// @Param vendorIDs query string false "订单所属厂商ID列表"
|
||||
// @Param fromTime query string false "开始日期(包含),格式(2006-01-02),如果订单号为空此项必须要求"
|
||||
// @Param toTime query string false "结束日期(包含),格式(2006-01-02),如果订单号为空此项必须要求"
|
||||
// @Param status query int false "账单状态,0是未结账,1是已结账,2是冲账"
|
||||
// @Param status query int false "账单状态,0是未结账,1是已结账"
|
||||
// @Param type query int false "扣款类型,1为差评补贴,2为优惠券"
|
||||
// @Param offset query int false "结果起始序号(以0开始,缺省为0)"
|
||||
// @Param pageSize query int false "结果页大小(缺省为50,-1表示全部)"
|
||||
|
||||
@@ -711,6 +711,15 @@ func init() {
|
||||
Filters: nil,
|
||||
Params: nil})
|
||||
|
||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"],
|
||||
beego.ControllerComments{
|
||||
Method: "AddUpdateOrdersSupplement",
|
||||
Router: `/AddUpdateOrdersSupplement`,
|
||||
AllowHTTPMethods: []string{"post"},
|
||||
MethodParams: param.Make(),
|
||||
Filters: nil,
|
||||
Params: nil})
|
||||
|
||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"],
|
||||
beego.ControllerComments{
|
||||
Method: "AdjustOrder",
|
||||
@@ -927,6 +936,15 @@ func init() {
|
||||
Filters: nil,
|
||||
Params: nil})
|
||||
|
||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"],
|
||||
beego.ControllerComments{
|
||||
Method: "GetOrdersSupplement",
|
||||
Router: `/GetOrdersSupplement`,
|
||||
AllowHTTPMethods: []string{"get"},
|
||||
MethodParams: param.Make(),
|
||||
Filters: nil,
|
||||
Params: nil})
|
||||
|
||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"],
|
||||
beego.ControllerComments{
|
||||
Method: "GetPrinterStatus",
|
||||
|
||||
Reference in New Issue
Block a user