完善商福通支付接口,修复证书加载问题;数据库扩展支付平台字段并更新支付信息保存逻辑;日志中间件异步记录日志

This commit is contained in:
2025-06-17 10:53:05 +08:00
parent 692106ae5c
commit a4e5fc2af5
19 changed files with 444 additions and 421 deletions

View File

@@ -49,7 +49,7 @@ type PageResp struct {
// region error
type BizErr struct {
type Err struct {
msg string
err error
@@ -58,18 +58,18 @@ type BizErr struct {
errFunc string
}
func (e *BizErr) Error() string {
func (e *Err) Error() string {
if e.err != nil {
return e.msg + "" + e.err.Error()
}
return e.msg
}
func (e *BizErr) Unwrap() error {
func (e *Err) Unwrap() error {
return e.err
}
func (e *BizErr) Source() *slog.Source {
func (e *Err) Source() *slog.Source {
return &slog.Source{
Function: e.errFunc,
File: e.errFile,
@@ -77,25 +77,37 @@ func (e *BizErr) Source() *slog.Source {
}
}
func NewBizErr(msg string, err ...error) (biz *BizErr) {
biz = &BizErr{
func newErr(msg string, err ...error) Err {
o := Err{
msg: msg,
}
if len(err) > 0 {
biz.err = err[0]
o.err = err[0]
}
if env.RunMode == env.RunModeDev {
pc, file, line, ok := runtime.Caller(1)
pc, file, line, ok := runtime.Caller(2)
if ok {
biz.errFile = file
biz.errLine = line
biz.errFunc = runtime.FuncForPC(pc).Name()
o.errFile = file
o.errLine = line
o.errFunc = runtime.FuncForPC(pc).Name()
}
}
return biz
return o
}
type BizErr struct{ Err }
func NewBizErr(msg string, err ...error) (biz *BizErr) {
return &BizErr{newErr(msg, err...)}
}
type ServErr struct{ Err }
func NewServErr(msg string, err ...error) *ServErr {
return &ServErr{newErr(msg, err...)}
}
// endregion