RefundReject.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * Name: 芸众商城系统
  5. * Author: 广州市芸众信息科技有限公司
  6. * Profile: 广州市芸众信息科技有限公司位于国际商贸中心的广州,专注于移动电子商务生态系统打造,拥有芸众社交电商系统、区块链数字资产管理系统、供应链管理系统、电子合同等产品/服务。官网 :www.yunzmall.com www.yunzshop.com
  7. * Date: 2021/12/22
  8. * Time: 14:22
  9. */
  10. namespace app\backend\modules\refund\services\operation;
  11. use app\backend\modules\refund\services\RefundMessageService;
  12. use app\common\events\order\AfterOrderRefundRejectEvent;
  13. use app\common\models\refund\RefundApply;
  14. use app\common\models\refund\RefundGoodsLog;
  15. use app\common\models\refund\RefundProcessLog;
  16. /**
  17. * 驳回退款申请
  18. * Class RefundReject
  19. * @package app\backend\modules\refund\services\operation
  20. */
  21. class RefundReject extends RefundOperation
  22. {
  23. protected $statusBeforeChange = [self::WAIT_CHECK,self::WAIT_RETURN_GOODS,self::WAIT_RECEIVE_RETURN_GOODS];
  24. protected $name = '驳回';
  25. protected $statusAfterChanged = self::REJECT;
  26. protected function afterEventClass()
  27. {
  28. return new AfterOrderRefundRejectEvent($this);
  29. }
  30. protected function updateBefore()
  31. {
  32. $this->setAttribute('reject_reason', $this->getRequest()->input('reject_reason'));
  33. $this->setAttribute('status', self::REJECT);
  34. $this->setAttribute('reject_time', time());
  35. }
  36. protected function updateAfter()
  37. {
  38. $this->cancelRefund();
  39. //取消申请删除记录
  40. $this->delRefundOrderGoodsLog();
  41. }
  42. protected function writeLog()
  43. {
  44. $detail = [
  45. '驳回原因:'.$this->reject_reason,
  46. ];
  47. $processLog = RefundProcessLog::logInstance($this, RefundProcessLog::OPERATOR_SHOP);
  48. $processLog->setAttribute('operate_type', RefundProcessLog::OPERATE_REJECT);
  49. $processLog->saveLog($detail);
  50. }
  51. protected function sendMessage()
  52. {
  53. RefundMessageService::rejectMessage($this);//通知买家
  54. if (app('plugins')->isEnabled('instation-message')) {
  55. //开启了站内消息插件
  56. event(new \Yunshop\InstationMessage\event\RejectOrderRefundEvent($this));
  57. }
  58. }
  59. }