OldUserTreePath.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /**
  3. * 厦门云联储网络科技有限公司
  4. * https://www.baokuaiyun.com
  5. * Copyright (c) 2023 爆块云 All rights reserved.
  6. */
  7. namespace app\models;
  8. use app\librarys\shareTree\models\AbstractTreePath;
  9. use app\models\userTreeQuery\OldUserTreePathQuery;
  10. /**
  11. * @property int $parent_id
  12. * @property int $child_id
  13. * @property int $nearest_parent_id
  14. * @property int $parent_level
  15. * @property int $child_level
  16. * @property string $created_at
  17. */
  18. class OldUserTreePath extends AbstractTreePath
  19. {
  20. /**
  21. * @inheritDoc
  22. */
  23. public static function tableName(): string
  24. {
  25. return '{{%old_user_tree_path}}';
  26. }
  27. /**
  28. * @inheritdoc
  29. * @return OldUserTreePathQuery the active query used by this AR class.
  30. */
  31. public static function find(): OldUserTreePathQuery
  32. {
  33. return new OldUserTreePathQuery(get_called_class());
  34. }
  35. public static function findOld(): OldUserTreePathQuery
  36. {
  37. return new OldUserTreePathQuery(get_called_class());
  38. }
  39. public function afterSave($insert, $changedAttributes)
  40. {
  41. parent::afterSave($insert, $changedAttributes);
  42. if($insert && $this->child_id){
  43. $user = User::findOne($this->child_id);
  44. \app\utils\Share\BonusPool::ShareHolderLevelJob($user->store_id, 0, $this->child_id);
  45. }
  46. }
  47. }