OrderModel.php 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <?php
  2. namespace App\Models;
  3. use App\Models\User\UserModel;
  4. /**
  5. * App\Models\OrderModel
  6. *
  7. * @property int $id 主键
  8. * @property int $create_at 下单时间
  9. * @property float|null $flower 充值fa数量
  10. * @property string $out_trade_no 订单编号
  11. * @property string|null $transaction_id 微信支付订单号
  12. * @property int $total_amount 业务订单金额;单位:分
  13. * @property int $total_fee 订单金额;单位:分
  14. * @property int $cash_fee 支付金额;单位:分
  15. * @property string $openid 付款用户openid
  16. * @property int $uid 下单用户uid
  17. * @property int $order_state 订单状态.0:待支付;1:支付成功SUCCESS;2:转入退款REFUND;3:已关闭CLOSED;4:支付失败PAYERROR
  18. * @property int $type 1:小fa充值;2:服务费;3:72小时;9:小花充值10朵;
  19. * 10:小花充值100朵;
  20. * 12:超级会员1个月;
  21. * 13:超级会员3个月;
  22. * 14:超级会员12个月;
  23. * @property int|null $type_id type[1:无意义;2表白id]
  24. * @property int $coupon_id 优惠券ID
  25. * @property string|null $attach_data 附加数据
  26. * @property string|null $device 支付设备
  27. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\OrderModel newModelQuery()
  28. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\OrderModel newQuery()
  29. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\OrderModel query()
  30. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\OrderModel whereAttachData($value)
  31. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\OrderModel whereCashFee($value)
  32. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\OrderModel whereCouponId($value)
  33. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\OrderModel whereCreateAt($value)
  34. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\OrderModel whereDevice($value)
  35. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\OrderModel whereFlower($value)
  36. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\OrderModel whereId($value)
  37. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\OrderModel whereOpenid($value)
  38. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\OrderModel whereOrderState($value)
  39. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\OrderModel whereOutTradeNo($value)
  40. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\OrderModel whereTotalAmount($value)
  41. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\OrderModel whereTotalFee($value)
  42. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\OrderModel whereTransactionId($value)
  43. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\OrderModel whereType($value)
  44. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\OrderModel whereTypeId($value)
  45. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\OrderModel whereUid($value)
  46. * @mixin \Eloquent
  47. */
  48. class OrderModel extends Model
  49. {
  50. protected $table = "kdgx_partner_charge_order";
  51. protected $dateFormat = 'U';
  52. public const CREATED_AT = 'create_at';
  53. public const UPDATED_AT = null;
  54. public $fillable = [
  55. 'flower',
  56. 'out_trade_no',
  57. 'total_amount',
  58. 'total_fee',
  59. 'cash_fee',
  60. 'openid',
  61. 'uid',
  62. 'type',
  63. 'type_id',
  64. 'coupon_id',
  65. 'attach_data',
  66. 'device'
  67. ];
  68. protected $casts = array(
  69. 'create_at' => 'int'
  70. );
  71. // 商品信息
  72. public const GOODS = [
  73. 1 => [
  74. 'goods_id' => 1,
  75. 'desc' => '金fa充值',
  76. 'total_fee' => 100,
  77. 'gold_flower' => 1,
  78. 'red_flower' => 0,
  79. 'body' => '卖室友充值',
  80. 'notify_url' => "/api/core/pay/notify"
  81. ],
  82. 2 => [
  83. 'goods_id' => 2,
  84. 'desc' => '卖室友表白',
  85. 'total_fee' => 100,
  86. 'gold_flower' => 0,
  87. 'red_flower' => 0,
  88. 'body' => '卖室友表白',
  89. 'notify_url' => "/api/core/pay/notify"
  90. ],
  91. 3 => [
  92. 'goods_id' => 3,
  93. 'desc' => '72小时恋爱体验报名',
  94. 'total_fee' => 990,
  95. 'gold_flower' => 0,
  96. 'red_flower' => 0,
  97. 'body' => '72小时入场券',
  98. 'notify_url' => "/api/core/pay/notify"
  99. ],
  100. 9 => [
  101. 'goods_id' => 9,
  102. 'desc' => '购买小fa充值',
  103. 'total_fee' => 900,
  104. 'gold_flower' => 10,
  105. 'red_flower' => 0,
  106. 'body' => '卖室友充值',
  107. 'notify_url' => "/api/core/pay/notify"
  108. ],
  109. 10 => [
  110. 'goods_id' => 10,
  111. 'desc' => '购买小fa充值',
  112. 'total_fee' => 8800,
  113. 'gold_flower' => 100,
  114. 'red_flower' => 0,
  115. 'body' => '卖室友充值',
  116. 'notify_url' => "/api/core/pay/notify"
  117. ],
  118. 12 => [
  119. 'goods_id' => 12,
  120. 'desc' => "「1个月」超级会员充值",
  121. 'total_fee' => 2990,
  122. 'gold_flower' => 0,
  123. 'red_flower' => 0,
  124. 'body' => '分配对象「1个月」超级会员充值',
  125. 'notify_url' => "/api/pay/notify/supervip"
  126. ],
  127. 13 => [
  128. 'goods_id' => 13,
  129. 'desc' => "「3个月」超级会员充值",
  130. 'total_fee' => 7200,
  131. 'gold_flower' => 0,
  132. 'red_flower' => 0,
  133. 'body' => '分配对象「3个月」超级会员充值',
  134. 'notify_url' => "/api/pay/notify/supervip"
  135. ],
  136. 14 => [
  137. 'goods_id' => 14,
  138. 'desc' => "「12个月」超级会员充值",
  139. 'total_fee' => 25200,
  140. 'gold_flower' => 0,
  141. 'red_flower' => 0,
  142. 'body' => '分配对象「12个月」超级会员充值',
  143. 'notify_url' => "/api/pay/notify/supervip"
  144. ],
  145. ];
  146. public function user()
  147. {
  148. return $this->belongsTo(UserModel::class, 'uid', 'uid');
  149. }
  150. public function coupon()
  151. {
  152. return $this->belongsTo(CouponModel::class, 'coupon_id');
  153. }
  154. }