Slide.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /**
  3. * Slide.php UTF-8
  4. *
  5. *
  6. * @date : 2017/11/25 15:06
  7. *
  8. * @license 这不是一个自由软件,未经授权不许任何使用和传播。
  9. * @author : wuyonghong <wyh@huosdk.com>
  10. * @version : HUOSDK 8.0
  11. */
  12. namespace huo\controller\slide;
  13. use huo\controller\common\Base;
  14. use huo\logic\slide\SlideLogic;
  15. use huolib\status\AdsStatus;
  16. class Slide extends Base {
  17. protected $slide_model;
  18. public function __construct(SlideLogic $slide_model = null) {
  19. if (null === $slide_model) {
  20. $this->slide_model = new SlideLogic();
  21. } else {
  22. $this->slide_model = $slide_model;
  23. }
  24. }
  25. /**
  26. * @param string $type
  27. * @param string $page
  28. *
  29. * @return array
  30. */
  31. public function getList($type, $page = '') {
  32. if (empty($type)) {
  33. $_code = AdsStatus::ADSTYPE_EMPTY;
  34. return $this->huoError($_code, AdsStatus::getMsg($_code));
  35. }
  36. $_map['type'] = $type;
  37. $_data = (new SlideLogic())->getList($_map, $page);
  38. if (is_numeric($_data)) {
  39. $_code = $_data;
  40. return $this->huoError($_code, AdsStatus::getMsg($_code));
  41. }
  42. $_code = AdsStatus::NO_ERROR;
  43. return $this->huoSuccess($_code, AdsStatus::getMsg($_code), $_data);
  44. }
  45. }