修复气站与配送点支付记录数据范围
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
// 功能:提供气站管理端钱包、支付、退款、提现、结算及对账接口。
|
||||
// 版本:v1.1。
|
||||
package gas
|
||||
|
||||
import (
|
||||
@@ -70,11 +72,30 @@ func getWalletChild(ctx *gin.Context, model any, table string) {
|
||||
|
||||
func ListWalletBank(ctx *gin.Context) { listWalletChild(ctx, &models.WalletBank{}, "wallet_bank") }
|
||||
func GetWalletBank(ctx *gin.Context) { getWalletChild(ctx, &models.WalletBank{}, "wallet_bank") }
|
||||
func ListPaymentOrder(ctx *gin.Context) {
|
||||
listWalletChild(ctx, &models.PaymentOrder{}, "payment_order")
|
||||
|
||||
// paymentOrderQuery 按统一支付单关联的业务对象限定当前气站数据范围。
|
||||
func paymentOrderQuery(station models.GasBasic) *gorm.DB {
|
||||
query := common.ActiveRecords(impl.DBService.Model(&models.PaymentOrder{}))
|
||||
return common.ScopePaymentOrdersByOwner(query, "gas", station.ID, station.Identity)
|
||||
}
|
||||
|
||||
// ListPaymentOrder 返回当前气站业务范围内的统一支付记录。
|
||||
func ListPaymentOrder(ctx *gin.Context) {
|
||||
station, ok := currentGas(ctx)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
listScoped(ctx, &models.PaymentOrder{}, paymentOrderQuery(station), "payment_order.created_at desc")
|
||||
}
|
||||
|
||||
// GetPaymentOrder 返回当前气站业务范围内的单条统一支付记录。
|
||||
func GetPaymentOrder(ctx *gin.Context) {
|
||||
getWalletChild(ctx, &models.PaymentOrder{}, "payment_order")
|
||||
station, ok := currentGas(ctx)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
query := paymentOrderQuery(station).Where("payment_order.identity = ?", ctx.Param("identity"))
|
||||
respondScopedRecord(ctx, query, &models.PaymentOrder{})
|
||||
}
|
||||
func ListWalletRecord(ctx *gin.Context) {
|
||||
listWalletChild(ctx, &models.WalletRecord{}, "wallet_record")
|
||||
|
||||
Reference in New Issue
Block a user