You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
2.4 KiB

  1. <?php
  2. namespace backend\modules\shop\models\ars;
  3. use Yii;
  4. use yii\behaviors\TimestampBehavior;
  5. /**
  6. * This is the model class for table "ats_payment_log".
  7. *
  8. * @property int $id
  9. * @property int $order_id 订单id
  10. * @property string $wx_payment_id 微信退款单号
  11. * @property string $wx_refund_id 微信退款单号
  12. * @property string $mch_id 商户号
  13. * @property int $order_amount 订单金额
  14. * @property int $payment_amount 支付金额
  15. * @property string $notify_url 支付回调路径
  16. * @property int $type 类型
  17. * @property int $status 状态
  18. * @property string $refund_account 退款账户
  19. * @property int $updated_at 更新时间
  20. * @property int $created_at 创建时间
  21. * @property int $payment_at 支付时间
  22. */
  23. class PaymentLog extends \yii\db\ActiveRecord
  24. {
  25. /**
  26. * {@inheritdoc}
  27. */
  28. public static function tableName()
  29. {
  30. return 'ats_payment_log';
  31. }
  32. /**
  33. * {@inheritdoc}
  34. */
  35. public function rules()
  36. {
  37. return [
  38. [['order_amount', 'payment_amount', 'type', 'status', 'payment_at'], 'integer'],
  39. [['wx_payment_id', 'wx_refund_id', 'mch_id', 'refund_account'], 'string', 'max' => 64],
  40. [['order_id', 'notify_url'], 'string', 'max' => 255],
  41. ];
  42. }
  43. /**
  44. * {@inheritdoc}
  45. */
  46. public function attributeLabels()
  47. {
  48. return [
  49. 'id' => 'id',
  50. 'order_id' => '订单id',
  51. 'wx_payment_id' => '微信支付单号',
  52. 'wx_refund_id' => '微信退款单号',
  53. 'mch_id' => '商户号',
  54. 'order_amount' => '订单金额',
  55. 'payment_amount' => '支付金额',
  56. 'notify_url' => '支付回调路径',
  57. 'type' => '类型',
  58. 'status' => '状态',
  59. 'refund_account' => '退款账户',
  60. 'updated_at' => '更新时间',
  61. 'created_at' => '创建时间',
  62. ];
  63. }
  64. /**
  65. * @author linyao
  66. * @email 602604991@qq.com
  67. * @created Nov 8, 2019
  68. *
  69. * 行为存储创建时间和更新时间
  70. */
  71. public function behaviors()
  72. {
  73. return [
  74. [
  75. 'class' => TimestampBehavior::className(),
  76. 'createdAtAttribute' => 'created_at',
  77. 'updatedAtAttribute' => 'updated_at',
  78. 'value' => function() {
  79. return time();
  80. },
  81. ],
  82. ];
  83. }
  84. }