AlipaySharingReceiver.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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 "{{%alipay_sharing_receiver}}".
  13. *
  14. * @property int $id
  15. * @property int $store_id
  16. * @property string $order_no 订单号
  17. * @property int $type 接收方类型
  18. * @property int $user_id 接收方类型
  19. * @property string $account 分账接收方账户
  20. * @property string $name 分账接收方名称
  21. * @property string $description 分账原因描述
  22. * @property int $is_delete
  23. * @property int $amount
  24. * @property int $rate
  25. * @property int $from
  26. * @property string $err_code
  27. * @property string $err_code_des
  28. * @property int $is_pay
  29. * @property string $remark
  30. * @property int $created_at
  31. * @property int $updated_at
  32. */
  33. class AlipaySharingReceiver extends \yii\db\ActiveRecord
  34. {
  35. /**
  36. * {@inheritdoc}
  37. */
  38. public static function tableName()
  39. {
  40. return '{{%alipay_sharing_receiver}}';
  41. }
  42. const IS_DELETE_YES = 1;// 已删除
  43. const IS_DELETE_NO = 0;// 未删除
  44. /**
  45. * 支付结果类型:未分账
  46. */
  47. const PAY_WAIT = 0;
  48. /**
  49. * 支付结果类型:已分账
  50. */
  51. const PAY_SUCCESS = 1;
  52. /**
  53. * 支付结果类型:分账失败
  54. */
  55. const PAY_FAIL = 2;
  56. /**
  57. * 接收方类型:USER_ID
  58. */
  59. const RECEIVE_USER_ID = 1;
  60. /**
  61. * 接收方类型:LOGIN_NAME
  62. */
  63. const RECEIVE_LOGIN_NAME = 2;
  64. public static $validReceiveType = [
  65. self::RECEIVE_USER_ID => 'userId',
  66. self::RECEIVE_LOGIN_NAME => 'loginName'
  67. ];
  68. /**
  69. * 分账来源类型: 商城
  70. */
  71. const FROM_STORE = 0;
  72. /**
  73. * 分账来源类型: 平台
  74. */
  75. const FROM_PLATFORM = 1;
  76. /**
  77. * 分账来源类型: 推荐
  78. */
  79. const FROM_RECOMMEND = 2;
  80. /**
  81. * 分账来源类型: 服务商
  82. */
  83. const FROM_SERVICE_PROVIDER = 3;
  84. /**
  85. * 分账来源类型: 商城间分销
  86. */
  87. const FROM_STORE_TO_STORE = 4;
  88. public static $validNewFrom = [
  89. self::FROM_STORE,
  90. self::FROM_RECOMMEND,
  91. self::FROM_SERVICE_PROVIDER,
  92. self::FROM_PLATFORM,
  93. self::FROM_STORE_TO_STORE
  94. ];
  95. public function behaviors()
  96. {
  97. return [
  98. [
  99. 'class' => TimestampBehavior::class,
  100. 'attributes' => [
  101. ActiveRecord::EVENT_BEFORE_INSERT => ['updated_at', 'created_at'],
  102. ActiveRecord::EVENT_BEFORE_UPDATE => 'updated_at'
  103. ]
  104. ]
  105. ];
  106. }
  107. /**
  108. * {@inheritdoc}
  109. */
  110. public function rules()
  111. {
  112. return [
  113. [['store_id', 'is_delete', 'created_at', 'updated_at', 'type', 'is_pay', 'from', 'user_id'], 'integer'],
  114. [['amount', 'rate'], 'number'],
  115. [['name', 'description', 'account', 'order_no', 'err_code', 'err_code_des', 'remark'], 'string', 'max' => 255],
  116. ];
  117. }
  118. /**
  119. * {@inheritdoc}
  120. */
  121. public function attributeLabels()
  122. {
  123. return [
  124. 'id' => 'ID',
  125. 'store_id' => 'Store ID',
  126. 'name' => '接收方姓名',
  127. 'type' => '分账接收方类型,1:user_id 1:login_name',
  128. 'description' => '分账描述',
  129. 'user_id' => 'USER ID',
  130. 'account' => '分账接收方账户',
  131. 'order_no' => '订单号',
  132. 'is_pay' => '是否支付',
  133. 'amount' => '金额',
  134. 'rate' => '比例',
  135. 'from' => '0:店铺分销,1:saas平台分销, 2:推荐分账,3:服务商分账 4:商城级分账',
  136. 'err_code' => '分账错误代码',
  137. 'err_code_des' => '分账错误信息',
  138. 'remark' => '标注类型,例如:店铺分销',
  139. 'is_delete' => 'Is Delete',
  140. 'created_at' => 'Add Time',
  141. 'updated_at' => 'Update Time',
  142. ];
  143. }
  144. }