ChangeStatusOperation.php 889 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * Author: 芸众商城 www.yunzshop.com
  5. * Date: 2017/3/20
  6. * Time: 下午8:16
  7. */
  8. namespace app\frontend\modules\order\services\behavior;
  9. abstract class ChangeStatusOperation extends OrderOperation
  10. {
  11. /**
  12. * @var int 改变后状态
  13. */
  14. protected $statusAfterChanged;
  15. /**
  16. * 更新订单表
  17. * @return bool
  18. */
  19. protected function updateTable(){
  20. $this->status = $this->statusAfterChanged;
  21. if(isset($this->time_field)){
  22. $time_fields = $this->time_field;
  23. $this->$time_fields = time();
  24. }
  25. return $this->save();
  26. }
  27. /**
  28. * 执行订单操作
  29. * @return bool|void
  30. * @throws \app\common\exceptions\AppException
  31. */
  32. public function handle()
  33. {
  34. parent::handle();
  35. $this->updateTable();
  36. $this->_fireEvent();
  37. }
  38. }