|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- <?php
-
- namespace common\models;
-
- use Yii;
- use yii\db\Expression;
-
- /**
- * This is the model class for table "pay_refush".
- *
- * @property integer $id
- * @property integer $order_id
- * @property integer $pay_roder_id
- * @property integer $pay_type
- * @property string $amount_money
- * @property integer $fx_uid
- * @property integer $sh_uid
- * @property integer $status
- * @property string $create_time
- * @property string $refund_time
- * @property integer $delete_flag
- */
- class PayRefush extends \yii\db\ActiveRecord
- {
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return 'pay_refush';
- }
-
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [['order_id', 'pay_type', 'fx_uid', 'sh_uid'], 'required'],
- [['order_id', 'pay_type', 'fx_uid', 'sh_uid', 'status', 'delete_flag'], 'integer'],
- [['amount_money', 'refush_money'], 'number'],
- [['create_time', 'refund_time', 'pay_order_id'], 'safe'],
- ];
- }
-
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'order_id' => 'Order ID',
- 'pay_order_id' => 'pay_order_id',
- 'pay_type' => 'Pay Type',
- 'amount_money' => 'Amount Money',
- 'refush_money' => 'refush_money',
- 'fx_uid' => 'Fx Uid',
- 'sh_uid' => 'Sh Uid',
- 'status' => 'Status',
- 'create_time' => 'Create Time',
- 'refund_time' => 'Refund Time',
- 'delete_flag' => 'Delete Flag',
- ];
- }
-
- /**
- * Des:根据订单ID获取退款信息
- * Name: getInfoByOrderId
- * @param $orderId
- * @return array
- * @author 倪宗锋
- */
- public function getInfoByOrderId($orderId)
- {
- $return = $this->find()
- ->from(static::tableName())
- ->where(['=', 'order_id', $orderId])
- ->asArray(true)
- ->one();
- return $return;
- }
-
- /**
- * Des:根据ID获取退款信息
- * Name: getInfoByOrderId
- * @param $id
- * @return array
- * @author 倪宗锋
- */
- public function getInfoById($id)
- {
- $return = $this->find()
- ->from(static::tableName())
- ->where(['=', 'id', $id])
- ->asArray(true)
- ->one();
- return $return;
- }
-
- /**
- * Des:获取所有未退款的退款申请记录
- * Name: getAllUnPay
- * @author 倪宗锋
- */
- public function getUnPayIds()
- {
- $return = $this->find()->select(['id'])
- ->from(static::tableName())
- ->where(['=', 'status', 1])
- ->asArray(true)
- ->all();
- return $return;
- }
-
- /**
- * Des:修改退款状态
- * Name: updateStatus
- * @param $id
- * @param $status
- * @return int
- * @author 倪宗锋
- */
- public function updateStatus($id, $status)
- {
- $flag = self::updateAll(['status' => $status, 'refund_time' => date('Y-m-d H:i:s')], ['=', 'id', $id]);
- return $flag;
- }
- }
|