SharingReceiverCustom.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <?php
  2. /**
  3. * 重庆赤晓店信息科技有限公司
  4. * https://www.chixiaodian.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 "{{%sharing_receiver_custom}}".
  13. *
  14. * @property integer $id
  15. * @property string $name
  16. * @property integer $sharing_type
  17. * @property string $type_id
  18. * @property integer $extra_saas_user_id
  19. * @property integer $sharing_way
  20. * @property integer $sharing_store_id
  21. * @property float $sharing_profit
  22. * @property float $amount
  23. * @property integer $is_delete
  24. * @property integer $created_at
  25. * @property integer $updated_at
  26. */
  27. class SharingReceiverCustom extends \yii\db\ActiveRecord
  28. {
  29. /**
  30. * {@inheritdoc}
  31. */
  32. public static function tableName()
  33. {
  34. return '{{%sharing_receiver_custom}}';
  35. }
  36. const IS_DELETE_YES = 1;// 已删除
  37. const IS_DELETE_NO = 0;// 未删除
  38. /**
  39. * 分账类型:微信用户
  40. */
  41. const SHARING_TYPE_USER = 0;
  42. /**
  43. * 分账类型:商户号
  44. */
  45. const SHARING_TYPE_MERCHANT = 1;
  46. const SHARING_TYPE = [
  47. self::SHARING_TYPE_USER ,
  48. self::SHARING_TYPE_MERCHANT,
  49. ];
  50. /**
  51. * 分账方式:基于店铺
  52. */
  53. const SHARING_WAY_STORE = 0;
  54. /**
  55. * 分账方式:基于平台
  56. */
  57. const SHARING_WAY_PLATFORM = 1;
  58. const SHARING_WAY = [
  59. self::SHARING_WAY_STORE ,
  60. self::SHARING_WAY_PLATFORM,
  61. ];
  62. public function behaviors()
  63. {
  64. return [
  65. [
  66. 'class' => TimestampBehavior::class,
  67. 'attributes' => [
  68. ActiveRecord::EVENT_BEFORE_INSERT => ['updated_at', 'created_at'],
  69. ActiveRecord::EVENT_BEFORE_UPDATE => 'updated_at'
  70. ]
  71. ]
  72. ];
  73. }
  74. /**
  75. * {@inheritdoc}
  76. */
  77. public function rules()
  78. {
  79. return [
  80. [['sharing_profit', 'amount'], 'number'],
  81. [['name', 'type_id'], 'string'],
  82. [['id', 'sharing_type', 'sharing_way', 'sharing_store_id', 'is_delete', 'created_at', 'updated_at', 'extra_saas_user_id'], 'integer'],
  83. ];
  84. }
  85. /**
  86. * {@inheritdoc}
  87. */
  88. public function attributeLabels()
  89. {
  90. return [
  91. 'id' => '',
  92. 'name' => '分账名称',
  93. 'sharing_type' => '分账类型:0=微信用户;1=商户号',
  94. 'type_id' => '分类类型ID:联盟用户ID或者商户号',
  95. 'extra_saas_user_id' => '额外用户ID(如果sharing_type = 1时候需要)',
  96. 'sharing_way' => '分账方式:0=基于店铺;1=基于平台',
  97. 'sharing_store_id' => '分账方式如果是基于店铺,店铺ID',
  98. 'sharing_profit' => '分账比例',
  99. 'amount' => '累计佣金',
  100. 'is_delete' => '',
  101. 'created_at' => '',
  102. 'updated_at' => '',
  103. ];
  104. }
  105. }