ShareHolderParentOutLog.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. /**
  3. * 厦门云联储网络科技有限公司
  4. * https://www.baokuaiyun.com
  5. * Copyright (c) 2023 爆块云 All rights reserved.
  6. */
  7. namespace app\models;
  8. use yii\db\ActiveRecord;
  9. use yii\behaviors\TimestampBehavior;
  10. use Yii;
  11. /**
  12. * This is the model class for table "{{%share_holder_parent_out_log}}".
  13. *
  14. * @property integer $id
  15. * @property integer $parent_user_id
  16. * @property integer $user_id
  17. * @property integer $created_at
  18. * @property integer $updated_at
  19. * @property integer $old_parent_user_id
  20. * @property integer $store_id
  21. * @property string $desc
  22. * @property integer $type
  23. * @property integer $change_type
  24. */
  25. class ShareHolderParentOutLog extends \yii\db\ActiveRecord
  26. {
  27. const CHANGE_TYPE_NORMAL = 0;//普通方式绑定
  28. const CHANGE_TYPE_CHANGE_OLD_PARENT = 1;//滑落方式绑定
  29. /**
  30. * @inheritdoc
  31. */
  32. public static function tableName()
  33. {
  34. return '{{%share_holder_parent_out_log}}';
  35. }
  36. public function behaviors()
  37. {
  38. return [
  39. [
  40. 'class' => TimestampBehavior::class,
  41. 'attributes' => [
  42. ActiveRecord::EVENT_BEFORE_INSERT => ['created_at'],
  43. ActiveRecord::EVENT_BEFORE_UPDATE => ['updated_at']
  44. ]
  45. ]
  46. ];
  47. }
  48. /**
  49. * @inheritdoc
  50. */
  51. public function rules()
  52. {
  53. return [
  54. [['id', 'parent_user_id', 'user_id', 'old_parent_user_id', 'store_id', 'type', 'change_type'], 'integer'],
  55. [['created_at', 'updated_at'], 'safe'],
  56. [['desc'], 'string']
  57. ];
  58. }
  59. public static function getConditionName($condition = 0) {
  60. $arr = [
  61. 0 => '分享链接',
  62. 1 => '首次下单',
  63. 2 => '首次付款',
  64. 11 => '后台编辑',
  65. 101 => '滑落',
  66. ];
  67. return $arr[$condition] ?? '';
  68. }
  69. public static function getPageTypeName($page_type = 0) {
  70. $arr = [
  71. 3 => '分享首页',
  72. 1 => '分享商品',
  73. 2 => '分享海报',
  74. ];
  75. return $arr[$page_type] ?? '';
  76. }
  77. }