fix:新增订单关闭
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user