WechatMenuConfig.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. namespace app\models;
  3. use yii\behaviors\TimestampBehavior;
  4. use yii\db\ActiveRecord;
  5. /**
  6. * This is the model class for table "{{%wechat_menu_config}}".
  7. *
  8. * @property integer $id
  9. * @property string $name
  10. * @property integer $type
  11. * @property string $value
  12. * @property integer $sort
  13. * @property integer $store_id
  14. * @property integer $created_at
  15. * @property integer $update_at
  16. * @property integer $parent_id
  17. * @property integer $is_delete
  18. */
  19. class WechatMenuConfig extends ActiveRecord
  20. {
  21. /**
  22. * 配置类型
  23. */
  24. const TYPE_CONFIG_MINI = 1;
  25. const TYPE_CONFIG_MP = 2;
  26. const TYPE_CONFIG_APP = 3;
  27. /**
  28. * @inheritdoc
  29. */
  30. public static function tableName()
  31. {
  32. return '{{%wechat_menu_config}}';
  33. }
  34. /**
  35. * @inheritdoc
  36. */
  37. public function rules()
  38. {
  39. return [
  40. [['id', 'sort', 'store_id', 'created_at', 'update_at', 'parent_id', 'is_delete'], 'integer'],
  41. [['name', 'store_id'], 'required'],
  42. [['name', 'value'], 'string']
  43. ];
  44. }
  45. public function behaviors()
  46. {
  47. return [
  48. [
  49. 'class' => TimestampBehavior::class,
  50. 'attributes' => [
  51. ActiveRecord::EVENT_BEFORE_INSERT => ['created_at', 'update_at'],
  52. ActiveRecord::EVENT_BEFORE_UPDATE => 'update_at'
  53. ]
  54. ]
  55. ];
  56. }
  57. /**
  58. * @inheritdoc
  59. */
  60. public function attributeLabels()
  61. {
  62. return [
  63. 'id' => 'ID',
  64. 'type' => '类型,0:链接 1:关键字 2:小程序 3:图文',
  65. 'value' => '值',
  66. 'sort' => '排序',
  67. 'store_id' => '商城id',
  68. 'parent_id' => '父级id',
  69. 'name' => '名称',
  70. 'created_at' => '创建时间',
  71. 'update_at' => '更新时间',
  72. 'is_delete' => 'Is Delete',
  73. ];
  74. }
  75. }