ReOrder.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <?php
  2. /**
  3. * 厦门云联储网络科技有限公司
  4. * https://www.baokuaiyun.com
  5. * Copyright (c) 2023 爆块云 All rights reserved.
  6. */
  7. namespace app\models;
  8. use Yii;
  9. use yii\db\ActiveRecord;
  10. /**
  11. * This is the model class for table "{{%re_order}}".
  12. *
  13. * @property integer $id
  14. * @property integer $store_id
  15. * @property string $order_no
  16. * @property integer $user_id
  17. * @property string $pay_price
  18. * @property string $send_price
  19. * @property integer $pay_type
  20. * @property integer $is_pay
  21. * @property integer $pay_time
  22. * @property string $transaction_id
  23. * @property string $adapay_payment_id
  24. * @property integer $is_delete
  25. * @property integer $created_at
  26. * @property integer $is_platform
  27. * @property integer $type
  28. * @property integer $order_id
  29. * @property integer $is_use_platform_mch
  30. * @property integer $send_integral
  31. */
  32. class ReOrder extends ActiveRecord
  33. {
  34. public $is_combine_pay = 0;
  35. public $mobile = '';
  36. /**
  37. * 是否删除
  38. */
  39. CONST IS_DELETE = 1;
  40. CONST NOT_DELETE = 0;
  41. public static $valid_delete_arr = [
  42. self::IS_DELETE,
  43. self::NOT_DELETE
  44. ];
  45. /**
  46. * 是否支付
  47. */
  48. CONST IS_PAY = 1;
  49. CONST NOT_PAY = 0;
  50. public static $valid_pay_arr = [
  51. self::IS_PAY,
  52. self::NOT_PAY
  53. ];
  54. /**
  55. * @inheritdoc
  56. */
  57. public static function tableName()
  58. {
  59. return '{{%re_order}}';
  60. }
  61. /**
  62. * @inheritdoc
  63. */
  64. public function rules()
  65. {
  66. return [
  67. [['store_id', 'user_id', 'pay_type', 'is_pay', 'pay_time', 'is_delete', 'created_at', 'is_platform', 'type', 'order_id', 'is_use_platform_mch'], 'integer'],
  68. [['pay_price', 'send_price', 'send_integral'], 'number'],
  69. [['order_no', 'transaction_id'], 'string', 'max' => 255],
  70. [['adapay_payment_id'], 'safe'],
  71. ];
  72. }
  73. /**
  74. * @inheritdoc
  75. */
  76. public function attributeLabels()
  77. {
  78. return [
  79. 'id' => 'ID',
  80. 'store_id' => 'Store ID',
  81. 'order_no' => '订单号',
  82. 'user_id' => '用户',
  83. 'pay_price' => '支付金额',
  84. 'send_price' => '赠送金额',
  85. 'pay_type' => '支付方式 1--微信支付',
  86. 'is_pay' => '是否支付 0--未支付 1--支付',
  87. 'pay_time' => '支付时间',
  88. 'transaction_id' => '微信单号',
  89. 'is_delete' => 'Is Delete',
  90. 'created_at' => '添加时间',
  91. 'type' => '类型 0当面付',
  92. 'order_id' => '订单id',
  93. 'is_use_platform_mch' => '供应链系统下单时是否使用平台商户号,1使用,0未使用',
  94. ];
  95. }
  96. public function afterSave($insert, $changedAttributes)
  97. {
  98. parent::afterSave($insert, $changedAttributes);
  99. if (($insert && $this->is_pay == 1) || (isset($changedAttributes['is_pay']) && $this->is_pay == 1)) {
  100. \app\utils\Share\BonusPool::ShareHolderLevelJob($this->store_id, 0, $this->user_id);
  101. }
  102. }
  103. }