示例#1
0
//周边吃喝玩乐接口
func User_Location(w http.ResponseWriter, bys []byte) {
	v := common.User_Location_Struct{}
	xml.Unmarshal(bys, &v)
	vt := common.Text_Struct{ToUserName: v.ToUserName, FromUserName: v.FromUserName, MsgType: v.MsgType}
	returndata := common.NewText(vt, "您当前的位置是:\r\n经度为: "+strconv.FormatFloat(v.Location_Y, 'f', 6, 32)+" 纬度为: "+strconv.FormatFloat(v.Location_X, 'f', 6, 32)+"\r\n地址为:"+v.Label)
	w.Write([]byte(returndata))
}
示例#2
0
func Location(w http.ResponseWriter, bys []byte) {
	v := common.Menu_Event_Struct{}
	xml.Unmarshal(bys, &v)
	vt := common.Text_Struct{ToUserName: v.ToUserName, FromUserName: v.FromUserName, MsgType: v.MsgType}
	redis_client := common.Redis_pool.Get()
	defer redis_client.Close()
	reply, _ := redis_client.Do("get", v.FromUserName)
	var location map[string]float64
	json.Unmarshal(reply.([]byte), &location)
	common.Logger.Println("location:", location)
	if len(location) == 0 {
		returndata := common.NewText(vt, "请确认你已允许微信获取您的地理位置")
		w.Write([]byte(returndata))
		return
	}
	returndata := common.NewText(vt, "经度为: "+strconv.FormatFloat(location["lon"], 'f', 6, 32)+" 纬度为: "+strconv.FormatFloat(location["lat"], 'f', 6, 32))
	w.Write([]byte(returndata))
}
示例#3
0
//关注公众号后事件的消息回复
func Guanzhu(w http.ResponseWriter, bys []byte) {
	v := common.Text_Struct{}
	xml.Unmarshal(bys, &v)
	returndata := common.NewText(v, "感谢您的关注,我们会竭诚为您服务,谢谢")
	w.Write([]byte(returndata))
}