88 lines
2.7 KiB
Go
88 lines
2.7 KiB
Go
package backend
|
|
|
|
import (
|
|
"PaymentCenter/app/constants/errorcode"
|
|
"PaymentCenter/app/http/controllers"
|
|
"PaymentCenter/app/http/entities"
|
|
"PaymentCenter/app/http/entities/backend"
|
|
"PaymentCenter/app/models/ordercallbacklogmodel"
|
|
"PaymentCenter/app/models/orderrequestlogmodel"
|
|
"PaymentCenter/app/models/ordersmodel"
|
|
"PaymentCenter/app/models/orderthirdpaylogmodel"
|
|
"PaymentCenter/app/services"
|
|
"github.com/ahmetb/go-linq/v3"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func OrderList(c *gin.Context) {
|
|
req, _ := controllers.GetRequest(c).(*backend.OrderListRequest)
|
|
filter, err := req.ValidateRequest()
|
|
if err != nil {
|
|
controllers.Error(c, errorcode.ParamError, err.Error())
|
|
return
|
|
}
|
|
orderList, total, code := services.OrderList(filter)
|
|
|
|
result := make([]backend.OrdersResponse, 0, len(orderList))
|
|
linq.From(orderList).SelectT(func(in ordersmodel.OrdersBackendList) (out backend.OrdersResponse) {
|
|
out.ResponseFromDb(in)
|
|
return
|
|
}).ToSlice(&result)
|
|
data := entities.PageRsp{
|
|
Total: total,
|
|
Data: result,
|
|
}
|
|
controllers.HandCodeRes(c, data, code)
|
|
}
|
|
|
|
func OrderRequestLogsList(c *gin.Context) {
|
|
req, _ := controllers.GetRequest(c).(*backend.OrderLogsListRequest)
|
|
req.SetDefault()
|
|
requestLog, total, code := services.OrderRequestLogsList(*req)
|
|
|
|
requestLogList := make([]backend.OrderRequestLogResponse, 0, len(requestLog))
|
|
linq.From(requestLog).SelectT(func(in orderrequestlogmodel.OrderRequestLog) (out backend.OrderRequestLogResponse) {
|
|
out.ResponseFromDb(in)
|
|
return
|
|
}).ToSlice(&requestLogList)
|
|
|
|
controllers.HandCodeRes(c, entities.PageRsp{
|
|
Total: total,
|
|
Data: requestLogList,
|
|
}, code)
|
|
}
|
|
|
|
func OrderThirdLogsList(c *gin.Context) {
|
|
req, _ := controllers.GetRequest(c).(*backend.OrderLogsListRequest)
|
|
req.SetDefault()
|
|
thirdLog, total, code := services.OrderThirdLogsList(*req)
|
|
|
|
thirdLogList := make([]backend.OrderThirdLogResponse, 0, len(thirdLog))
|
|
linq.From(thirdLog).SelectT(func(in orderthirdpaylogmodel.OrderThirdPayLog) (out backend.OrderThirdLogResponse) {
|
|
out.ResponseFromDb(in)
|
|
return
|
|
}).ToSlice(&thirdLogList)
|
|
|
|
controllers.HandCodeRes(c, entities.PageRsp{
|
|
Total: total,
|
|
Data: thirdLogList,
|
|
}, code)
|
|
}
|
|
|
|
func OrderCallbackLogsList(c *gin.Context) {
|
|
req, _ := controllers.GetRequest(c).(*backend.OrderLogsListRequest)
|
|
req.SetDefault()
|
|
callbackLog, total, code := services.OrderCallbackLogsList(*req)
|
|
|
|
callbackLogList := make([]backend.OrderCallbackLogResponse, 0, len(callbackLog))
|
|
linq.From(callbackLog).SelectT(func(in ordercallbacklogmodel.OrderCallbackLog) (out backend.OrderCallbackLogResponse) {
|
|
out.ResponseFromDb(in)
|
|
return
|
|
}).ToSlice(&callbackLogList)
|
|
|
|
controllers.HandCodeRes(c, entities.PageRsp{
|
|
Total: total,
|
|
Data: callbackLogList,
|
|
}, code)
|
|
}
|