ImageSource.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. namespace common\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "{{%image}}".
  6. *
  7. * @property string $id
  8. * @property integer $type
  9. * @property integer $topid
  10. * @property string $pic
  11. * @property string $thumbnail
  12. * @property integer $created_at
  13. * @property integer $status
  14. * @property integer $updated_at
  15. */
  16. class ImageSource extends \yii\db\ActiveRecord
  17. {
  18. const TYPE_DESIGNER = 10;//设计师头像
  19. const TYPE_MANAGER = 11;//项目经理头像
  20. const TYPE_LIVING_ROOM = 20;//客厅照片
  21. const TYPE_MASTER_BEDROOM = 30;//主卧照片
  22. const TYPE_PORTION = 40;//局部美图
  23. const TYPE_PORTION2 = 70;//局部美图2
  24. const TYPE_PORTION3 = 71;//局部美图3
  25. const TYPE_PORTION4 = 72;//局部美图4
  26. const TYPE_PORTION5 = 73;//局部美图5
  27. const TYPE_FLAT = 50;//平面图
  28. const TYPE_BUILD = 44;//施工图1
  29. const TYPE_BUILD2 = 45;//施工图2
  30. const TYPE_MATER_GOOD = 85;//建材商品
  31. const TYPE_COMMENT = 60;//评论图片
  32. const STATUS_YES = 10; //正常
  33. const STATUS_NO = 0; //删除
  34. /**
  35. * @inheritdoc
  36. */
  37. public static function tableName()
  38. {
  39. return '{{%image}}';
  40. }
  41. /**
  42. * @inheritdoc
  43. */
  44. public function rules()
  45. {
  46. return [
  47. [['type', 'topid', 'pic', 'created_at','updated_at'], 'required'],
  48. [['type', 'topid', 'created_at', 'status', 'updated_at'], 'integer'],
  49. [['pic', 'thumbnail'], 'string', 'max' => 255],
  50. [['status'], 'default', 'value' => self::STATUS_YES],
  51. ];
  52. }
  53. /**
  54. * @inheritdoc
  55. */
  56. public function attributeLabels()
  57. {
  58. return [
  59. 'id' => 'ID',
  60. 'type' => '类型',
  61. 'topid' => '关联ID',
  62. 'pic' => '图片地址',
  63. 'thumbnail' => '缩略图地址',
  64. 'created_at' => 'Created At',
  65. 'status' => 'Status',
  66. 'updated_at' => 'Updated At',
  67. ];
  68. }
  69. }