You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.1 KiB
Go
51 lines
1.1 KiB
Go
![]()
1 week ago
|
package run_log
|
||
|
|
||
|
import (
|
||
|
"cls/internal/domain/run_log"
|
||
|
"cls/pkg/logger"
|
||
|
"cls/pkg/xorm_engine"
|
||
|
"strings"
|
||
|
)
|
||
|
|
||
|
type RunLogRepositoryORM struct {
|
||
|
engine *xorm_engine.Engine
|
||
|
log logger.Logger
|
||
|
}
|
||
|
|
||
|
func NewRunLogRepositoryORM(engine *xorm_engine.Engine, log logger.New) run_log.RunLogRepository {
|
||
|
return &RunLogRepositoryORM{engine, log("cls:persistence:run_log")}
|
||
|
}
|
||
|
|
||
|
var _ run_log.RunLogRepository = (*RunLogRepositoryORM)(nil)
|
||
|
|
||
|
func (r *RunLogRepositoryORM) Log(log *run_log.RunLog) {
|
||
|
_, err := r.engine.Insert(log)
|
||
|
if err != nil {
|
||
|
r.log.Error(err)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (r *RunLogRepositoryORM) LogOrderInfo(orderNo string, info string, remark ...string) {
|
||
|
_, err := r.engine.Insert(&run_log.RunLog{
|
||
|
LogType: run_log.LogTypeOrder,
|
||
|
OrderNo: orderNo,
|
||
|
Info: info,
|
||
|
Remark: strings.Join(remark, "|"),
|
||
|
})
|
||
|
if err != nil {
|
||
|
r.log.Error(err)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (r *RunLogRepositoryORM) LogPaymentInfo(orderNo string, info string, remark ...string) {
|
||
|
_, err := r.engine.Insert(&run_log.RunLog{
|
||
|
LogType: run_log.LogTypePayment,
|
||
|
OrderNo: orderNo,
|
||
|
Info: info,
|
||
|
Remark: strings.Join(remark, "|"),
|
||
|
})
|
||
|
if err != nil {
|
||
|
r.log.Error(err)
|
||
|
}
|
||
|
}
|