add Subscribe Discount
This commit is contained in:
@@ -769,6 +769,40 @@ func (h *ProductAdminHandler) ListSubscriptions(c *gin.Context) {
|
||||
h.responseBuilder.Success(c, result, "获取订阅列表成功")
|
||||
}
|
||||
|
||||
// BatchUpdateSubscriptionPrices 一键改价
|
||||
// @Summary 一键改价
|
||||
// @Description 管理员一键调整用户所有订阅的价格
|
||||
// @Tags 订阅管理
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security Bearer
|
||||
// @Param request body commands.BatchUpdateSubscriptionPricesCommand true "批量改价请求"
|
||||
// @Success 200 {object} map[string]interface{} "一键改价成功"
|
||||
// @Failure 400 {object} map[string]interface{} "请求参数错误"
|
||||
// @Failure 401 {object} map[string]interface{} "未认证"
|
||||
// @Failure 500 {object} map[string]interface{} "服务器内部错误"
|
||||
// @Router /api/v1/admin/subscriptions/batch-update-prices [post]
|
||||
func (h *ProductAdminHandler) BatchUpdateSubscriptionPrices(c *gin.Context) {
|
||||
var cmd commands.BatchUpdateSubscriptionPricesCommand
|
||||
if err := c.ShouldBindJSON(&cmd); err != nil {
|
||||
h.responseBuilder.BadRequest(c, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
err := h.subscriptionAppService.BatchUpdateSubscriptionPrices(c.Request.Context(), &cmd)
|
||||
if err != nil {
|
||||
h.logger.Error("一键改价失败", zap.Error(err), zap.String("user_id", cmd.UserID))
|
||||
h.responseBuilder.InternalError(c, "一键改价失败")
|
||||
return
|
||||
}
|
||||
|
||||
h.responseBuilder.Success(c, map[string]interface{}{
|
||||
"user_id": cmd.UserID,
|
||||
"discount": cmd.Discount,
|
||||
"scope": cmd.Scope,
|
||||
}, "一键改价成功")
|
||||
}
|
||||
|
||||
// GetSubscriptionStats 获取订阅统计(管理员)
|
||||
// @Summary 获取订阅统计
|
||||
// @Description 管理员获取订阅统计信息
|
||||
|
||||
Reference in New Issue
Block a user