解决方案 »

  1.   

    location   关键字TYPE =location  就可以 微信 事件分成 文本 位置 时间 图片神马的! 看下各个事件的关键字就好了。!!也可以用CASE 'location'
     switch($type)
                {
                case "event";
                if($customevent == "subscribe")
                {$contentStr = "感谢关注"}
                break;
                case "image"
                $contentStr ="图片很棒";
                break;
                case "location";
                $contentStr ="{$latitude},{longitude}";
                break;
                case "text";
                switch($keyword)
                {case "1"
                 $contentStr="1"
                 break;
                 case "2"
                 $contentStr ="2"
                 break;
                 default;
                 $contentStr= "hi";}
                 break;
                 }
                 $msgType = "text";
                 $resultStr = sprintf($textTpl,$fromUsername,$toUsername,$time,$msgType,$contentStr);
                 echo $resultStr;
                 }else                
                  {
      

  2.   

    http://mp.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E7%94%A8%E6%88%B7%E5%9C%B0%E7%90%86%E4%BD%8D%E7%BD%AE
      

  3.   

    现在是用微信借口已经得到传过来的信息了
    private function locationPro(){           //测试
    $arrayli = $this->weObj->getRevGeo();
    //计算最大最小经纬度
    $range = 180 / pi() * 1 / 6372.797;     //里面的 1 就代表搜索范围为1km之内
    $lngR = $range / cos($arrayli[x] * pi() / 180);
    $maxLat = $arrayli[y] + $range;//最大纬度
    $minLat = $arrayli[y] - $range;//最小纬度
    $maxLng = $arrayli[x] + $lngR;//最大经度
    $minLng = $arrayli[x] - $lngR;//最小经度
    $this->weObj->text("您现在的位置为:  ".$arrayli[label]."   "."经度为:".$arrayli[x]."纬度".$arrayli[y])->reply();     //测试
    $this->selectStores($maxLat,$minLat,$maxLng,$minLng);
    }                              
    然后根据这个经纬度,在数据库里找经纬度在最大最小范围内的数据,
    private function selectStores($maxLat,$minLat,$maxLng,$minLng){     //测试
    $store_model = M("store"); // 实例化User对象
    $condition['latitude'] = array('between','$maxLat','$minLat');
    $condition['longitude'] = array('between','$maxLng','$minLng');
    $condition['_logic'] = 'AND';
    $stores=$store_model->where($condition)->select();

    }
    这些的是不是有问题啊 我刚学php,基本的东西都不太懂,求教。
      

  4.   

    应该就是这样啦,你这还是Thinkphp框架。刚学PHP的话,已经进步很大啦
      

  5.   

    $condition['latitude'] = array('between','$min_Y,$max_Y');
    $condition['longitude'] = array('between','$min_X,$max_X');
    $condition['_logic'] = 'AND';
    $stores=$store_model->where($condition)->select();//查询范围之间的店铺但是这个查询出错了,查不出要的数据