fix update status

This commit is contained in:
lwl0608 2024-06-19 21:10:46 +08:00
parent 39cb825dcb
commit ff0c463020
1 changed files with 3 additions and 3 deletions

View File

@ -299,12 +299,12 @@ func (m *Mysql) GetOrderCnt(ctx *gin.Context, tx *sqlx.Tx, mid, st, et int64, or
// 更新订单状态
func (m *Mysql) UpdateOrderStatus(ctx *gin.Context, tx *sqlx.Tx, orderId string, preStatus, aftStatus int32) error {
var err error
sqlStr := "update " + TableOrder + " set order_status=? where id=? and order_status=?"
sqlStr := "update " + TableOrder + " set order_status=?,ut=? where id=? and order_status=?"
if tx != nil {
_, err = tx.ExecContext(ctx, sqlStr, aftStatus, orderId, preStatus)
_, err = tx.ExecContext(ctx, sqlStr, aftStatus, time.Now().Unix(), orderId, preStatus)
} else {
db := m.getDBVas()
_, err = db.ExecContext(ctx, sqlStr, aftStatus, orderId, preStatus)
_, err = db.ExecContext(ctx, sqlStr, aftStatus, time.Now().Unix(), orderId, preStatus)
}
if err != nil {
logger.Error("UpdateOrderStatus fail, orderId: %v, preStatus: %v, aftStatus: %v, err: %v", orderId, preStatus, aftStatus, err)