field( [ 'w.id', 'w.avatar', 'w.nickname', 'w.region', 'w.wechatId', 'CASE WHEN w.alias IS NULL OR w.alias = "" THEN w.wechatId ELSE w.alias END AS wechatId', 'f.createTime addTime', 'f.tags' ] ) ->join('wechat_friendship f', 'w.wechatId=f.wechatId') ->find($id); if (is_null($account)) { throw new \Exception('未获取到微信账号数据', 404); } return $account->toArray(); } /** * 获取微信好友详情 * * @return \think\response\Json */ public function index() { try { $results = $this->getWechatAccountProfileById( $this->request->param('aId/d') ); return ResponseHelper::success( array_merge($results, [ 'play' => $this->getLastPlayTime($results['wechatId']), 'tags' => json_decode($results['tags'], true) ]) ); } catch (\Exception $e) { return ResponseHelper::error($e->getMessage(), $e->getCode()); } } }