<?php

namespace Test\Record;

use Framework\MVC\ModelManager;
use Game\Constant\ModelTypeDefine;
use Game\Data\RecordData;
use Game\Model\RecordModel;
use Test\TestBase;

class TestRecord extends TestBase
{

    public function getPlayerId(): int
    {
        return 288933167615617292;
    }

    public function startTest()
    {
        /**
         * @var RecordModel $recordModel
         */
        $recordModel = ModelManager::getInstance()->getModel(ModelTypeDefine::RECORD);
        //上限10个,查看DB
//        for ($i = 1; $i <= 20; $i++) {
//            $record = new RecordData($this->getPlayerId(), $i);
//            $record->initRecord(1, 1, 1, 1001);
//            //前10个添加收藏
//            if ($i <= 10) {
//                $recordModel->addCollection($i);
//            }
//            $recordModel->checkDelTopRecord();
//            sleep(1);
//        }
        //加20个,查看删除过期
        for ($i = 20; $i <= 40; $i++) {
            $record = new RecordData($this->getPlayerId(), $i);
            $record->initRecord(1, 1, 1, 1001);
            $recordModel->checkDelTopRecord();
            sleep(1);
        }
    }

}
