pay3
This commit is contained in:
parent
901f1dc4da
commit
d7c3256850
|
@ -56,7 +56,7 @@ type StaffPayReq struct {
|
||||||
StaffId string `json:"staff_id"`
|
StaffId string `json:"staff_id"`
|
||||||
PayType string `json:"pay_type"`
|
PayType string `json:"pay_type"`
|
||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
Amount string `json:"amount"`
|
Amount int64 `json:"amount"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type StaffUpdateReq struct {
|
type StaffUpdateReq struct {
|
||||||
|
|
|
@ -35,6 +35,7 @@ func initRoutge(engine *gin.Engine) {
|
||||||
apiGroup.GET("/staff/salary", controller.NewSalary().List)
|
apiGroup.GET("/staff/salary", controller.NewSalary().List)
|
||||||
apiGroup.POST("/staff/salary", controller.NewSalary().Create)
|
apiGroup.POST("/staff/salary", controller.NewSalary().Create)
|
||||||
apiGroup.POST("/staff/salary/pay", controller.NewSalary().Pay)
|
apiGroup.POST("/staff/salary/pay", controller.NewSalary().Pay)
|
||||||
|
apiGroup.POST("/salary/pay", controller.NewSalary().Pay)
|
||||||
apiGroup.PUT("/staff/salary", controller.NewSalary().Update)
|
apiGroup.PUT("/staff/salary", controller.NewSalary().Update)
|
||||||
apiGroup.DELETE("/staff/salary", controller.NewSalary().Delete)
|
apiGroup.DELETE("/staff/salary", controller.NewSalary().Delete)
|
||||||
|
|
||||||
|
|
|
@ -194,15 +194,10 @@ func (s *StaffUser) Pay(sess *session.AdminSession, req *api.StaffPayReq) {
|
||||||
session.CheckDBError(err)
|
session.CheckDBError(err)
|
||||||
session.CheckNilError(corp, "企业不存在")
|
session.CheckNilError(corp, "企业不存在")
|
||||||
|
|
||||||
var payReq api.PayReq
|
|
||||||
payReq.Title = req.Title
|
|
||||||
payReq.Amount = cast.ToInt64(req.Amount)
|
|
||||||
|
|
||||||
user, err := dao.NewStaffUserDao().Get(cast.ToInt64(req.StaffId))
|
user, err := dao.NewStaffUserDao().Get(cast.ToInt64(req.StaffId))
|
||||||
session.CheckDBError(err)
|
session.CheckDBError(err)
|
||||||
session.CheckNilError(user, "用户不存在")
|
session.CheckNilError(user, "用户不存在")
|
||||||
log.Errorf("pay user[%s] amount[%s]", user.Username, goutil.FormatMoney(cast.ToInt64(req.Amount)))
|
|
||||||
return
|
|
||||||
NewPay().Pay(corp, user, req.Title, req.PayType, cast.ToInt64(req.Amount))
|
NewPay().Pay(corp, user, req.Title, req.PayType, cast.ToInt64(req.Amount))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue