SharingReceiver.php 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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 "{{%sharing_receiver}}".
  13. *
  14. * @property int $id
  15. * @property int $store_id
  16. * @property string $order_no 订单号
  17. * @property string $transaction_id 微信交易号
  18. * @property int $type 接收方类型
  19. * @property int $user_id 接收方类型
  20. * @property int $saas_id 商盟用户id
  21. * @property string $account 分账接收方账户
  22. * @property string $name 分账接收方名称
  23. * @property string $description 分账原因描述
  24. * @property string $order_id
  25. * @property int $is_delete
  26. * @property int $amount
  27. * @property int $rate
  28. * @property int $from
  29. * @property string $err_code
  30. * @property string $err_code_des
  31. * @property int $is_pay
  32. * @property int $execute_type
  33. * @property string $remark
  34. * @property int $created_at
  35. * @property int $updated_at
  36. * @property int $is_platform
  37. * @property string $yunst_order_no
  38. */
  39. class SharingReceiver extends \yii\db\ActiveRecord
  40. {
  41. /**
  42. * {@inheritdoc}
  43. */
  44. public static function tableName()
  45. {
  46. return '{{%sharing_receiver}}';
  47. }
  48. const IS_DELETE_YES = 1;// 已删除
  49. const IS_DELETE_NO = 0;// 未删除
  50. /**
  51. * 支付结果类型:未分账
  52. */
  53. const PAY_WAIT = 0;
  54. /**
  55. * 支付结果类型:已分账
  56. */
  57. const PAY_SUCCESS = 1;
  58. /**
  59. * 支付结果类型:分账失败
  60. */
  61. const PAY_FAIL = 2;
  62. /**
  63. * 接收方类型:openid
  64. */
  65. const RECEIVE_OPENID = 1;
  66. /**
  67. * 接收方类型:merchant_id
  68. */
  69. const RECEIVE_MERCHANT_ID = 2;
  70. /**
  71. * 接收方类型:sub_openid
  72. */
  73. const RECEIVE_SUB_OPENID = 3;
  74. /**
  75. * 接收方类型:user id alipay
  76. */
  77. const RECEIVE_USER_ID = 4;
  78. /**
  79. * 接收方类型:login name alipay
  80. */
  81. const RECEIVE_LOGIN_NAME = 5;
  82. public static $validAlipayReceiveType = [
  83. self::RECEIVE_USER_ID => 'userId',
  84. self::RECEIVE_LOGIN_NAME => 'loginName'
  85. ];
  86. /**
  87. * 分账来源类型: 商城
  88. */
  89. const FROM_STORE = 0;
  90. /**
  91. * 分账来源类型: 平台
  92. */
  93. const FROM_PLATFORM = 1;
  94. /**
  95. * 分账来源类型: 推荐
  96. */
  97. const FROM_RECOMMEND = 2;
  98. /**
  99. * 分账来源类型: 消费返利
  100. */
  101. const FROM_SELF = 5;
  102. /**
  103. * 分账来源类型: 服务商
  104. */
  105. const FROM_SERVICE_PROVIDER = 3;
  106. /**
  107. * 分账来源类型: 商城间分销
  108. */
  109. const FROM_STORE_TO_STORE = 4;
  110. /**
  111. * 分账来源类型: 排队返利
  112. */
  113. const FROM_QUEUE = 6;
  114. public static $validFrom = [
  115. self::FROM_STORE,
  116. self::FROM_RECOMMEND,
  117. self::FROM_PLATFORM,
  118. self::FROM_SERVICE_PROVIDER,
  119. self::FROM_STORE_TO_STORE,
  120. self::FROM_SELF
  121. ];
  122. public static $validNewFrom = [
  123. self::FROM_STORE,
  124. self::FROM_RECOMMEND,
  125. self::FROM_PLATFORM,
  126. self::FROM_STORE_TO_STORE,
  127. self::FROM_SERVICE_PROVIDER,
  128. self::FROM_SELF
  129. ];
  130. /**
  131. * 分账执行方式:微信分账
  132. */
  133. const EXECUTE_TYPE_NORMAL = 0;
  134. /**
  135. * 分账执行方式:微信转账
  136. */
  137. const EXECUTE_TYPE_TRANSFER = 1;
  138. /**
  139. * 分账执行方式:支付宝分账
  140. */
  141. const EXECUTE_TYPE_ALIPAY = 2;
  142. /**
  143. * 分账执行方式:汇付分账
  144. */
  145. const EXECUTE_TYPE_HUIFU = 3;
  146. public function behaviors()
  147. {
  148. return [
  149. [
  150. 'class' => TimestampBehavior::class,
  151. 'attributes' => [
  152. ActiveRecord::EVENT_BEFORE_INSERT => ['updated_at', 'created_at'],
  153. ActiveRecord::EVENT_BEFORE_UPDATE => 'updated_at'
  154. ]
  155. ]
  156. ];
  157. }
  158. /**
  159. * {@inheritdoc}
  160. */
  161. public function rules()
  162. {
  163. return [
  164. [['store_id','to_store_id','saas_id', 'execute_type', 'is_delete', 'created_at', 'updated_at', 'type', 'is_pay', 'from', 'user_id', 'is_platform','goods_id','queue_id'], 'integer'],
  165. [['amount', 'rate'], 'number'],
  166. [['name', 'description', 'account', 'transaction_id', 'order_no', 'err_code', 'err_code_des', 'order_id', 'remark', 'yunst_order_no'], 'string', 'max' => 255],
  167. ];
  168. }
  169. /**
  170. * {@inheritdoc}
  171. */
  172. public function attributeLabels()
  173. {
  174. return [
  175. 'id' => 'ID',
  176. 'store_id' => 'Store ID',
  177. 'saas_id' =>'商盟用户id',
  178. 'name' => '接收方姓名',
  179. 'type' => '分账接收方类型,1:openid, 2:merchant_id, 3:sub_openid',
  180. 'description' => '分账描述',
  181. 'user_id' => 'USER ID',
  182. 'account' => '分账接收方账户',
  183. 'transaction_id' => '微信回执单号',
  184. 'order_no' => '订单号',
  185. 'is_pay' => '是否支付',
  186. 'amount' => '金额',
  187. 'rate' => '比例',
  188. 'order_id' => '请求分账后微信返回的订单id',
  189. 'from' => '0:店铺分销,1:saas平台分销',
  190. 'err_code' => '分账错误代码',
  191. 'err_code_des' => '分账错误信息',
  192. 'remark' => '标注类型,例如:店铺分销',
  193. 'execute_type' => '0:微信分账,1:微信转账',
  194. 'is_delete' => 'Is Delete',
  195. 'created_at' => 'Add Time',
  196. 'updated_at' => 'Update Time',
  197. 'is_platform' => "是否是平台"
  198. ];
  199. }
  200. }