RecommandBookService.php 849 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Elton
  5. * Date: 2019/4/28
  6. * Time: 14:26
  7. */
  8. namespace app\common\service;
  9. class RecommandBookService
  10. {
  11. private static $self;
  12. public static function instance()
  13. {
  14. if(self::$self == NULL){
  15. self::$self = new self();
  16. }
  17. return self::$self;
  18. }
  19. public static function getClientSignRecommandModel()
  20. {
  21. return model('ClientSignRecommand');
  22. }
  23. public function getRecommandBooks()
  24. {
  25. $data = self::getClientSignRecommandModel()
  26. ->alias('rbook')
  27. ->join('book','rbook.book_id = book.id')
  28. ->field('rbook.*')
  29. ->field('book.name,book.image,book.first_chapter_id,book.first_chapter_name')
  30. ->where('rbook.status', 'eq', 'normal') -> select();
  31. return $data;
  32. }
  33. }