DeliveryKeloop.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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 DeliveryKeloop extends \yii\db\ActiveRecord
  12. {
  13. /**
  14. * @inheritdoc
  15. */
  16. public static function tableName()
  17. {
  18. return '{{%delivery_keloop}}';
  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 afterSave($insert, $changedAttributes)
  33. {
  34. parent::afterSave($insert, $changedAttributes);
  35. if(!$insert){
  36. $order = Order::findOne(['order_no' => $this->order_no]);
  37. \app\modules\admin\models\WastoreForm::afterDeliveryChange($this->store_id, $order);
  38. }
  39. }
  40. }