|
@@ -290,9 +290,22 @@ class UserController extends Controller
|
|
public function auth(Request $request){
|
|
public function auth(Request $request){
|
|
$apiFace = new \AipFace(env('BAI_DU_YUN_APP_ID'),env('BAI_DU_YUN_API_KEY'),env('BAI_DU_YUN_SECRET_KEY'));
|
|
$apiFace = new \AipFace(env('BAI_DU_YUN_APP_ID'),env('BAI_DU_YUN_API_KEY'),env('BAI_DU_YUN_SECRET_KEY'));
|
|
|
|
|
|
-
|
|
|
|
- $apiFace->match();
|
|
|
|
-
|
|
|
|
|
|
+ try {
|
|
|
|
+ $images = array(
|
|
|
|
+ array(
|
|
|
|
+ 'image' => base64_encode(file_get_contents('1.jpg')),
|
|
|
|
+ 'image_type' => 'BASE64',
|
|
|
|
+ ),
|
|
|
|
+ array(
|
|
|
|
+ 'image' => base64_encode(file_get_contents('2.jpg')),
|
|
|
|
+ 'image_type' => 'BASE64',
|
|
|
|
+ ),
|
|
|
|
+ );
|
|
|
|
+ $res = $apiFace->match($images);
|
|
|
|
+ }catch (\Exception $exception){
|
|
|
|
+ return $this->response->errorForbidden($exception->getMessage());
|
|
|
|
+ }
|
|
|
|
+ return response()->json($res);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|