From 382d8ac836156db680a531095372cfc6a20d261a Mon Sep 17 00:00:00 2001 From: gazebo Date: Thu, 25 Jul 2019 19:04:49 +0800 Subject: [PATCH] =?UTF-8?q?-=20CreateStore=E6=97=B6=E6=A3=80=E6=9F=A5?= =?UTF-8?q?=E5=9C=B0=E5=9D=80=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store.go | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 != "" {