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" butil "enterprise/base/util"
"enterprise/common/model" "enterprise/common/model"
"fmt" "fmt"
"github.com/skip2/go-qrcode"
"github.com/smbrave/goutil" "github.com/smbrave/goutil"
"github.com/spf13/cast" "github.com/spf13/cast"
) )
@ -71,7 +70,7 @@ type StaffUpdateReq struct {
PayeeBankCard string `json:"payee_bank_card"` PayeeBankCard string `json:"payee_bank_card"`
PayeeAlipayUid string `json:"payee_alipay_uid"` PayeeAlipayUid string `json:"payee_alipay_uid"`
Config map[string]string `json:"config"` Config string `json:"config"`
} }
func (s *StaffUser) From(m *model.StaffUser) { 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 { if req.Config != "" {
var cfg map[string]interface{} var oldCfg map[string]interface{}
json.Unmarshal([]byte(staffUser.Config), &cfg) var newCfg map[string]interface{}
if cfg == nil { json.Unmarshal([]byte(staffUser.Config), &oldCfg)
cfg = make(map[string]interface{}) json.Unmarshal([]byte(req.Config), &newCfg)
if oldCfg == nil {
oldCfg = make(map[string]interface{})
} }
for k, v := range req.Config { for k, v := range newCfg {
cfg[k] = v oldCfg[k] = v
} }
staffUser.Config = goutil.EncodeJSON(cfg) staffUser.Config = goutil.EncodeJSON(oldCfg)
} }
err = dao.NewStaffUserDao().Update(staffUser) err = dao.NewStaffUserDao().Update(staffUser)