StoreShareMoney.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <?php
  2. /**
  3. * 厦门云联储网络科技有限公司
  4. * https://www.baokuaiyun.com
  5. * Copyright (c) 2023 爆块云 All rights reserved.
  6. */
  7. namespace app\models;
  8. /**
  9. * Class StoreShareMoney
  10. * @package app\models
  11. * @property integer $id
  12. * @property float $profit
  13. * @property float $total_price
  14. * @property integer $store_id
  15. * @property integer $created_at
  16. * @property float $commission
  17. * @property integer $is_delete
  18. * @property string $desc
  19. * @property integer $order_id
  20. * @property integer $user_id
  21. * @property integer $type
  22. * @property integer $status
  23. * @property integer $order_type
  24. * @property integer $cloud_type
  25. * @property integer $is_send
  26. **/
  27. class StoreShareMoney extends \yii\db\ActiveRecord
  28. {
  29. const TYPE_AGENT = 0;
  30. const TYPE_AREA_AGENT = 1;
  31. const TYPE_GOODS_AGENT = 2;
  32. const TYPE_BD_AGENT = 3;
  33. const STATUS_STORE_SETTLED = 0;//0店铺入驻费用返利
  34. const STATUS_STORE_ORDER = 1;//1店铺下单返利
  35. const STATUS_STORE_PAYOUTS = 2;// 2支出
  36. /**
  37. * @var false|int|mixed|null
  38. */
  39. private $end_time;
  40. /**
  41. * @inheritdoc
  42. */
  43. public static function tableName()
  44. {
  45. return '{{%store_share_money}}';
  46. }
  47. /**
  48. * @inheritdoc
  49. */
  50. public function rules()
  51. {
  52. return [
  53. [['id', 'store_id', 'created_at', 'user_id', 'is_delete','type','order_id', 'status', 'order_type',
  54. 'cloud_type', 'is_send'], 'integer'],
  55. [['desc'], 'string'],
  56. [['total_price','commission','profit'], 'double'],
  57. ];
  58. }
  59. /**
  60. * @inheritdoc
  61. */
  62. public function attributeLabels()
  63. {
  64. return [
  65. 'id' =>"ID",
  66. 'store_id' =>"商场ID",
  67. 'profit' =>"分佣比例",
  68. 'total_price' =>"支付总金额",
  69. 'user_id' =>"用户ID",
  70. 'desc' =>"支付项目名称",
  71. 'created_at' =>"创建时间",
  72. 'order_id' =>"订单ID",
  73. 'type' =>"类型",
  74. 'is_delete' =>"是否删除",
  75. 'commission' =>"佣金",
  76. 'status' =>"代理类型0代理 1区域代理",
  77. 'order_type' =>"订单类型",
  78. 'cloud_type' =>'身份类型',
  79. 'is_send' =>'是否发放'
  80. ];
  81. }
  82. public function getStore(){
  83. return $this->hasOne(Store::className(),['id'=>'store_id']);
  84. }
  85. public function getReorder(){
  86. return $this->hasOne(StoreReOrder::className(),['id'=>'order_id']);
  87. }
  88. public function getOrder(){
  89. if ((int)$this->cloud_type === 0) {
  90. return $this->hasOne(Order::className(),['id'=>'order_id']);
  91. } else {
  92. return $this->hasOne(PurchaseOrder::className(),['id'=>'order_id']);
  93. }
  94. }
  95. }