Silent 6 anos atrás
pai
commit
9e8331a3b1

+ 1 - 1
app/Http/Controllers/TestController.php

xqd
@@ -19,7 +19,7 @@ class TestController extends Controller
         $url = 'https://apis.map.qq.com/ws/distance/v1/?from=' . $from . '&to=' . $to . '&key=' . env('TECENT_POSITION_KEY');
         $url = 'https://apis.map.qq.com/ws/distance/v1/?mode=driving&from=39.983171,116.308479&to=39.996060,116.353455;39.949227,116.394310&key=2DEBZ-SPSK3-ICA3T-Y4Y7D-EDWYQ-WBFVE';
         $res = $client->get($url);
-        
+
         $res = (string)$res->getBody();
         dd($res);
         return response()->json(['status' => 'success', 'data' => $res]);

+ 2 - 1
app/Http/Controllers/WeChat/ApiController.php

xqd
@@ -64,7 +64,8 @@ class ApiController extends Controller
         $client = new Client();
         $from = $tmp[0] . ',' . $tmp[1];
         $to = $request->input('latitude') . ',' . $request->input('longitude');
-        $res = $client->get('https://apis.map.qq.com/ws/distance/v1/', ['from' => $from, 'to' => $to, 'key' => env('TECENT_POSITION_KEY')]);
+        $url = 'https://apis.map.qq.com/ws/distance/v1/?from=' . $from . '&to=' . $to . '&key=' . env('TECENT_POSITION_KEY');
+        $res = $client->get($url);
         $res = (string)$res->getBody();
         return response()->json(['status' => 'success', 'data' => $res]);
     }

+ 11 - 11
wechat/pages/index/index.js

xqd
@@ -52,17 +52,17 @@ Page({
     })
   },
   validLocation(latitude, longitude) {
-    // wx.request({
-    //   url: api.checkPosition,
-    //   method: 'GET',
-    //   data: {
-    //     latitude: latitude,
-    //     longitude: longitude
-    //   },
-    //   success: res => {
-    //     console.log(res);
-    //   }
-    // });
+    wx.request({
+      url: api.checkPosition,
+      method: 'GET',
+      data: {
+        latitude: latitude,
+        longitude: longitude
+      },
+      success: res => {
+        console.log(res);
+      }
+    });
     return true;
   },
   handleBtnClick() {