PopularizePageShowFactory.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: blank
  5. * Date: 2018/11/29
  6. * Time: 10:25
  7. */
  8. namespace app\common\services\popularize;
  9. use app\common\exceptions\AppException;
  10. use app\common\models\Income;
  11. use app\frontend\modules\finance\interfaces\IIncomePage;
  12. class PopularizePageShowFactory
  13. {
  14. /**
  15. * @var IIncomePage
  16. */
  17. private $_income;
  18. /**
  19. * 会员是否是推客
  20. *
  21. * @var bool
  22. */
  23. private $is_agent;
  24. /**
  25. * 是否开启关系链
  26. *
  27. * @var bool
  28. */
  29. private $is_relation;
  30. private $lang_set;
  31. public function __construct(IIncomePage $income, $lang_set, $is_relation = false, $is_agent = false)
  32. {
  33. $this->_income = $income;
  34. $this->is_agent = $is_agent;
  35. $this->is_relation = $is_relation;
  36. $this->lang_set = $lang_set;
  37. }
  38. public function getMark()
  39. {
  40. return $this->_income->getMark();
  41. }
  42. /**
  43. * 收入模型是否显示
  44. *
  45. * @return bool
  46. */
  47. public function isShow()
  48. {
  49. return $this->_income->isShow();
  50. }
  51. /**
  52. * 收入页的前端路由
  53. * @return string 前端路由名
  54. */
  55. public function getAppUrl()
  56. {
  57. return $this->_income->getAppUrl();
  58. }
  59. public function getTitle()
  60. {
  61. $mark = $this->_income->getMark();
  62. if (isset($this->lang_set[$mark]['title']) && !empty($this->lang_set[$mark]['title'])) {
  63. return $this->lang_set[$mark]['title'];
  64. }
  65. return $this->_income->getTitle();
  66. }
  67. }