From feef8c457bd1a1881085e8ed4928d500a4e9f3a9 Mon Sep 17 00:00:00 2001 From: duyu Date: Fri, 13 Sep 2024 17:24:55 +0800 Subject: [PATCH] test --- app/http/controllers/product/product.go | 9 +++++---- app/models/product/product.go | 3 ++- app/services/orders/orders.go | 2 +- app/services/zhiliansys/zhiliansys.go | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/http/controllers/product/product.go b/app/http/controllers/product/product.go index 202d2c1..b6f4d7c 100644 --- a/app/http/controllers/product/product.go +++ b/app/http/controllers/product/product.go @@ -1,6 +1,7 @@ package product import ( + "database/sql" "time" "com.snow.auto_monitor/app/constants/errorcode" @@ -37,7 +38,7 @@ func GetById(c *gin.Context) { CreatedAt: res.CreatedAt.Format(time.RFC3339), Type: res.Type, ExtendParameter: res.ExtendParameter, - QueueNo: res.QueueNo, + QueueNo: res.QueueNo.Int64, Spec: res.Spec, } } @@ -83,7 +84,7 @@ func Search(c *gin.Context) { CreatedAt: item.CreatedAt.Format(time.RFC3339), Type: item.Type, ExtendParameter: item.ExtendParameter, - QueueNo: item.QueueNo, + QueueNo: item.QueueNo.Int64, Spec: item.Spec, }) } @@ -118,7 +119,7 @@ func Create(c *gin.Context) { Status: 1, //1.上架 2.下架 Type: request.Type, ExtendParameter: request.ExtendParameter, - QueueNo: request.QueueNo, + QueueNo: sql.NullInt64{Int64: request.QueueNo, Valid: true}, Spec: request.Spec, } @@ -150,7 +151,7 @@ func Update(c *gin.Context) { Price: int64(request.Price * 100), Type: request.Type, ExtendParameter: request.ExtendParameter, - QueueNo: request.QueueNo, + QueueNo: sql.NullInt64{Int64: request.QueueNo, Valid: true}, Spec: request.Spec, } diff --git a/app/models/product/product.go b/app/models/product/product.go index 828f8b8..6909442 100644 --- a/app/models/product/product.go +++ b/app/models/product/product.go @@ -1,6 +1,7 @@ package product import ( + "database/sql" "sync" "time" @@ -25,7 +26,7 @@ type Product struct { Type int64 ExtendParameter string - QueueNo int64 + QueueNo sql.NullInt64 Spec string } diff --git a/app/services/orders/orders.go b/app/services/orders/orders.go index 1ccb98f..013eeca 100644 --- a/app/services/orders/orders.go +++ b/app/services/orders/orders.go @@ -76,7 +76,7 @@ func Create(orders *models.Orders) (affected int64, err error) { if !has { return 0, errors.New("产品不存在") } - orders.QueueNo = product.QueueNo + orders.QueueNo = product.QueueNo.Int64 affected, err = models.GetInstance().Create(orders) return } diff --git a/app/services/zhiliansys/zhiliansys.go b/app/services/zhiliansys/zhiliansys.go index 6f0c31e..416c7a2 100644 --- a/app/services/zhiliansys/zhiliansys.go +++ b/app/services/zhiliansys/zhiliansys.go @@ -37,7 +37,7 @@ func CreateOrder(orders *models.Orders) (affected int64, err error) { orders.OrderNo = uuid.New().String() orders.Status = 2 // 1.成功 2.充值中 3.充值失败 4.异常需要人工处理 orders.TransferStatus = 3 // 1.成功 2.充值中 3. 等待充值 4.充值失败 5.异常需要人工处理 - orders.QueueNo = product.QueueNo + orders.QueueNo = product.QueueNo.Int64 affected, err = models.GetInstance().Create(orders) return }