test
This commit is contained in:
parent
58aca1ca9a
commit
feef8c457b
|
@ -1,6 +1,7 @@
|
||||||
package product
|
package product
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"database/sql"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"com.snow.auto_monitor/app/constants/errorcode"
|
"com.snow.auto_monitor/app/constants/errorcode"
|
||||||
|
@ -37,7 +38,7 @@ func GetById(c *gin.Context) {
|
||||||
CreatedAt: res.CreatedAt.Format(time.RFC3339),
|
CreatedAt: res.CreatedAt.Format(time.RFC3339),
|
||||||
Type: res.Type,
|
Type: res.Type,
|
||||||
ExtendParameter: res.ExtendParameter,
|
ExtendParameter: res.ExtendParameter,
|
||||||
QueueNo: res.QueueNo,
|
QueueNo: res.QueueNo.Int64,
|
||||||
Spec: res.Spec,
|
Spec: res.Spec,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,7 +84,7 @@ func Search(c *gin.Context) {
|
||||||
CreatedAt: item.CreatedAt.Format(time.RFC3339),
|
CreatedAt: item.CreatedAt.Format(time.RFC3339),
|
||||||
Type: item.Type,
|
Type: item.Type,
|
||||||
ExtendParameter: item.ExtendParameter,
|
ExtendParameter: item.ExtendParameter,
|
||||||
QueueNo: item.QueueNo,
|
QueueNo: item.QueueNo.Int64,
|
||||||
Spec: item.Spec,
|
Spec: item.Spec,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -118,7 +119,7 @@ func Create(c *gin.Context) {
|
||||||
Status: 1, //1.上架 2.下架
|
Status: 1, //1.上架 2.下架
|
||||||
Type: request.Type,
|
Type: request.Type,
|
||||||
ExtendParameter: request.ExtendParameter,
|
ExtendParameter: request.ExtendParameter,
|
||||||
QueueNo: request.QueueNo,
|
QueueNo: sql.NullInt64{Int64: request.QueueNo, Valid: true},
|
||||||
Spec: request.Spec,
|
Spec: request.Spec,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +151,7 @@ func Update(c *gin.Context) {
|
||||||
Price: int64(request.Price * 100),
|
Price: int64(request.Price * 100),
|
||||||
Type: request.Type,
|
Type: request.Type,
|
||||||
ExtendParameter: request.ExtendParameter,
|
ExtendParameter: request.ExtendParameter,
|
||||||
QueueNo: request.QueueNo,
|
QueueNo: sql.NullInt64{Int64: request.QueueNo, Valid: true},
|
||||||
Spec: request.Spec,
|
Spec: request.Spec,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package product
|
package product
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"database/sql"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -25,7 +26,7 @@ type Product struct {
|
||||||
|
|
||||||
Type int64
|
Type int64
|
||||||
ExtendParameter string
|
ExtendParameter string
|
||||||
QueueNo int64
|
QueueNo sql.NullInt64
|
||||||
Spec string
|
Spec string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ func Create(orders *models.Orders) (affected int64, err error) {
|
||||||
if !has {
|
if !has {
|
||||||
return 0, errors.New("产品不存在")
|
return 0, errors.New("产品不存在")
|
||||||
}
|
}
|
||||||
orders.QueueNo = product.QueueNo
|
orders.QueueNo = product.QueueNo.Int64
|
||||||
affected, err = models.GetInstance().Create(orders)
|
affected, err = models.GetInstance().Create(orders)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ func CreateOrder(orders *models.Orders) (affected int64, err error) {
|
||||||
orders.OrderNo = uuid.New().String()
|
orders.OrderNo = uuid.New().String()
|
||||||
orders.Status = 2 // 1.成功 2.充值中 3.充值失败 4.异常需要人工处理
|
orders.Status = 2 // 1.成功 2.充值中 3.充值失败 4.异常需要人工处理
|
||||||
orders.TransferStatus = 3 // 1.成功 2.充值中 3. 等待充值 4.充值失败 5.异常需要人工处理
|
orders.TransferStatus = 3 // 1.成功 2.充值中 3. 等待充值 4.充值失败 5.异常需要人工处理
|
||||||
orders.QueueNo = product.QueueNo
|
orders.QueueNo = product.QueueNo.Int64
|
||||||
affected, err = models.GetInstance().Create(orders)
|
affected, err = models.GetInstance().Create(orders)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue