This commit is contained in:
jiangyong27 2025-03-17 15:02:31 +08:00
parent 6722ab3748
commit 930f0118ba
2 changed files with 11 additions and 10 deletions

View File

@ -4,7 +4,6 @@ import (
butil "enterprise/base/util"
"enterprise/common/model"
"fmt"
"github.com/skip2/go-qrcode"
"github.com/smbrave/goutil"
"github.com/spf13/cast"
)
@ -71,7 +70,7 @@ type StaffUpdateReq struct {
PayeeBankCard string `json:"payee_bank_card"`
PayeeAlipayUid string `json:"payee_alipay_uid"`
Config map[string]string `json:"config"`
Config string `json:"config"`
}
func (s *StaffUser) From(m *model.StaffUser) {

View File

@ -169,16 +169,18 @@ func (s *StaffUser) Update(sess *session.AdminSession, req *api.StaffUpdateReq)
}
}
if len(req.Config) != 0 {
var cfg map[string]interface{}
json.Unmarshal([]byte(staffUser.Config), &cfg)
if cfg == nil {
cfg = make(map[string]interface{})
if req.Config != "" {
var oldCfg map[string]interface{}
var newCfg map[string]interface{}
json.Unmarshal([]byte(staffUser.Config), &oldCfg)
json.Unmarshal([]byte(req.Config), &newCfg)
if oldCfg == nil {
oldCfg = make(map[string]interface{})
}
for k, v := range req.Config {
cfg[k] = v
for k, v := range newCfg {
oldCfg[k] = v
}
staffUser.Config = goutil.EncodeJSON(cfg)
staffUser.Config = goutil.EncodeJSON(oldCfg)
}
err = dao.NewStaffUserDao().Update(staffUser)