修复门店配送范围时,检查数据合法性
This commit is contained in:
@@ -524,6 +524,20 @@ func checkCreateStore(store *model.Store) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
func checkStoreDeliveryRange(deliveryRange string) (err error) {
|
||||
if deliveryRange != "" {
|
||||
points := jxutils.CoordinateStr2Points(deliveryRange)
|
||||
for _, point := range points {
|
||||
for _, coord := range point {
|
||||
if coord == 0 || math.IsNaN(coord) {
|
||||
return fmt.Errorf("坐标点数据非法:%s", deliveryRange)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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, true))
|
||||
if err = checkBankBranch(utils.Interface2String(payload["payeeBankBranchName"])); err != nil {
|
||||
@@ -537,6 +551,9 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa
|
||||
}
|
||||
|
||||
valid := dao.StrictMakeMapByStructObject(payload, store, userName)
|
||||
if err = checkStoreDeliveryRange(utils.Interface2String(valid["deliveryRange"])); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if globals.EnableWXAuth2 {
|
||||
if err = dao.ValidateRoles(db, utils.Interface2String(valid["marketManRole"]), utils.Interface2String(valid["operatorRole"]), utils.Interface2String(valid["operatorRole2"])); err != nil {
|
||||
return 0, err
|
||||
|
||||
Reference in New Issue
Block a user