Commit 1c388f91 by 庄欣

fix bug

parent b9648f6c
......@@ -106,16 +106,20 @@ class User extends ControllerBase
try {
empty($platform) && $platform = "wx";
$this->prefix = "user";
$res = parent::show($this->getAuth(),$this->combine(['relation' => 'third']));
$data = $this->filter($res['data']->relation_third,function($item) use ($platform){
if ($item->platform == $platform) {
return $item->token;
$client = app("client");
$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) {
$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) {
return Response::error($e->getMessage(),HttpStatus::HttpUnauthorized);
} 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