Commit 1c388f91 by 庄欣

fix bug

parent b9648f6c
...@@ -106,16 +106,20 @@ class User extends ControllerBase ...@@ -106,16 +106,20 @@ class User extends ControllerBase
try { try {
empty($platform) && $platform = "wx"; empty($platform) && $platform = "wx";
$this->prefix = "user"; $this->prefix = "user";
$res = parent::show($this->getAuth(),$this->combine(['relation' => 'third'])); $client = app("client");
$data = $this->filter($res['data']->relation_third,function($item) use ($platform){ $res = $client->get($this->prefix."/".$this->getAuth()."?relation=third");
$token = "";
if (isset($res) && isset($res->relation_third) && !empty($res->relation_third)) {
foreach($res->relation_third as $item) {
if ($item->platform == $platform) { if ($item->platform == $platform) {
return $item->token; $token = $item->token;
}
} }
});
if (count($data) > 0) {
$data = $data[0];
} }
return Response::success($data->token); return Response::success([
"platform" => $platform,
"token" => $token
]);
} catch (ApiUnauthorized $e) { } catch (ApiUnauthorized $e) {
return Response::error($e->getMessage(),HttpStatus::HttpUnauthorized); return Response::error($e->getMessage(),HttpStatus::HttpUnauthorized);
} catch (\Exception $e) { } catch (\Exception $e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment