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