diff --git a/app/db/db_order_list.go b/app/db/db_order_list.go index eed3798..31f19ee 100644 --- a/app/db/db_order_list.go +++ b/app/db/db_order_list.go @@ -16,6 +16,14 @@ func GetOrderById(eg *xorm.Engine, id string) *model.Order { } return &order } +func GetOrderByIds(eg *xorm.Engine, id []string) *[]model.Order { + var order []model.Order + err := eg.In("oid", id).Find(&order) + if err != nil { + return nil + } + return &order +} func GetOrderByIdSess(sess *xorm.Session, id string) *model.Order { var order model.Order get, err := sess.Where("oid=?", id).Get(&order) diff --git a/app/ipad/svc/svc_order_make.go b/app/ipad/svc/svc_order_make.go index 1cb479a..f621472 100644 --- a/app/ipad/svc/svc_order_make.go +++ b/app/ipad/svc/svc_order_make.go @@ -1,6 +1,7 @@ package svc import ( + "applet/app/admin/svc/order" "applet/app/db" "applet/app/db/model" "applet/app/e" @@ -41,7 +42,9 @@ func NewOrderSortingEnd(c *gin.Context) { defer sess.Close() sess.Begin() //修改制作记录 + oids := make([]string, 0) for _, v := range args.OrderInfo { + oids = append(oids, v["oid"]) record := db.GetOrderGoods(sess, v["oid"], args.Gid, args.SkuId) if record.MakeDate > utils.StrToInt(time.Now().Format("20060102")) { sess.Rollback() @@ -98,8 +101,15 @@ func NewOrderSortingEnd(c *gin.Context) { return } } - sess.Commit() + if len(oids) > 0 { + ord := db.GetOrderByIds(eg, oids) + if ord != nil { + for _, v := range *ord { + order.JudgePackageOrdOrdState(&v) + } + } + } e.OutSuc(c, "success", nil) return }