EventForm.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. namespace app\models;
  3. use Yii;
  4. use yii\behaviors\TimestampBehavior;
  5. /**
  6. * This is the model class for table "cyy_event_form".
  7. *
  8. * @property int $id
  9. * @property int|null $store_id
  10. * @property int|null $event_id 活动ID
  11. * @property int|null $form_type 表单类型:1=企业;2=机构;
  12. * @property string|null $name 名称
  13. * @property string|null $type 类型
  14. * @property int|null $required 必填项
  15. * @property string|null $default 默认值
  16. * @property string|null $tip 提示语
  17. * @property int|null $sort 排序
  18. * @property int|null $is_delete
  19. * @property int|null $created_at
  20. * @property int|null $updated_at
  21. */
  22. class EventForm extends \yii\db\ActiveRecord
  23. {
  24. //表单类型:企业
  25. const FORM_TYPE_COMPANY = 1;
  26. //表单类型:机构
  27. const FORM_TYPE_INSTITUTION = 2;
  28. //是否必填:否
  29. const IS_REQUIRED_FALSE = 0;
  30. //是否必填:是
  31. const IS_REQUIRED_TRUE = 1;
  32. public static function tableName()
  33. {
  34. return 'cyy_event_form';
  35. }
  36. public function behaviors()
  37. {
  38. return [
  39. [
  40. // 自动更新创建和更新时间
  41. 'class' => TimestampBehavior::class,
  42. 'value' => time()
  43. ]
  44. ];
  45. }
  46. public function rules()
  47. {
  48. return [
  49. [['store_id', 'event_id', 'form_type', 'required', 'sort', 'is_delete', 'created_at', 'updated_at'], 'integer'],
  50. [['name', 'type', 'default', 'tip'], 'string', 'max' => 255],
  51. ];
  52. }
  53. public function attributeLabels()
  54. {
  55. return [
  56. 'id' => 'ID',
  57. 'store_id' => '商城ID',
  58. 'event_id' => '活动ID',
  59. 'form_type' => '表单类型:1=企业;2=机构;',
  60. 'name' => '字段名称',
  61. 'type' => '字段类型',
  62. 'required' => '是否必填',
  63. 'default' => '默认值',
  64. 'tip' => '提示语',
  65. 'sort' => '排序',
  66. 'is_delete' => '是否删除',
  67. 'created_at' => '创建时间',
  68. 'updated_at' => '更新时间',
  69. ];
  70. }
  71. }