feat: 授权管理改为设置卡类价格,代理管理增加消费列
This commit is contained in:
@@ -98,10 +98,13 @@ func handleGetAgentApps(c *gin.Context) {
|
||||
}
|
||||
|
||||
type CardTypeResponse struct {
|
||||
ID uint `json:"id"`
|
||||
CardTypeID uint `json:"card_type_id"`
|
||||
Name string `json:"name"`
|
||||
CanGenerate bool `json:"can_generate"`
|
||||
ID uint `json:"id"`
|
||||
CardTypeID uint `json:"card_type_id"`
|
||||
Name string `json:"name"`
|
||||
BillingType string `json:"billing_type"`
|
||||
CanGenerate bool `json:"can_generate"`
|
||||
Price float64 `json:"price"`
|
||||
OriginPrice float64 `json:"origin_price"`
|
||||
}
|
||||
|
||||
type AgentAppResponse struct {
|
||||
@@ -142,7 +145,10 @@ func handleGetAgentApps(c *gin.Context) {
|
||||
ID: ct.ID,
|
||||
CardTypeID: ct.CardTypeID,
|
||||
Name: ct.CardType.Name,
|
||||
BillingType: ct.CardType.RechargeType,
|
||||
CanGenerate: ct.CanGenerate,
|
||||
Price: ct.Price,
|
||||
OriginPrice: ct.CardType.Price,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -746,8 +752,9 @@ func handleDirectAuthorize(c *gin.Context) {
|
||||
ApplicationID uint `json:"application_id" binding:"required"`
|
||||
Discount float64 `json:"discount"`
|
||||
CardTypes []struct {
|
||||
CardTypeID uint `json:"card_type_id" binding:"required"`
|
||||
CanGenerate bool `json:"can_generate"`
|
||||
CardTypeID uint `json:"card_type_id" binding:"required"`
|
||||
CanGenerate bool `json:"can_generate"`
|
||||
Price float64 `json:"price"`
|
||||
} `json:"card_types"`
|
||||
}
|
||||
if err := c.ShouldBindJSON(&reqBody); err != nil {
|
||||
@@ -823,6 +830,7 @@ func handleDirectAuthorize(c *gin.Context) {
|
||||
AgentApplicationID: agentApp.ID,
|
||||
CardTypeID: ct.CardTypeID,
|
||||
CanGenerate: ct.CanGenerate,
|
||||
Price: ct.Price,
|
||||
}
|
||||
if err := tx.Create(&agentCardType).Error; err != nil {
|
||||
tx.Rollback()
|
||||
@@ -838,6 +846,7 @@ func handleDirectAuthorize(c *gin.Context) {
|
||||
AgentApplicationID: agentApp.ID,
|
||||
CardTypeID: ct.ID,
|
||||
CanGenerate: false,
|
||||
Price: ct.Price,
|
||||
}
|
||||
if err := tx.Create(&agentCardType).Error; err != nil {
|
||||
tx.Rollback()
|
||||
|
||||
Reference in New Issue
Block a user