コード例 #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);
 }
コード例 #2
0
 /**
  * disable reply
  * @author Kydz 2015-06-17
  * @param  int $id reply id
  * @return respose
  */
 public function disableReply($id)
 {
     $token = Input::get('token');
     $u_id = Input::get('u_id');
     $reply = PostsReply::find($id);
     try {
         User::chkUserByToken($token, $u_id);
         $reply->disable();
         $re = ['result' => 2000, 'data' => [], 'info' => ['评论删除成功']];
     } catch (Exception $e) {
         $re = ['result' => 2001, 'data' => [], 'info' => $e->getMessage()];
     }
     return Response::json($re);
 }