コード例 #1
0
 /**
  * replies from me
  * @author Kydz
  * @return json reply list
  */
 public function myReply()
 {
     $u_id = Input::get('u_id');
     $token = Input::get('token');
     try {
         $user = User::chkUserByToken($token, $u_id);
         $data = PostsReply::with(['post', 'toUser'])->where('u_id', '=', $u_id)->where('r_status', '=', 1)->paginate(10);
         $list = [];
         foreach ($data as $key => $reply) {
             $list[] = $reply->showInList();
         }
         $re = ['result' => 2000, 'data' => $list, 'info' => '获取我的回复成功'];
     } catch (Exception $e) {
         $code = 2001;
         if ($e->getCode() > 2000) {
             $code = $e->getCode();
         }
         $re = ['result' => $code, 'data' => [], 'info' => $e->getMessage()];
     }
     return Response::json($re);
 }