This commit is contained in:
jiangyong 2025-03-09 10:44:36 +08:00
parent 0ad00fa51b
commit abf7b6837e
1 changed files with 11 additions and 7 deletions

View File

@ -1,6 +1,7 @@
package controller package controller
import ( import (
"enterprise/common/dao"
"enterprise/server/api" "enterprise/server/api"
"enterprise/server/service" "enterprise/server/service"
"enterprise/server/session" "enterprise/server/session"
@ -24,13 +25,16 @@ func (s *Staff) Login(ctx *gin.Context) {
} }
func (s *Staff) Salary(ctx *gin.Context) { func (s *Staff) Salary(ctx *gin.Context) {
sess := ctx.Keys[session.ContextSession].(*session.AdminSession)
month := ctx.Query("month") month := ctx.Query("month")
tp := ctx.Query("type") tp := ctx.Query("type")
cid := cast.ToInt64(ctx.Query("cid")) corp, err := dao.NewCorpDao().GetByHost(sess.GetHeader().Host)
if cid == 0 { session.CheckDBError(err)
cid = 1000 session.CheckNilError(corp, "企业不存在")
}
if month == "" { if month == "" {
month = time.Now().AddDate(0, -1, 0).Format("200601") month = time.Now().AddDate(0, -1, 0).Format("200601")
} }
@ -41,11 +45,11 @@ func (s *Staff) Salary(ctx *gin.Context) {
serv := new(service.StaffSalary) serv := new(service.StaffSalary)
if tp == service.StaffSalaryTypeAgent { if tp == service.StaffSalaryTypeAgent {
serv.Agent(cid, month, ctx) serv.Agent(corp.Id, month, ctx)
} else if tp == service.StaffSalaryTypeBank { } else if tp == service.StaffSalaryTypeBank {
serv.Bank(cid, month, ctx) serv.Bank(corp.Id, month, ctx)
} else { } else {
serv.Summary(cid, month, ctx) serv.Summary(corp.Id, month, ctx)
} }
} }