fix:新增订单关闭

This commit is contained in:
momo
2023-10-08 18:38:39 +08:00
parent d2f24772ca
commit 634f1b9584
6 changed files with 113 additions and 0 deletions

View File

@@ -108,6 +108,7 @@ type (
CloseReq struct {
Type int64 // type:1=添加购物车
OrderSn string
UserId int64 `json:"user_id"`
}
CloseRes struct {
ErrorCode basic.StatusResponse
@@ -342,6 +343,9 @@ func (d *defaultOrder) Close(ctx context.Context, in *CloseReq) (res *CloseRes,
err = d.MysqlConn.WithContext(ctx).Transaction(func(tx *gorm.DB) error {
var orderInfo gmodel.FsOrder
model := tx.Where("status = ?", int64(constants.ORDER_STATUS_UNPAIDDEPOSIT)).Where("pay_status = ?", int(constants.ORDER_PAY_STATUS_UNPAIDDEPOSIT))
if in.UserId != 0 {
model = model.Where("user_id = ?", in.UserId)
}
if in.OrderSn != "" {
model = model.Where("order_sn = ?", in.OrderSn)
}