Banner.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: qisse
  5. * Date: 2017/6/27
  6. * Time: 20:02
  7. */
  8. namespace app\core\model;
  9. use think\Model;
  10. class Banner extends Model
  11. {
  12. protected $pk = 'bannerID';
  13. protected $resultSetType = 'collection';
  14. protected $updateTime = 'updateTime';
  15. protected $createTime = 'addTime';
  16. protected $autoWriteTimestamp = true;
  17. const STATUS_ONLINE = 1;
  18. const STATUS_OFFLINE = 2;
  19. const STATUSS = [
  20. self::STATUS_ONLINE=>'已上线',
  21. self::STATUS_OFFLINE=>'已下线'
  22. ];
  23. public function getStatusTextAttr($value, $data) {
  24. return self::STATUSS[$data['status']];
  25. }
  26. public function getClientTypeTextAttr($value, $data) {
  27. if($data['clientType'] == 1) {
  28. return 'app';
  29. }
  30. else if($data['clientType'] == 2) {
  31. return 'pc';
  32. }
  33. return '未知';
  34. }
  35. /* public function getUpdateTimeAttr($value) {
  36. return Common::timetodate($value, 6);
  37. }
  38. public function getAddTimeAttr($value) {
  39. return Common::timetodate($value, 6);
  40. }*/
  41. }