UserHongbao.php 889 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. use tool\Common;
  11. class UserHongbao extends Model
  12. {
  13. protected $resultSetType = 'collection';
  14. protected $updateTime = 'updateTime';
  15. protected $createTime = 'addTime';
  16. protected $autoWriteTimestamp = true;
  17. const STATUS_UNUSED = 1;
  18. const STATUS_USED = 2;
  19. const STATUS_OUTTIME = 3;
  20. const STATUSS = [
  21. self::STATUS_UNUSED=>'未用过',
  22. self::STATUS_USED=>'已使用',
  23. self::STATUS_OUTTIME=>'已过期',
  24. ];
  25. public function hongbao() {
  26. return $this->belongsTo('Hongbao', 'hongbaoID');
  27. }
  28. public function getBeginTimeAttr($value) {
  29. return Common::timetodate($value, 0);
  30. }
  31. public function getEndTimeAttr($value) {
  32. return Common::timetodate($value, 0);
  33. }
  34. }