WelfareBookService.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: z-yang
  5. * Date: 2018/7/17
  6. * Time: 11:42
  7. */
  8. namespace App\Modules\Welfare\Services;
  9. use App\Modules\Welfare\Models\WelfareBook;
  10. class WelfareBookService
  11. {
  12. public static function create($data)
  13. {
  14. return WelfareBook::createWelfareBook($data);
  15. }
  16. public static function getWelfarePromotionBooks($params, $isAll = false)
  17. {
  18. return WelfareBook::getWelfarePromotionBooks($params, $isAll);
  19. }
  20. public static function getByImportantType(bool $important)
  21. {
  22. $where = [];
  23. if ($important) {
  24. $where[] = ['is_important', '=', 1];
  25. } else {
  26. $where[] = ['is_important', '=', 0];
  27. }
  28. $where[] = ['is_enable', '=', 1];
  29. return WelfareBook::where($where)->select('bid', 'book_name', 'charge_rate', 'data_img', 'force_subscribe_rate')->get();
  30. }
  31. public static function updateWelfarePromotionBook($id, $params)
  32. {
  33. return WelfareBook::updateWelfarePromotionBook($id, $params);
  34. }
  35. }