+ checkBankBranch
This commit is contained in:
@@ -503,12 +503,19 @@ func isUpdateStoreNeedSync(valid map[string]interface{}) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func checkBankBranch(payeeBankBranchName string) (err error) {
|
||||
if payeeBankBranchName != "" {
|
||||
if strings.Index(payeeBankBranchName, "支行") == -1 || strings.Index(payeeBankBranchName, "分行") == -1 {
|
||||
err = fmt.Errorf("支行信息异常,你可能没有在使用最新的版本,请强制刷新浏览器或联系开发")
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interface{}, userName string) (num int64, err error) {
|
||||
globals.SugarLogger.Debugf("UpdateStore storeID:%d, payload:%s", storeID, utils.Format4Output(payload, false))
|
||||
if payeeBankBranchName := utils.Interface2String(payload["payeeBankBranchName"]); payeeBankBranchName != "" {
|
||||
if strings.Index(payeeBankBranchName, "支行") == -1 || strings.Index(payeeBankBranchName, "分行") == -1 {
|
||||
return 0, fmt.Errorf("你可能没有在使用最新的版本,请强制刷新浏览器或联系开发")
|
||||
}
|
||||
if err = checkBankBranch(utils.Interface2String(payload["payeeBankBranchName"])); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
db := dao.GetDB()
|
||||
store := &model.Store{}
|
||||
@@ -675,12 +682,10 @@ func EnableHaveRestStores(ctx *jxcontext.Context, isAsync, isContinueWhenError b
|
||||
}
|
||||
|
||||
func CreateStore(ctx *jxcontext.Context, storeExt *StoreExt, userName string) (id int, err error) {
|
||||
if payeeBankBranchName := storeExt.PayeeBankBranchName; payeeBankBranchName != "" {
|
||||
if strings.Index(payeeBankBranchName, "支行") == -1 || strings.Index(payeeBankBranchName, "分行") == -1 {
|
||||
return 0, fmt.Errorf("你可能没有在使用最新的版本,请强制刷新浏览器或联系开发")
|
||||
}
|
||||
}
|
||||
globals.SugarLogger.Debugf("CreateStore storeExt:%s", utils.Format4Output(storeExt, false))
|
||||
if err = checkBankBranch(storeExt.PayeeBankBranchName); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
store := &storeExt.Store
|
||||
if store.ID != 0 && !jxutils.IsLegalStoreID(store.ID) {
|
||||
return 0, fmt.Errorf("ID:%d不是合法的京西门店编号", store.ID)
|
||||
|
||||
Reference in New Issue
Block a user