diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 681b427da..e508cadf2 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -512,6 +512,13 @@ func checkBankBranch(payeeBankBranchName string) (err error) { return err } +func checkCreateStore(store *model.Store) (err error) { + if store.Lng == 0 || store.Lat == 0 || store.Address == "" { + 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 err = checkBankBranch(utils.Interface2String(payload["payeeBankBranchName"])); err != nil { @@ -694,6 +701,9 @@ func CreateStore(ctx *jxcontext.Context, storeExt *StoreExt, userName string) (i existingID := store.ID store.Lng = jxutils.StandardCoordinate2Int(storeExt.FloatLng) store.Lat = jxutils.StandardCoordinate2Int(storeExt.FloatLat) + if err = checkCreateStore(&storeExt.Store); err != nil { + return 0, err + } store.Name = jxutils.FormalizeName(store.Name) store.DeliveryRange = strings.Trim(store.DeliveryRange, ";") if store.PrinterSN != "" {