refactor: 移除佣金比例字段,将developer统一为admin
This commit is contained in:
@@ -137,7 +137,6 @@ func handleGetAgentApps(c *gin.Context) {
|
||||
AgentEmail string `json:"agent_email"`
|
||||
ApplicationID uint `json:"application_id"`
|
||||
AppName string `json:"app_name"`
|
||||
Commission float64 `json:"commission"`
|
||||
Discount float64 `json:"discount"`
|
||||
Status string `json:"status"`
|
||||
CardTypes []CardTypeResponse `json:"card_types"`
|
||||
@@ -181,7 +180,6 @@ func handleGetAgentApps(c *gin.Context) {
|
||||
AgentEmail: agentEmail,
|
||||
ApplicationID: aa.ApplicationID,
|
||||
AppName: appName,
|
||||
Commission: aa.Commission,
|
||||
Discount: aa.Discount,
|
||||
Status: aa.Status,
|
||||
CardTypes: cardTypes,
|
||||
@@ -496,7 +494,6 @@ func handleApproveRequest(c *gin.Context) {
|
||||
AgentID: req.AgentID,
|
||||
ApplicationID: req.ApplicationID,
|
||||
DeveloperID: userID,
|
||||
Commission: 0.1,
|
||||
Discount: 1.0,
|
||||
Status: "active",
|
||||
IsReceived: true,
|
||||
@@ -606,7 +603,6 @@ func handleGetAgentAppDetail(c *gin.Context) {
|
||||
AgentEmail string `json:"agent_email"`
|
||||
ApplicationID uint `json:"application_id"`
|
||||
AppName string `json:"app_name"`
|
||||
Commission float64 `json:"commission"`
|
||||
Discount float64 `json:"discount"`
|
||||
Status string `json:"status"`
|
||||
CardTypes []CardTypeResponse `json:"card_types"`
|
||||
@@ -629,7 +625,6 @@ func handleGetAgentAppDetail(c *gin.Context) {
|
||||
AgentName: agent.Username,
|
||||
ApplicationID: agentApp.ApplicationID,
|
||||
AppName: application.Name,
|
||||
Commission: agentApp.Commission,
|
||||
Discount: agentApp.Discount,
|
||||
Status: agentApp.Status,
|
||||
CardTypes: cardTypes,
|
||||
@@ -648,7 +643,6 @@ func handleUpdateAgentApp(c *gin.Context) {
|
||||
agentAppID := c.Param("id")
|
||||
|
||||
var reqBody struct {
|
||||
Commission *float64 `json:"commission"`
|
||||
Discount *float64 `json:"discount"`
|
||||
Status *string `json:"status"`
|
||||
}
|
||||
@@ -664,9 +658,6 @@ func handleUpdateAgentApp(c *gin.Context) {
|
||||
}
|
||||
|
||||
updates := make(map[string]interface{})
|
||||
if reqBody.Commission != nil {
|
||||
updates["commission"] = *reqBody.Commission
|
||||
}
|
||||
if reqBody.Discount != nil {
|
||||
updates["discount"] = *reqBody.Discount
|
||||
}
|
||||
|
||||
@@ -40,7 +40,6 @@ type AgentTreeNode struct {
|
||||
CreatedAt string `json:"created_at"`
|
||||
LastLoginAt string `json:"last_login_at"`
|
||||
Balance float64 `json:"balance"`
|
||||
Commission float64 `json:"commission"`
|
||||
CanCreateAgent bool `json:"can_create_agent"`
|
||||
CardsCount int `json:"cards_count"`
|
||||
ChildAgentsCount int `json:"child_agents_count"`
|
||||
@@ -69,7 +68,6 @@ func handleGetAgents(c *gin.Context) {
|
||||
CreatedAt string `json:"created_at"`
|
||||
LastLoginAt string `json:"last_login_at"`
|
||||
Balance float64 `json:"balance"`
|
||||
Commission float64 `json:"commission"`
|
||||
CanCreateAgent bool `json:"can_create_agent"`
|
||||
CardsCount int `json:"cards_count"`
|
||||
ChildAgentsCount int `json:"child_agents_count"`
|
||||
@@ -110,7 +108,6 @@ func handleGetAgents(c *gin.Context) {
|
||||
CreatedAt: user.CreatedAt.Format("2006-01-02 15:04:05"),
|
||||
LastLoginAt: lastLoginAt,
|
||||
Balance: user.Balance,
|
||||
Commission: user.Commission,
|
||||
CanCreateAgent: user.CanCreateAgent,
|
||||
CardsCount: int(cardsCount),
|
||||
ChildAgentsCount: int(childAgentsCount),
|
||||
@@ -185,7 +182,6 @@ func handleGetAgentsTree(c *gin.Context) {
|
||||
CreatedAt: user.CreatedAt.Format("2006-01-02 15:04:05"),
|
||||
LastLoginAt: lastLoginAt,
|
||||
Balance: user.Balance,
|
||||
Commission: user.Commission,
|
||||
CanCreateAgent: user.CanCreateAgent,
|
||||
CardsCount: int(cardsCount),
|
||||
ChildAgentsCount: int(childAgentsCount),
|
||||
@@ -217,7 +213,6 @@ func handleCreateAgent(c *gin.Context) {
|
||||
Email string `json:"email"`
|
||||
Password string `json:"password" binding:"required"`
|
||||
ParentAgentID *uint `json:"parent_agent_id"`
|
||||
Commission float64 `json:"commission"`
|
||||
CanCreateAgent bool `json:"can_create_agent"`
|
||||
Balance float64 `json:"balance"`
|
||||
}
|
||||
@@ -259,7 +254,6 @@ func handleCreateAgent(c *gin.Context) {
|
||||
Role: "agent",
|
||||
Status: "active",
|
||||
ParentAgentID: req.ParentAgentID,
|
||||
Commission: req.Commission,
|
||||
CanCreateAgent: req.CanCreateAgent,
|
||||
Balance: req.Balance,
|
||||
}
|
||||
@@ -365,7 +359,6 @@ func handleGetAgentDetail(c *gin.Context) {
|
||||
"role": user.Role,
|
||||
"parent_agent_id": user.ParentAgentID,
|
||||
"parent_agent_name": parentAgentName,
|
||||
"commission": user.Commission,
|
||||
"can_create_agent": user.CanCreateAgent,
|
||||
"balance": user.Balance,
|
||||
"created_at": user.CreatedAt.Format("2006-01-02 15:04:05"),
|
||||
@@ -387,7 +380,6 @@ func handleUpdateAgent(c *gin.Context) {
|
||||
|
||||
var req struct {
|
||||
ParentAgentID *uint `json:"parent_agent_id"`
|
||||
Commission *float64 `json:"commission"`
|
||||
Email *string `json:"email"`
|
||||
Password *string `json:"password"`
|
||||
CanCreateAgent *bool `json:"can_create_agent"`
|
||||
@@ -414,9 +406,6 @@ func handleUpdateAgent(c *gin.Context) {
|
||||
if req.Email != nil {
|
||||
user.Email = req.Email
|
||||
}
|
||||
if req.Commission != nil {
|
||||
user.Commission = *req.Commission
|
||||
}
|
||||
if req.Password != nil && *req.Password != "" {
|
||||
hashedPassword, err := bcrypt.GenerateFromPassword([]byte(*req.Password), bcrypt.DefaultCost)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user