enterprise/common/model/staff_config.go

42 lines
1.2 KiB
Go
Raw Permalink Normal View History

2023-08-10 20:38:57 +08:00
package model
2024-11-04 23:00:55 +08:00
import (
"encoding/json"
"github.com/smbrave/goutil"
)
2023-08-10 20:38:57 +08:00
var (
2023-09-01 20:01:30 +08:00
StaffSalaryExpDiscount = "staff.salary.exp.discount" //试用期薪资折扣
StaffSalarySocialInsurence = "staff.salary.social.insurence" //社保扣除金额
2024-11-04 23:00:55 +08:00
StaffSalaryHouseFund = "staff.salary.house.fund" //住房公积金
2024-01-31 22:54:06 +08:00
StaffSalaryPerDay = "staff.salary.per.day" //按天计算的工资
2024-04-07 17:08:39 +08:00
StaffSalaryNotify = "staff.salary.notify" //是否发送工资单
2024-11-04 23:00:55 +08:00
StaffSalaryProfitDeduct = "staff.salary.profit.deduct" //广告收益提成
StaffSalaryProfitTarget = "staff.salary.profit.target" //广告收益目标
2023-08-10 20:38:57 +08:00
)
2023-08-31 22:20:40 +08:00
var (
2024-11-04 23:00:55 +08:00
StaffConfigStatusNormal = 1
StaffConfigStatusDisable = 2
2023-08-31 22:20:40 +08:00
)
2023-08-10 20:38:57 +08:00
2024-11-04 23:00:55 +08:00
type StaffConfig struct {
2023-08-10 20:38:57 +08:00
Id int64
Username string
Config string
2023-08-31 22:20:40 +08:00
Status int
2023-08-10 20:38:57 +08:00
CreateTime int64
UpdateTime int64
}
2024-11-04 23:00:55 +08:00
func (u *StaffConfig) Get(key string) interface{} {
2023-08-10 20:38:57 +08:00
config := make(map[string]interface{})
json.Unmarshal([]byte(u.Config), &config)
return config[key]
}
2024-11-04 23:00:55 +08:00
func (u *StaffConfig) Exist(key string) bool {
config := make(map[string]interface{})
json.Unmarshal([]byte(u.Config), &config)
return goutil.If(config[key] == nil, false, true)
}