enhance(fee):放开费用检索的权限。

This commit is contained in:
徐涛 2022-09-22 21:03:28 +08:00
parent c56e1128ff
commit 2ba64227d0

View File

@ -15,7 +15,7 @@ import (
)
func InitializeMaintenanceFeeController(router *gin.Engine) {
router.GET("/maintenance/fee", security.EnterpriseAuthorize, listMaintenanceFees)
router.GET("/maintenance/fee", security.MustAuthenticated, listMaintenanceFees)
router.POST("/maintenance/fee", security.EnterpriseAuthorize, createMaintenanceFeeRecord)
router.PUT("/maintenance/fee/:mid", security.EnterpriseAuthorize, modifyMaintenanceFeeRecord)
router.PUT("/maintenance/fee/:mid/enabled", security.EnterpriseAuthorize, changeMaintenanceFeeState)
@ -56,9 +56,12 @@ func listMaintenanceFees(c *gin.Context) {
return
}
if len(requestPark) > 0 {
if userSession.Type == model.USER_TYPE_ENT {
if !ensureParkBelongs(c, result, requestPark) {
result.Unauthorized("只能访问属于自己的园区。")
return
}
}
fees, total, err := service.MaintenanceFeeService.ListMaintenanceFees([]string{requestPark}, requestPeriod, requestPage)
if err != nil {
result.Error(http.StatusInternalServerError, err.Error())