DeliveryMaiyatian.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. /**
  3. * 厦门云联储网络科技有限公司
  4. * https://www.baokuaiyun.com
  5. * Copyright (c) 2023 爆块云 All rights reserved.
  6. */
  7. namespace app\models;
  8. use Yii;
  9. use yii\behaviors\TimestampBehavior;
  10. use yii\db\ActiveRecord;
  11. class DeliveryMaiyatian extends \yii\db\ActiveRecord
  12. {
  13. /**
  14. * @inheritdoc
  15. */
  16. public static function tableName()
  17. {
  18. return '{{%delivery_maiyatian}}';
  19. }
  20. public function behaviors()
  21. {
  22. return [
  23. [
  24. 'class' => TimestampBehavior::class,
  25. 'attributes' => [
  26. ActiveRecord::EVENT_BEFORE_INSERT => ['created_at'],
  27. ActiveRecord::EVENT_BEFORE_UPDATE => ['updated_at'],
  28. ]
  29. ]
  30. ];
  31. }
  32. public function getRefundStatusName() {
  33. $res = '';
  34. if($this->is_refund == 2){
  35. $res = '退款已完成';
  36. }
  37. if($this->is_refund == 1){
  38. $res = '退款已申请';
  39. }
  40. if($this->refund_status == 1){
  41. $res = '退款已同意';
  42. }
  43. if($this->refund_status == 2){
  44. $res = '退款已拒绝';
  45. }
  46. return $res;
  47. }
  48. public function afterSave($insert, $changedAttributes)
  49. {
  50. parent::afterSave($insert, $changedAttributes);
  51. if(!$insert){
  52. $order = Order::findOne(['order_no' => $this->order_no]);
  53. \app\modules\admin\models\WastoreForm::afterDeliveryChange($this->store_id, $order);
  54. }
  55. }
  56. }