完成获取当前系统中待审核的内容数量功能

This commit is contained in:
2023-07-26 13:43:30 +08:00
parent 39e404451e
commit 9ad3415cdb
3 changed files with 80 additions and 7 deletions

34
controller/statistics.go Normal file
View File

@@ -0,0 +1,34 @@
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})
}