PromoterCat.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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}}".
  16. *
  17. * @property integer $id
  18. * @property integer $cat_id
  19. * @property integer $f_cat_id
  20. * @property integer $store_id
  21. * @property integer $level
  22. * @property integer $leaf
  23. * @property integer $is_show
  24. * @property integer $is_delete
  25. * @property integer $sort
  26. * @property string $created_at
  27. * @property string $updated_at
  28. */
  29. class PromoterCat extends \yii\db\ActiveRecord
  30. {
  31. /**
  32. * @inheritdoc
  33. */
  34. public static function tableName()
  35. {
  36. return '{{%promoter_cat}}';
  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','store_id','f_cat_id', 'cat_id','is_show','is_delete','level','leaf','sort'], 'integer'],
  57. [['created_at','updated_at'], 'safe'],
  58. ];
  59. }
  60. /**
  61. * @inheritdoc
  62. */
  63. public function attributeLabels()
  64. {
  65. return [
  66. 'id' => 'ID',
  67. ];
  68. }
  69. }