| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <?php
- namespace backend\modules\mall\services;
- use common\enums\RefundStatusEnum;
- use common\logic\order\OrderRefundLogic;
- use common\models\order\OrderRefund;
- /**
- * 售后Service
- * @package backend\modules\mall\services
- */
- class RefundService extends BaseService
- {
- /**
- * 订单撤销售后申请
- *
- * @param integer $id
- * @param array $otherData 其他数据
- * @return boolean
- */
- public function revoceRefund(int $id, array $otherData = [])
- {
- /**
- * @var OrderRefund|null
- */
- $refund = OrderRefund::find()->where(['mall_id' => $this->mall_id, 'id' => $id])->one();
- if (empty($refund)) return $this->error('售后单不存在');
- // 是否超时
- if (!$refund->isReturnTimeoutOfRefund()) return $this->error('当前订单还不能撤单');
- // 拒绝售后
- return ($logic = new OrderRefundLogic())->execute($this->mall_id, [
- 'id' => $refund->id,
- 'step_status' => RefundStatusEnum::STEP_NEGATIVE_1,
- 'address' => [
- 'address' => '',
- 'consignee' => '',
- 'mobile' => '',
- ],
- 'refund_reason' => '退货超期,拒绝售后',
- 'is_expired' => '1', // 是否是售后期限关闭的售后订单
- 'is_admin' => (int)!empty($otherData['is_admin']),
- 'is_store' => (int)!empty($otherData['is_store']),
- 'operator_id' => $otherData['operator_id'] ?? 0,
- ]) ? true : $this->error($logic->getError());
- }
- }
|