添加优惠券功能,实现价格计算
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user