42 lines
1.2 KiB
Go
42 lines
1.2 KiB
Go
|
package model
|
||
|
|
||
|
import (
|
||
|
"encoding/json"
|
||
|
"github.com/smbrave/goutil"
|
||
|
)
|
||
|
|
||
|
var (
|
||
|
StaffSalaryExpDiscount = "staff.salary.exp.discount" //试用期薪资折扣
|
||
|
StaffSalarySocialInsurence = "staff.salary.social.insurence" //社保扣除金额
|
||
|
StaffSalaryHouseFund = "staff.salary.house.fund" //住房公积金
|
||
|
StaffSalaryPerDay = "staff.salary.per.day" //按天计算的工资
|
||
|
StaffSalaryNotify = "staff.salary.notify" //是否发送工资单
|
||
|
StaffSalaryProfitDeduct = "staff.salary.profit.deduct" //广告收益提成
|
||
|
StaffSalaryProfitTarget = "staff.salary.profit.target" //广告收益目标
|
||
|
)
|
||
|
var (
|
||
|
StaffConfigStatusNormal = 1
|
||
|
StaffConfigStatusDisable = 2
|
||
|
)
|
||
|
|
||
|
type StaffConfig struct {
|
||
|
Id int64
|
||
|
Username string
|
||
|
Config string
|
||
|
Status int
|
||
|
CreateTime int64
|
||
|
UpdateTime int64
|
||
|
}
|
||
|
|
||
|
func (u *StaffConfig) Get(key string) interface{} {
|
||
|
config := make(map[string]interface{})
|
||
|
json.Unmarshal([]byte(u.Config), &config)
|
||
|
return config[key]
|
||
|
}
|
||
|
|
||
|
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)
|
||
|
}
|