/** * 组合私信内容 * * @param $data * @return mixed * @author yangyifan <*****@*****.**> */ private static function mergeLetter($data) { if (!empty($data)) { foreach ($data as $letter) { $letter->user_info = UserModel::getUserSimpleInfo($letter->user_info_id); } } return $data; }
/** * 帖子详情 * * @return \Illuminate\View\View * @author yangyifan <*****@*****.**> */ public function getInfo(Request $request, $id) { //获得帖子内容 $forum_info = ForumModel::getInfo($id); if (empty($forum_info)) { return redirect()->action('Home\\ForumController@getIndex'); } return view('home.forum.info', ['user_profile' => UserModel::getUserProfile($forum_info->user_info_id), 'data' => $forum_info, 'title' => '论坛-' . $forum_info->title, 'keywords' => '论坛-' . $forum_info->title, 'description' => '论坛-' . $forum_info->title]); }
/** * 获得帖子评论信息 * * @param $id * @return mixed * @author yangyifan <*****@*****.**> */ private static function getForumComment($id) { $comment_list = DB::table('forum_comment')->where('forum_id', '=', $id)->where('status', '=', '1')->orderBy('id', 'DESC')->paginate(config('config.forum_comment_page_limit')); if (!empty($comment_list)) { foreach ($comment_list as $comment) { $comment->user_info = UserModel::getUserSimpleInfo($comment->user_info_id); } } return $comment_list; }
/** * 处理查找会员 * * @param AddUsersRequest $request * @author yangyifan <*****@*****.**> */ public function postSearchFriend(AddUsersRequest $request) { //添加好友 $user_list = UserModel::SearchFriend(intval($request->get('id'))); return !empty($user_list) ? $this->response($code = 200, $msg = '', $data = $user_list) : $this->response(400, trans('response.search_empty')); }
/** * 更新用户密码 * * @param Passwordequest $request * @author yangyifan <*****@*****.**> */ public function postUpdatePassword(Passwordequest $request) { $status = UserModel::updatePassword($request->only('old_password', 'password')); if ($status === true) { $this->response(200, trans('response.update_user_password_success')); } else { if ($status == -1) { $this->response(400, trans('response.old_password_error')); } else { if ($status === false) { $this->response(400, trans('response.update_user_password_error')); } } } }
/** * 获得好友数据 * * @param Request $request * @author yangyifan <*****@*****.**> */ public function postFriend() { return $this->response($code = 200, $msg = '', $data = UserModel::onlineUser()); }