- CreateStore时检查地址信息
This commit is contained in:
@@ -512,6 +512,13 @@ func checkBankBranch(payeeBankBranchName string) (err error) {
|
|||||||
return err
|
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) {
|
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))
|
globals.SugarLogger.Debugf("UpdateStore storeID:%d, payload:%s", storeID, utils.Format4Output(payload, false))
|
||||||
if err = checkBankBranch(utils.Interface2String(payload["payeeBankBranchName"])); err != nil {
|
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
|
existingID := store.ID
|
||||||
store.Lng = jxutils.StandardCoordinate2Int(storeExt.FloatLng)
|
store.Lng = jxutils.StandardCoordinate2Int(storeExt.FloatLng)
|
||||||
store.Lat = jxutils.StandardCoordinate2Int(storeExt.FloatLat)
|
store.Lat = jxutils.StandardCoordinate2Int(storeExt.FloatLat)
|
||||||
|
if err = checkCreateStore(&storeExt.Store); err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
store.Name = jxutils.FormalizeName(store.Name)
|
store.Name = jxutils.FormalizeName(store.Name)
|
||||||
store.DeliveryRange = strings.Trim(store.DeliveryRange, ";")
|
store.DeliveryRange = strings.Trim(store.DeliveryRange, ";")
|
||||||
if store.PrinterSN != "" {
|
if store.PrinterSN != "" {
|
||||||
|
|||||||
Reference in New Issue
Block a user