<?php
namespace App\Modules\UserTask\Services;

use App\Modules\UserTask\Models\ChapterOrder;

/**
 * 阅读任务
 */
class ReadTask extends RepeatTask
{
    public function judgeUpTo()
    {
        switch ($this->task->code) {
            case 'date_subscribe_reward':
                return ChapterOrder::model($this->uid)
                    ->where('uid', $this->uid)
                    ->where('created_at', '>=', date('Y-m-d'))
                    ->select('cid')
                    ->distinct()
                    ->count() >= 10;
            case 'date_subscribe_reward':
                return true;
                break;
            default:
                return false;
        }
    }
}