<?php
/**
测试类
 */

namespace App\Console\Commands\Tool;

use Log;
use Illuminate\Console\Command;
use App\Modules\User\Services\UserService;

use App\Modules\Book\Services\BookConfigService;

use App\Modules\OfficialAccount\Services\ForceSubscribeService;
use App\Modules\OfficialAccount\Services\OfficialAccountService;
use App\Modules\User\Services\ReadRecordService;
use App\Jobs\TikTokUser;
use App\Jobs\TikTokUserCharge;
use DB;

class TestSmartPush extends Command
{
    /**
     * 执行命令   Tool:TestSmartPush
     *
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'Tool:TestSmartPush';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '智能推送测试';

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        ini_set('memory_limit', '1024M');
        print_r('memory_used:'.memory_get_usage()."\n");
        print_r("======智能推送测试【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
        
        $ticktok = new TikTokUserCharge(20861,30,'2021-01-12 17:48:08');
        $res = $ticktok->handle();
        \Log::info('res:');\Log::info($res);
        
        $uid=6;
//         $book_num=2;
//         $bid=2;
       
// //         $recommend_books = BookConfigService::getSimpleChannelBookLoop($bid,$book_num,$uid);
// //         \Log::info('$recommend_books');
// //         \Log::info($recommend_books);
        
//         $distribution_channel_id = 14;
//         $url = 'https://site2.yunqibook.com/reader?bid=2JWv0Xk1B3yqYRPxxWR6Gejno54PZrO9&cid=485877&fromsource=smart_push';
        
//         $result = OfficialAccountService::get_short_url($distribution_channel_id,$url);
        
//         $result = ReadRecordService::getFirstReadRecord($uid);
//         \Log::info($result);
        
        print_r("======智能推送测试 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
        print_r('memory_used:'.memory_get_usage()."\n");
    }
}