- GetCoordinateDistrictCode
This commit is contained in:
@@ -265,21 +265,38 @@ func GetVendorStore(ctx *jxcontext.Context, vendorStoreID string, vendorID int)
|
||||
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))
|
||||
|
||||
db := dao.GetDB()
|
||||
store := &model.Store{}
|
||||
store.ID = storeID
|
||||
valid := dao.NormalMakeMapByStructObject(payload, store, userName)
|
||||
if err = dao.GetEntity(db, store); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
valid := dao.StrictMakeMapByStructObject(payload, store, userName)
|
||||
if valid["name"] != nil {
|
||||
valid["name"] = jxutils.FormalizeName(valid["name"].(string))
|
||||
}
|
||||
var lng, lat float64
|
||||
if payload["lng"] != nil {
|
||||
valid["lng"] = jxutils.StandardCoordinate2Int(utils.Interface2FloatWithDefault(payload["lng"], 0.0))
|
||||
valid["lat"] = jxutils.StandardCoordinate2Int(utils.Interface2FloatWithDefault(payload["lat"], 0.0))
|
||||
lng = utils.Interface2FloatWithDefault(payload["lng"], 0.0)
|
||||
lat = utils.Interface2FloatWithDefault(payload["lat"], 0.0)
|
||||
valid["lng"] = jxutils.StandardCoordinate2Int(lng)
|
||||
valid["lat"] = jxutils.StandardCoordinate2Int(lat)
|
||||
}
|
||||
if valid["deliveryRange"] != nil {
|
||||
valid["deliveryRange"] = strings.Trim(valid["deliveryRange"].(string), ";")
|
||||
}
|
||||
// districtCode := 0
|
||||
// if valid["districtCode"] != nil {
|
||||
// districtCode = int(utils.MustInterface2Int64(valid["districtCode"]))
|
||||
// }
|
||||
// if districtCode == 0 && store.DistrictCode == 0 {
|
||||
// if lng == 0 {
|
||||
// lng = jxutils.IntCoordinate2Standard(store.Lng)
|
||||
// lat = jxutils.IntCoordinate2Standard(store.Lat)
|
||||
// }
|
||||
// valid["districtCode"] = api.AutonaviAPI.GetCoordinateDistrictCode(lng, lat)
|
||||
// }
|
||||
if len(valid) > 0 {
|
||||
db := dao.GetDB()
|
||||
dao.Begin(db)
|
||||
defer func() {
|
||||
dao.Rollback(db)
|
||||
|
||||
Reference in New Issue
Block a user