添加优惠券功能,实现价格计算

This commit is contained in:
2025-04-19 14:59:19 +08:00
parent 999d0b0a1d
commit 058c4f4313
9 changed files with 581 additions and 19 deletions

View File

@@ -144,3 +144,37 @@ func (ldt *LocalDateTime) UnmarshalJSON(b []byte) error {
}
// endregion
// region err
type ServiceErr struct {
code int
name string
msg string
}
func (e ServiceErr) Code() int {
return e.code
}
func (e ServiceErr) Name() string {
return e.name
}
func (e ServiceErr) Error() string {
return e.msg
}
func NewErr(name, msg string, code ...int) ServiceErr {
_code := 400
if len(code) > 0 {
_code = code[0]
}
return ServiceErr{
name: name,
msg: msg,
code: _code,
}
}
// endregion