- CreateStore时检查地址信息

This commit is contained in:
gazebo
2019-07-25 19:04:49 +08:00
parent d63cd92f00
commit 382d8ac836

View File

@@ -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 != "" {