PromoterCatAll.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. /**
  3. * 厦门云联储网络科技有限公司
  4. * https://www.baokuaiyun.com
  5. * Copyright (c) 2023 爆块云 All rights reserved.
  6. */
  7. namespace app\models;
  8. use GuzzleHttp\Client;
  9. use Yii;
  10. use yii\behaviors\TimestampBehavior;
  11. use app\modules\admin\models\wechat_mp\CardForm;
  12. use app\utils\IotCloudHelper;
  13. use yii\redis\Cache;
  14. /**
  15. * This is the model class for table "{{%promoter_cat_all}}".
  16. *
  17. * @property integer $id
  18. * @property integer $cat_id
  19. * @property integer $qua_id
  20. * @property integer $brand_qua_id
  21. * @property integer $f_cat_id
  22. * @property integer $is_show
  23. * @property integer $level
  24. * @property integer $leaf
  25. * @property string $created_at
  26. * @property string $updated_at
  27. * @property string $name
  28. */
  29. class PromoterCatAll extends \yii\db\ActiveRecord
  30. {
  31. /**
  32. * @inheritdoc
  33. */
  34. public static function tableName()
  35. {
  36. return '{{%promoter_cat_all}}';
  37. }
  38. public function beforeSave($insert)
  39. {
  40. if (parent::beforeSave($insert)) {
  41. if ($this->isNewRecord) {
  42. $this->created_at = date('Y-m-d H:i:s');
  43. }else{
  44. $this->updated_at = date('Y-m-d H:i:s');
  45. }
  46. return true;
  47. }
  48. return false;
  49. }
  50. /**
  51. * @inheritdoc
  52. */
  53. public function rules()
  54. {
  55. return [
  56. [['id','f_cat_id', 'cat_id','is_show','brand_qua_id','qua_id','level','leaf'], 'integer'],
  57. [['name'], 'string'],
  58. [['created_at','updated_at'], 'safe'],
  59. ];
  60. }
  61. /**
  62. * @inheritdoc
  63. */
  64. public function attributeLabels()
  65. {
  66. return [
  67. 'id' => 'ID',
  68. ];
  69. }
  70. }