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.

82 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. [['address'], 'string'],
  34. [['is_default'], 'integer'],
  35. [['name'], 'string', 'max' => 120],
  36. [['province', 'city', 'area'], 'string', 'max' => 10],
  37. ];
  38. }
  39. /**
  40. * {@inheritdoc}
  41. */
  42. public function attributeLabels()
  43. {
  44. return [
  45. 'id' => 'id',
  46. 'name' => '名称',
  47. 'province' => '省份',
  48. 'city' => '城市',
  49. 'area' => '区域',
  50. 'address' => '地址',
  51. 'is_default' => '是否为默认,1为默认',
  52. 'updated_at' => '更新时间',
  53. 'created_at' => '创建时间',
  54. ];
  55. }
  56. /**
  57. * @author linyao
  58. * @email 602604991@qq.com
  59. * @created Nov 8, 2019
  60. *
  61. * 行为存储创建时间和更新时间
  62. */
  63. public function behaviors()
  64. {
  65. return [
  66. [
  67. 'class' => TimestampBehavior::className(),
  68. 'createdAtAttribute' => 'created_at',
  69. 'updatedAtAttribute' => 'updated_at',
  70. 'value' => function() {
  71. return time();
  72. },
  73. ],
  74. ];
  75. }
  76. }