This commit is contained in:
suyl
2021-06-02 18:28:38 +08:00
parent c219481ad5
commit 34e3dc9910
8 changed files with 95 additions and 39 deletions

View File

@@ -2,6 +2,7 @@ package cms
import (
"bytes"
"encoding/base64"
"encoding/json"
"errors"
"fmt"
@@ -4816,3 +4817,29 @@ func GetPageBrands(ctx *jxcontext.Context) (brands []*model.PageBrand, err error
dao.GetRows(db, &brands, sql)
return brands, err
}
func AddStoreMapAudit(ctx *jxcontext.Context, storeID, vendorID int, vendorOrgCode, vendorStoreID, vendorStoreName, vendorAccount, vendorPasswaord string) (err error) {
var (
db = dao.GetDB()
storeMapAudit = &model.StoreMapAudit{
StoreID: storeID,
VendorID: vendorID,
VendorOrgCode: vendorOrgCode,
VendorStoreID: vendorStoreID,
VendorStoreName: vendorStoreName,
VendorAccount: vendorAccount,
}
)
if vendorPasswaord != "" {
if configList, err := dao.QueryConfigs(db, "jxKeyIV", model.ConfigTypeSys, ""); err == nil && len(configList) > 0 {
aesKey, iv := configList[0].Value, configList[0].Value
if data, err2 := utils.AESCBCEncpryt([]byte(vendorPasswaord), []byte(aesKey), []byte(iv)); err2 == nil {
vendorPasswaord = base64.StdEncoding.EncodeToString(data)
}
}
storeMapAudit.VendorPasswaord = vendorPasswaord
}
dao.WrapAddIDCULDEntity(storeMapAudit, ctx.GetUserName())
dao.CreateEntity(db, storeMapAudit)
return err
}