main #543

Merged
chenhao merged 6 commits from main into test 2024-06-21 18:26:05 +08:00
1 changed files with 3 additions and 3 deletions
Showing only changes of commit ff0c463020 - Show all commits

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)