PromoterGroup.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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_group}}".
  16. *
  17. * @property integer $id
  18. * @property integer $sort
  19. * @property integer $store_id
  20. * @property integer $is_show
  21. * @property integer $is_delete
  22. * @property string $created_at
  23. * @property string $updated_at
  24. * @property string $name
  25. */
  26. class PromoterGroup extends \yii\db\ActiveRecord
  27. {
  28. /**
  29. * @inheritdoc
  30. */
  31. public static function tableName()
  32. {
  33. return '{{%promoter_group}}';
  34. }
  35. public function beforeSave($insert)
  36. {
  37. if (parent::beforeSave($insert)) {
  38. if ($this->isNewRecord) {
  39. $this->created_at = date('Y-m-d H:i:s');
  40. }else{
  41. $this->updated_at = date('Y-m-d H:i:s');
  42. }
  43. return true;
  44. }
  45. return false;
  46. }
  47. /**
  48. * @inheritdoc
  49. */
  50. public function rules()
  51. {
  52. return [
  53. [['id', 'store_id','is_show','is_delete','sort'], 'integer'],
  54. [['name'], 'string'],
  55. [['created_at','updated_at'], 'safe'],
  56. ];
  57. }
  58. /**
  59. * @inheritdoc
  60. */
  61. public function attributeLabels()
  62. {
  63. return [
  64. 'id' => 'ID',
  65. ];
  66. }
  67. }