| xqd
@@ -67,6 +67,15 @@ class ApiController extends Controller
|
|
|
$url = 'https://apis.map.qq.com/ws/distance/v1/?from=' . $from . '&to=' . $to . '&key=' . env('TECENT_POSITION_KEY');
|
|
|
$res = $client->get($url);
|
|
|
$res = json_decode((string)$res->getBody());
|
|
|
- return response()->json(['status' => 'success', 'data' => $res]);
|
|
|
+ $result = 'no';
|
|
|
+ if($res->status == 0) {
|
|
|
+ $radius = Setting::where('key', 'check_card_radius')->first();
|
|
|
+ $radius = empty($radius) ? 1000 : $radius->value;
|
|
|
+ $distance = $res->result->elements[0]->distance;
|
|
|
+ if($distance <= $radius) {
|
|
|
+ $result = 'ok';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return response()->json(['status' => 'success', 'result' => $result]);
|
|
|
}
|
|
|
}
|