where([ 'order_type' => 'physical', 'status' => \app\common\constant\order\Status::STATUS_UNRECEIVE, 'createtime' => ['<', time() - $autoConfirmTime] ])->field(['id', 'order_no'])->select(); foreach ($list as $item) { $orderModel->where([ 'id' => $item['id'] ])->update([ 'status' => \app\common\constant\order\Status::STATUS_SUCCESS ]); \app\common\model\order\Log::set($item['id'], "系统自动确认收货"); } return 'ok'; } }