Card.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. /**
  3. * 厦门云联储网络科技有限公司
  4. * https://www.baokuaiyun.com
  5. * Copyright (c) 2023 爆块云 All rights reserved.
  6. */
  7. namespace app\models;
  8. use yii\db\ActiveRecord;
  9. use yii\behaviors\TimestampBehavior;
  10. use Yii;
  11. /**
  12. * This is the model class for table "{{%card}}".
  13. *
  14. * @property int $id
  15. * @property int|null $store_id
  16. * @property string $name 卡券名称
  17. * @property string $pic_url
  18. * @property string|null $content 卡券描述
  19. * @property int $is_delete
  20. * @property int|null $updated_at
  21. * @property int|null $created_at
  22. */
  23. class Card extends \yii\db\ActiveRecord
  24. {
  25. /**
  26. * {@inheritdoc}
  27. */
  28. public static function tableName()
  29. {
  30. return '{{%card}}';
  31. }
  32. const IS_DELETE_YES = 1;//已删除
  33. const IS_DELETE_NO = 0;//未删除
  34. public function behaviors()
  35. {
  36. return [
  37. [
  38. 'class' => TimestampBehavior::class,
  39. 'attributes' => [
  40. ActiveRecord::EVENT_BEFORE_INSERT => ['updated_at', 'created_at'],
  41. ActiveRecord::EVENT_BEFORE_UPDATE => 'updated_at'
  42. ]
  43. ]
  44. ];
  45. }
  46. /**
  47. * {@inheritdoc}
  48. */
  49. public function rules()
  50. {
  51. return [
  52. [['store_id', 'is_delete', 'updated_at', 'created_at'], 'integer'],
  53. [['name', 'pic_url', 'is_delete'], 'required'],
  54. [['content'], 'string'],
  55. [['name'], 'string', 'max' => 255],
  56. [['pic_url'], 'string', 'max' => 2048],
  57. ];
  58. }
  59. /**
  60. * {@inheritdoc}
  61. */
  62. public function attributeLabels()
  63. {
  64. return [
  65. 'id' => 'ID',
  66. 'store_id' => 'Store ID',
  67. 'name' => '卡券名称',
  68. 'pic_url' => 'Pic Url',
  69. 'content' => '卡券描述',
  70. 'is_delete' => 'Is Delete',
  71. 'updated_at' => 'Update Time',
  72. 'created_at' => 'Add Time',
  73. ];
  74. }
  75. }