electricity_bill_calc_service/controller/statistics.go

35 lines
981 B
Go

package controller
import (
"electricity_bill_calc/logger"
"electricity_bill_calc/response"
"electricity_bill_calc/security"
"electricity_bill_calc/service"
"github.com/gofiber/fiber/v2"
"go.uber.org/zap"
"net/http"
)
var StatisticsWithdrawLog = logger.Named("Handler", "StatisticsWithdraw")
func InitializeStatisticsController(router *fiber.App) {
router.Get("/audits", security.OPSAuthorize, currentAuditAmount)
}
//获取当前系统中待审核的内容数量
func currentAuditAmount(c *fiber.Ctx) error {
StatisticsWithdrawLog.Info("开始获取当前系统中待审核的内容数量")
result := response.NewResult(c)
amount, err := service.WithdrawService.AuditWaits()
if err != nil {
StatisticsWithdrawLog.Error("获取当前系统中待审核的内容数量出错", zap.Error(err))
return result.Error(http.StatusInternalServerError, err.Error())
}
return result.Success("已经获取到指定的统计信息",
fiber.Map{"withdraw": amount})
}