- 配置类型增加银行
This commit is contained in:
@@ -83,6 +83,7 @@ func InitServiceInfo(version string, buildTime time.Time, gitCommit string) {
|
||||
"actStatusName": model.ActStatusName,
|
||||
"actCreateTypeName": model.ActCreateTypeName,
|
||||
"storeAuditStatusName": model.StoreAuditStatusName,
|
||||
"configTypeList": model.ConfigTypeList,
|
||||
},
|
||||
}
|
||||
Init()
|
||||
@@ -205,10 +206,16 @@ func checkConfig(configType, value string) (err error) {
|
||||
err = fmt.Errorf("配置:%s不合法", value)
|
||||
}
|
||||
}
|
||||
case model.ConfigTypeBank:
|
||||
if value != "" {
|
||||
if model.BankName[value] == "" {
|
||||
err = fmt.Errorf("些银行代码:%s不支持,请联系开发", value)
|
||||
}
|
||||
}
|
||||
default:
|
||||
err = fmt.Errorf("当前只支持价格包配置:%s", model.ConfigTypePricePack)
|
||||
err = fmt.Errorf("当前只支持配置:%s, 传入的配置类型:%s", utils.Format4Output(model.ConfigTypeList, true), configType)
|
||||
}
|
||||
return
|
||||
return err
|
||||
}
|
||||
|
||||
func AddConfig(ctx *jxcontext.Context, key, configType, value string) (err error) {
|
||||
@@ -230,22 +237,25 @@ func DeleteConfig(ctx *jxcontext.Context, key, configType string) (err error) {
|
||||
if err = checkConfig(configType, ""); err != nil {
|
||||
return err
|
||||
}
|
||||
db := dao.GetDB()
|
||||
storeMapList, err := dao.GetStoresMapList(db, nil, nil, model.StoreStatusAll, model.StoreIsSyncYes, key)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(storeMapList) > 0 {
|
||||
var storeInfo []string
|
||||
for _, v := range storeMapList {
|
||||
storeInfo = append(storeInfo, fmt.Sprintf("门店:%d, 平台:%s", v.StoreID, model.VendorChineseNames[v.VendorID]))
|
||||
switch configType {
|
||||
case model.ConfigTypePricePack:
|
||||
db := dao.GetDB()
|
||||
storeMapList, err := dao.GetStoresMapList(db, nil, nil, model.StoreStatusAll, model.StoreIsSyncYes, key)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return fmt.Errorf("还有门店在使用价格包:%s,门店信息:%s", key, strings.Join(storeInfo, ","))
|
||||
if len(storeMapList) > 0 {
|
||||
var storeInfo []string
|
||||
for _, v := range storeMapList {
|
||||
storeInfo = append(storeInfo, fmt.Sprintf("门店:%d, 平台:%s", v.StoreID, model.VendorChineseNames[v.VendorID]))
|
||||
}
|
||||
return fmt.Errorf("还有门店在使用价格包:%s,门店信息:%s", key, strings.Join(storeInfo, ","))
|
||||
}
|
||||
_, err = dao.DeleteEntityLogically(db, &model.NewConfig{}, nil, ctx.GetUserName(), map[string]interface{}{
|
||||
"Key": key,
|
||||
"Type": configType,
|
||||
})
|
||||
}
|
||||
_, err = dao.DeleteEntityLogically(db, &model.NewConfig{}, nil, ctx.GetUserName(), map[string]interface{}{
|
||||
"Key": key,
|
||||
"Type": configType,
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -291,3 +301,7 @@ func UpdateConfig(ctx *jxcontext.Context, key, configType, value string) (err er
|
||||
dao.Commit(db)
|
||||
return err
|
||||
}
|
||||
|
||||
func QueryConfigs(key, configType, keyword string) (configList []*model.NewConfig, err error) {
|
||||
return dao.QueryConfigs(dao.GetDB(), key, configType, keyword)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user