You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
1.9 KiB

  1. <?php
  2. namespace common\models\ars;
  3. use Yii;
  4. use yii\behaviors\TimestampBehavior;
  5. /**
  6. * This is the model class for table "ats_taking_site".
  7. *
  8. * @property int $id
  9. * @property string $name 名称
  10. * @property string $province 省份
  11. * @property string $city 城市
  12. * @property string $area 区域
  13. * @property string $address 地址
  14. * @property int $is_default 是否为默认,1为默认
  15. * @property int $updated_at 更新时间
  16. * @property int $created_at 创建时间
  17. */
  18. class TakingSite extends \yii\db\ActiveRecord
  19. {
  20. /**
  21. * {@inheritdoc}
  22. */
  23. public static function tableName()
  24. {
  25. return 'ats_taking_site';
  26. }
  27. /**
  28. * {@inheritdoc}
  29. */
  30. public function rules()
  31. {
  32. return [
  33. [['name'], 'required'],
  34. [['address'], 'string'],
  35. [['is_default'], 'integer'],
  36. [['name'], 'string', 'max' => 120],
  37. [['province', 'city', 'area'], 'string', 'max' => 10],
  38. ];
  39. }
  40. /**
  41. * {@inheritdoc}
  42. */
  43. public function attributeLabels()
  44. {
  45. return [
  46. 'id' => 'id',
  47. 'name' => '名称',
  48. 'province' => '省份',
  49. 'city' => '城市',
  50. 'area' => '区域',
  51. 'address' => '地址',
  52. 'is_default' => '是否为默认,1为默认',
  53. 'updated_at' => '更新时间',
  54. 'created_at' => '创建时间',
  55. ];
  56. }
  57. /**
  58. * @author linyao
  59. * @email 602604991@qq.com
  60. * @created Nov 8, 2019
  61. *
  62. * 行为存储创建时间和更新时间
  63. */
  64. public function behaviors()
  65. {
  66. return [
  67. [
  68. 'class' => TimestampBehavior::className(),
  69. 'createdAtAttribute' => 'created_at',
  70. 'updatedAtAttribute' => 'updated_at',
  71. 'value' => function() {
  72. return time();
  73. },
  74. ],
  75. ];
  76. }
  77. }