- return and receive coord as float.
This commit is contained in:
@@ -6,17 +6,20 @@ import (
|
||||
"strings"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||
)
|
||||
|
||||
type StoreExt struct {
|
||||
model.Store
|
||||
CityName string `json:"cityName"`
|
||||
DistrictName string `json:"districtName"`
|
||||
JdID string `orm:"column(jd_id)" json:"jdID"`
|
||||
ElmID string `orm:"column(elm_id)" json:"elmID"`
|
||||
EbaiID string `orm:"column(ebai_id)" json:"ebaiID"`
|
||||
FloatLng float64 `json:"lng"`
|
||||
FloatLat float64 `json:"lat"`
|
||||
CityName string `json:"cityName"`
|
||||
DistrictName string `json:"districtName"`
|
||||
JdID string `orm:"column(jd_id)" json:"jdID"`
|
||||
ElmID string `orm:"column(elm_id)" json:"elmID"`
|
||||
EbaiID string `orm:"column(ebai_id)" json:"ebaiID"`
|
||||
}
|
||||
|
||||
type StoresInfo struct {
|
||||
@@ -132,7 +135,7 @@ func GetStores(keyword string, params map[string]interface{}, offset, pageSize i
|
||||
sqlWhere += sqlVendorStoreCond + ")"
|
||||
}
|
||||
}
|
||||
sql := "SELECT SQL_CALC_FOUND_ROWS t1.*, city.name city_name, district.name district_name, jdm.vendor_store_id jd_id, elmm.vendor_store_id elm_id, ebaim.vendor_store_id ebai_id\n" +
|
||||
sql := "SELECT SQL_CALC_FOUND_ROWS CAST(t1.lng AS DECIMAL(15,6))/1000000 float_lng,CAST(t1.lat AS DECIMAL(15,6))/1000000 float_lat, t1.*, city.name city_name, district.name district_name, jdm.vendor_store_id jd_id, elmm.vendor_store_id elm_id, ebaim.vendor_store_id ebai_id\n" +
|
||||
sqlFrom + sqlWhere + `
|
||||
ORDER BY t1.id
|
||||
LIMIT ? OFFSET ?`
|
||||
@@ -187,6 +190,10 @@ func UpdateStore(storeID int, payload map[string]interface{}, userName string) (
|
||||
store := &model.Store{}
|
||||
store.ID = storeID
|
||||
valid := dao.NormalMakeMapByStructObject(payload, store, userName)
|
||||
if payload["lng"] != nil {
|
||||
valid["lng"] = jxutils.StandardCoordinate2Int(utils.Interface2FloatWithDefault(payload["lng"], 0.0))
|
||||
valid["lat"] = jxutils.StandardCoordinate2Int(utils.Interface2FloatWithDefault(payload["lat"], 0.0))
|
||||
}
|
||||
if len(valid) > 0 {
|
||||
db := dao.GetDB()
|
||||
if num, err = dao.UpdateEntityByKV(db, store, valid, nil); err == nil && num == 1 {
|
||||
|
||||
@@ -124,8 +124,8 @@ type Store struct {
|
||||
CloseTime1 int16 `json:"closeTime1"` // 格式同上
|
||||
OpenTime2 int16 `json:"openTime2"` // 格式同上
|
||||
CloseTime2 int16 `json:"closeTime2"` // 格式同上
|
||||
Lng int `json:"lng"` // 乘了10的6次方
|
||||
Lat int `json:"lat"` // 乘了10的6次方
|
||||
Lng int `json:"-"` // 乘了10的6次方
|
||||
Lat int `json:"-"` // 乘了10的6次方
|
||||
DeliveryRangeType int8 `json:"deliveryRangeType"` // 参见相关常量定义
|
||||
DeliveryRange string `orm:"size(2048)" json:"deliveryRange"` // 如果DeliveryRangeType为DeliveryRangeTypePolygon,则为逗号分隔坐标,分号分隔的坐标点(坐标与Lng和Lat一样,都是整数),比如 121361504,31189308;121420555,31150238。否则为半径,单位为米
|
||||
Status int `json:"status"`
|
||||
|
||||
Reference in New Issue
Block a user