修复了Code码重复的问题

This commit is contained in:
eson 2023-06-20 19:44:31 +08:00
parent e6971575f1
commit 37f2326b21
2 changed files with 13 additions and 8 deletions

View File

@ -72,8 +72,6 @@ func (l *UserOderDeleteLogic) UserOderDelete(req *types.RequestOrderId, userinfo
return resp.SetStatus(basic.CodeOrderNotCancelledErr)
}
//这里是将给定的PHP代码翻译成Golang代码:
uOrder := &gmodel.FsOrder{
Id: orderId,
}
@ -136,6 +134,11 @@ func (l *UserOderDeleteLogic) UserOderDelete(req *types.RequestOrderId, userinfo
PaymentIntent: pay.TradeNo,
})
}
if err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
return resp.SetStatus(basic.CodeApiErr)
}
}
// if err == nil && err == nil {
// return ResponseSuccess(200, "Cancel successfully", order)

View File

@ -22,15 +22,17 @@ var (
CodeOrderNotFoundErr = &StatusResponse{5030, "the order not found"} //未找到订单
CodeOrderNotCancelledErr = &StatusResponse{5031, "The current order cannot be cancelled"} // 当前订单无法取消
CodePayNotFoundErr = &StatusResponse{5020, "The pay not found"} // 支付信息无法查询
CodeGuestDupErr = &StatusResponse{5010, "the user is already a guest user and does not need to apply again"} // 用户已经是访客用户,不需要重复申请
CodeGuestGenErr = &StatusResponse{5011, "serialization failed for guest_id of the visitor"} // 访客ID序列化失败
CodeDbUpdateErr = &StatusResponse{5000, "update database error"} // 数据库更新错误
CodeDupGuestErr = &StatusResponse{5001, "the user is already a guest user and does not need to apply again"} // 用户已经是访客用户,不需要重复申请
CodeRequestParamsErr = &StatusResponse{5002, "invalid request param"} // 请求参数无效
CodeDbRecordNotFoundErr = &StatusResponse{5003, "db record not found"} //未在数据库中找到记录
CodeDbCreateErr = &StatusResponse{5004, "create one in database error"} // 在数据库中创建错误
CodeDbSqlErr = &StatusResponse{5005, "database is error"} // 数据库错误
CodeDbUpdateErr = &StatusResponse{5000, "update database error"} // 数据库更新错误
// 5001
CodeRequestParamsErr = &StatusResponse{5002, "invalid request param"} // 请求参数无效
CodeDbRecordNotFoundErr = &StatusResponse{5003, "db record not found"} //未在数据库中找到记录
CodeDbCreateErr = &StatusResponse{5004, "create one in database error"} // 在数据库中创建错误
CodeDbSqlErr = &StatusResponse{5005, "database is error"} // 数据库错误
)
type Response struct {