RefundSendBack.php 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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: 15:25
  9. */
  10. namespace app\backend\modules\refund\services\operation;
  11. use app\common\events\order\AfterOrderRefundSendBackEvent;
  12. use app\common\models\refund\RefundProcessLog;
  13. use app\common\models\refund\ReturnExpress;
  14. use app\common\repositories\ExpressCompany;
  15. class RefundSendBack extends RefundOperation
  16. {
  17. protected $statusBeforeChange = [self::WAIT_RETURN_GOODS];
  18. protected $statusAfterChanged = self::WAIT_RECEIVE_RETURN_GOODS;
  19. protected $name = '用户发货';
  20. protected $timeField = 'return_time'; //用户退货时间
  21. protected $returnExpress;
  22. protected function afterEventClass()
  23. {
  24. return new AfterOrderRefundSendBackEvent($this);
  25. }
  26. protected function updateBefore()
  27. {
  28. $express_company_name = array_get(ExpressCompany::create()->where('value', $this->getRequest()->input('express_company_code'))->first(), 'name', '其他快递');
  29. if ($express_company_name == "其他快递" && !empty($this->getRequest()->input('express_company_name'))) {
  30. $express_company_name = $this->getRequest()->input('express_company_name');
  31. }
  32. $data = [
  33. 'express_sn' => $this->getRequest()->input('express_sn'),
  34. 'express_company_name' => $express_company_name,
  35. 'express_code' => $this->getRequest()->input('express_company_code'),
  36. 'images' => $this->getRequest()->input('images'),
  37. ];
  38. $returnExpress = new ReturnExpress($data);
  39. $this->returnExpress()->save($returnExpress);
  40. $this->returnExpress = $returnExpress;
  41. }
  42. protected function updateAfter()
  43. {
  44. }
  45. protected function writeLog()
  46. {
  47. $detail = [
  48. '快递公司:'.$this->returnExpress->express_company_name,
  49. '快递单号:'.$this->returnExpress->express_sn,
  50. ];
  51. $processLog = RefundProcessLog::logInstance($this, RefundProcessLog::OPERATOR_MEMBER);
  52. $processLog->setAttribute('operate_type', RefundProcessLog::OPERATE_USER_SEND_BACK);
  53. $processLog->saveLog($detail);
  54. }
  55. }