NotificationController.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace app\api\controller;
  3. use app\common\controller\UserApi;
  4. use app\common\model\Comment;
  5. use app\common\model\Info;
  6. use app\common\model\Like;
  7. use app\common\model\Notification;
  8. use app\common\model\UserAddress;
  9. /**
  10. * 消息模块
  11. */
  12. class NotificationController extends UserApi
  13. {
  14. protected $noNeedLogin = [];
  15. protected $noNeedRight = '*';
  16. /**
  17. * 列表
  18. * @ApiParams (name=page,description=page)
  19. * @ApiParams (name=limit,description=limit)
  20. * @ApiReturnParams (name=id,description=id)
  21. * @ApiReturnParams (name=notice_type,description="like点赞,comment评论")
  22. * @ApiReturnParams (name=title,description="标题")
  23. * @ApiReturnParams (name=created_at,description="时间")
  24. * @ApiReturnParams (name=notice[body],description="如果是评论的话就是评论内容")
  25. * @ApiReturnParams (name=notice[commentable],description="如果是评论的话就是评论的帖子对象")
  26. * @ApiReturnParams (name=notice[like],description="如果是点赞的话就是点赞的帖子对象")
  27. */
  28. public function list(){
  29. $list=$this->auth
  30. ->getUser()
  31. ->notification()
  32. ->order('id','desc')
  33. ->with('from_user')
  34. ->paginate(input('limit',10));
  35. $this->success('',$list);
  36. }
  37. }