-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
231 additions
and
222 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
appname = qcserver | ||
httpport = 8088 | ||
httpport = 8080 | ||
runmode = dev | ||
autorender = true | ||
copyrequestbody = true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,46 @@ | ||
package controllers | ||
|
||
import ( | ||
"encoding/json" | ||
//"encoding/json" | ||
"github.com/astaxie/beego" | ||
"qcserver/models" | ||
"strconv" | ||
"qcserver/util/log" | ||
) | ||
|
||
// Operations about object | ||
type QcMapGeneratorCtl struct { | ||
beego.Controller | ||
logger *log.Log | ||
dbSync *models.DBSync | ||
} | ||
|
||
func (this *QcMapGeneratorCtl) Prepare() { | ||
this.logger = log.GetLog() | ||
this.dbSync = models.GetDBSync() | ||
} | ||
|
||
type QcGisInfo struct { | ||
Longitude float64 | ||
Latitude float64 | ||
} | ||
|
||
type QcMapLocationInfo struct { | ||
City string | ||
Gis []QcGisInfo | ||
} | ||
|
||
// @router / [post] | ||
func (h *QcMapGeneratorCtl) Post() { | ||
var loc_param QcMapLocationInfo | ||
// @router / [get] | ||
func (h *QcMapGeneratorCtl) Get() { | ||
h.logger.LogInfo("request body: ", string(h.Ctx.Input.RequestBody)) | ||
err := json.Unmarshal(h.Ctx.Input.RequestBody, &loc_param) | ||
cityname := h.GetString("city") | ||
tmpgisdata, err := h.dbSync.GetAllGisInfo() | ||
if err != nil { | ||
h.logger.LogError("error: ", err.Error()) | ||
} | ||
h.logger.LogInfo("location param: ", loc_param.City) | ||
h.Data["City"] = loc_param.City | ||
h.Data["Gis"] = loc_param.Gis | ||
type GisInfo struct { | ||
Longitude float64 | ||
Latitude float64 | ||
} | ||
var gislist []GisInfo | ||
for index := 0; index < len(tmpgisdata); index++ { | ||
var gisdata GisInfo | ||
gisdata.Longitude, _ = strconv.ParseFloat(tmpgisdata[index].Longitude, 64) | ||
gisdata.Latitude, _ = strconv.ParseFloat(tmpgisdata[index].Latitude, 64) | ||
gislist = append(gislist, gisdata) | ||
} | ||
|
||
h.Data["City"] = cityname | ||
h.Data["Gis"] = gislist | ||
h.TplName = "bdmaptest.tpl" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"/root/workspace/gobench/src/qcserver/controllers":1485021138309828135} | ||
{"/root/workspace/gobench/src/qcserver/controllers":1485021138309828135,"/usr/local/gofile/src/qcserver/controllers":1485110755035051398} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.