UserShelfBooksService.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: tandunzhao
  5. * Date: 2017/11/17
  6. * Time: 下午4:44
  7. */
  8. namespace App\Modules\Book\Services;
  9. use App\Modules\Book\Models\UserShelfBooks;
  10. class UserShelfBooksService
  11. {
  12. /**
  13. * 根据uid获取书架
  14. */
  15. static function getUserShelfBooksListByUid($uid,$page_size=15,$is_all=false)
  16. {
  17. return UserShelfBooks::getUserShelfBooksListByUid($uid,$page_size,$is_all);
  18. }
  19. /**
  20. * 根据uid,bid获取书架
  21. * 用于判断用户是添加本书
  22. * @param $uid
  23. * @param $bid
  24. * @return mixed
  25. */
  26. static function getUserShelfBooksListByUidAndBid($uid,$bid){
  27. return UserShelfBooks::getUserShelfBooksListByUidAndBid($uid,$bid);
  28. }
  29. /**
  30. * 获取书架图书信息
  31. * @param $id
  32. * @return model
  33. */
  34. static function getShelfById($id){
  35. return UserShelfBooks::getShelfById($id);
  36. }
  37. /**
  38. * 添加书架
  39. * @param $data
  40. * @return mixed
  41. */
  42. static function create($data){
  43. return UserShelfBooks::create($data);
  44. }
  45. /**
  46. * 删除书架
  47. * @param $uid
  48. * @param $bid
  49. * @return mixed
  50. */
  51. static function del($uid,$bid){
  52. return UserShelfBooks::where('uid',$uid)->where('bid',$bid)->delete();
  53. }
  54. }