Cloud.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. /**
  3. * 厦门云联储网络科技有限公司
  4. * https://www.baokuaiyun.com
  5. * Copyright (c) 2023 爆块云 All rights reserved.
  6. */
  7. namespace app\models;
  8. use Yii;
  9. use yii\behaviors\TimestampBehavior;
  10. use yii\helpers\Json;
  11. /**
  12. * This is the model class for table "{{%cloud}}".
  13. *
  14. * @property integer $id
  15. * @property integer $store_id
  16. * @property integer $mch_id
  17. * @property string $name
  18. * @property string $cloud_type
  19. * @property string $cloud_setting
  20. * @property integer $is_delete
  21. * @property integer $created_at
  22. * @property integer $updated_at
  23. */
  24. class Cloud extends \yii\db\ActiveRecord
  25. {
  26. /**
  27. * @inheritdoc
  28. */
  29. public static function tableName()
  30. {
  31. return '{{%cloud}}';
  32. }
  33. public function behaviors()
  34. {
  35. return [
  36. [
  37. // 自动更新创建和更新时间
  38. 'class' => TimestampBehavior::class,
  39. 'value' => time()
  40. ]
  41. ];
  42. }
  43. /**
  44. * @inheritdoc
  45. */
  46. public function rules()
  47. {
  48. return [
  49. [['store_id', 'mch_id', 'is_delete', 'created_at', 'updated_at'], 'integer'],
  50. [['cloud_setting'], 'string'],
  51. [['name', 'cloud_type'], 'string', 'max' => 255],
  52. ['mch_id', 'default', 'value' => 0]
  53. ];
  54. }
  55. /**
  56. * @inheritdoc
  57. */
  58. public function attributeLabels()
  59. {
  60. return [
  61. 'id' => 'ID',
  62. 'store_id' => 'Store ID',
  63. 'mch_id' => '商户主键',
  64. 'name' => '打印机名称',
  65. 'cloud_type' => '打印机类型',
  66. 'cloud_setting' => '打印机设置',
  67. 'is_delete' => 'Is Delete',
  68. 'updated_at' => '更新时间',
  69. 'created_at' => '创建时间'
  70. ];
  71. }
  72. public function beforeSave($insert)
  73. {
  74. return true;
  75. // $this->name = Json::encode($this->name);
  76. // return parent::beforeSave($insert);
  77. }
  78. }