25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

PayRefush.php 4.0 KiB

3 yıl önce
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <?php
  2. /**
  3. * 数据库表类 pay_refush
  4. * ============================================================================
  5. * * 版权所有 蜘蛛出行 * *
  6. * 网站地址: http://www.zhizhuchuxing.com
  7. * ----------------------------------------------------------------------------
  8. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
  9. * 使用;不允许对程序代码以任何形式任何目的的再发布。
  10. * ============================================================================
  11. * Author By: 倪宗锋
  12. * PhpStorm LoginController.php
  13. * Create By 2017/06/15 15:01 $
  14. */
  15. namespace common\models;
  16. use yii\db\ActiveRecord;
  17. /**
  18. * 数据库表类 pay_refush.
  19. * @property integer $id
  20. * @property integer $order_id
  21. * @property string $pay_order_id
  22. * @property integer $pay_type
  23. * @property integer $refush_money
  24. * @property integer $amount_money
  25. * @property integer $fx_uid
  26. * @property integer $sh_uid
  27. * @property integer $status
  28. * @property string $create_time
  29. * @property string $refund_time
  30. * @property integer $delete_flag
  31. * @property integer $category_id
  32. * @property string $app_id
  33. * @property string $open_id
  34. */
  35. class PayRefush extends ActiveRecord
  36. {
  37. /**
  38. * @inheritdoc
  39. */
  40. public static function tableName()
  41. {
  42. return 'pay_refush';
  43. }
  44. /**
  45. * @inheritdoc
  46. */
  47. public function rules()
  48. {
  49. return [
  50. [['order_id', 'pay_type', 'fx_uid', 'sh_uid'], 'required'],
  51. [['order_id', 'pay_type', 'fx_uid', 'sh_uid', 'status', 'delete_flag', 'category_id'], 'integer'],
  52. [['refush_money', 'amount_money'], 'number'],
  53. [['create_time', 'refund_time'], 'safe'],
  54. [['pay_order_id', 'app_id', 'open_id'], 'string', 'max' => 255],
  55. ];
  56. }
  57. /**
  58. * @inheritdoc
  59. */
  60. public function attributeLabels()
  61. {
  62. return [
  63. 'id' => 'ID',
  64. 'order_id' => 'Order ID',
  65. 'pay_order_id' => 'Pay Order ID',
  66. 'pay_type' => 'Pay Type',
  67. 'refush_money' => 'Refush Money',
  68. 'amount_money' => 'Amount Money',
  69. 'fx_uid' => 'Fx Uid',
  70. 'sh_uid' => 'Sh Uid',
  71. 'status' => 'Status',
  72. 'create_time' => 'Create Time',
  73. 'refund_time' => 'Refund Time',
  74. 'delete_flag' => 'Delete Flag',
  75. 'category_id' => 'Category ID',
  76. 'app_id' => 'App ID',
  77. 'open_id' => 'Open ID',
  78. ];
  79. }
  80. /**
  81. * Des:根据订单ID获取退款信息
  82. * Name: getInfoByOrderId
  83. * @param $orderId
  84. * @return array
  85. * @author 倪宗锋
  86. */
  87. public function getInfoByOrderId($orderId)
  88. {
  89. $return = $this->find()
  90. ->from(static::tableName())
  91. ->where(['=', 'order_id', $orderId])
  92. ->asArray(true)
  93. ->one();
  94. return $return;
  95. }
  96. /**
  97. * Des:根据ID获取退款信息
  98. * Name: getInfoByOrderId
  99. * @param $id
  100. * @return array
  101. * @author 倪宗锋
  102. */
  103. public function getInfoById($id)
  104. {
  105. $return = $this->find()
  106. ->from(static::tableName())
  107. ->where(['=', 'id', $id])
  108. ->asArray(true)
  109. ->one();
  110. return $return;
  111. }
  112. /**
  113. * Des:获取所有未退款的退款申请记录
  114. * Name: getAllUnPay
  115. * @author 倪宗锋
  116. */
  117. public function getUnPayIds()
  118. {
  119. $return = $this->find()->select(['id'])
  120. ->from(static::tableName())
  121. ->where(['=', 'status', 1])
  122. ->asArray(true)
  123. ->all();
  124. return $return;
  125. }
  126. /**
  127. * Des:修改退款状态
  128. * Name: updateStatus
  129. * @param $id
  130. * @param $status
  131. * @return int
  132. * @author 倪宗锋
  133. */
  134. public function updateStatus($id, $status)
  135. {
  136. $flag = self::updateAll(['status' => $status, 'refund_time' => date('Y-m-d H:i:s')], ['=', 'id', $id]);
  137. return $flag;
  138. }
  139. }