12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- declare (strict_types = 1);
- namespace app\console\task;
- use app\console\service\OrderRefund as OrderRefundService;
- /**
- * 定时任务:设置优惠券过期状态
- * Class UserCoupon
- * @package app\console\task
- */
- class OrderRefund extends Task
- {
- // 当前任务唯一标识
- private $taskKey = 'OrderRefund';
- // 任务执行间隔时长 (单位:秒)
- protected $taskExpire = 60 * 5;
- // 当前商城ID
- private $storeId;
- /**
- * 任务处理
- * @param array $param
- */
- public function handle(array $param)
- {
- if(env('SERVE_ENV')=='test'){
- $this->taskExpire = 30;
- }
- ['storeId' => $this->storeId] = $param;
- $this->setInterval($this->storeId, $this->taskKey, $this->taskExpire, function () {
- // echo $this->taskKey . PHP_EOL;
- // 批量操作超时未退货的售后单
- $this->deliveryEvent();
- });
- }
- /**
- * 已同意退货退款售后单自动超时关闭售后单
- * 超过7天用户未退货,售后申请自动关闭,修改成超时未发货状态
- */
- private function deliveryEvent()
- {
- $commentDays = 7;
- if ($commentDays > 0) {
- $service = new OrderRefundService;
- $service->deliveryEvent($this->storeId, $commentDays);
- }
- }
- }
|