From 13d1cfabe0fed07fb067db5d7fbde7c2c82fc4aa Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Tue, 18 Jun 2024 09:10:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/db/db_order_list.go | 8 ++++++++ app/ipad/svc/svc_order_make.go | 12 +++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) 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 }