From a47d274b00ec9b1617e0c919011338032282a3b2 Mon Sep 17 00:00:00 2001 From: jiangyong27 Date: Sat, 29 Mar 2025 17:36:20 +0800 Subject: [PATCH] usrrole4 --- server/controller/salary.go | 5 +---- server/service/staff_salary.go | 4 ++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/server/controller/salary.go b/server/controller/salary.go index f624656..f5b7110 100644 --- a/server/controller/salary.go +++ b/server/controller/salary.go @@ -19,12 +19,9 @@ func NewSalary() *Salary { func (s *Salary) List(ctx *gin.Context) { sess := ctx.Keys[session.ContextSession].(*session.AdminSession) - if !sess.GetAdmin().GetConfig().IsFinance() { - panic(config.ErrPriv.New()) - } var req api.ListSalaryReq session.CheckParamError(ctx.ShouldBind(&req)) - total, summary, items := service.NewStaffSalary().List(ctx.Keys[session.ContextSession].(*session.AdminSession), &req) + total, summary, items := service.NewStaffSalary().List(sess, &req) ctx.JSON(http.StatusOK, session.NewSummaryRsp(total, summary, items)) } diff --git a/server/service/staff_salary.go b/server/service/staff_salary.go index d31b103..9872c62 100644 --- a/server/service/staff_salary.go +++ b/server/service/staff_salary.go @@ -34,6 +34,10 @@ func NewStaffSalary() *StaffSalary { } func (s *StaffSalary) List(sess *session.AdminSession, req *api.ListSalaryReq) (int64, interface{}, interface{}) { + if !sess.GetAdmin().GetConfig().IsFinance() { + return 0, nil, nil + } + salarys, total, err := dao.NewStaffSalaryDao().QueryAdmin(1, -1, sess.GetCorpId(), req.StaffId, req.StartMonth, req.EndMonth, req.Status) session.CheckDBError(err) start := (req.Page - 1) * req.Size