<?php

namespace App\Http\Controllers\Manage\Book;

use App\Http\Controllers\Controller;
use App\Http\Controllers\Manage\Book\Transformers\BadBookInfoTransformer;
use App\Http\Controllers\Manage\Book\Transformers\SuspendBookTransformer;
use App\Modules\Book\Services\BadBookInfoService;
use App\Modules\Statistic\Services\ProductionStatsEmailService;
use DB;
use Hashids;
use Illuminate\Http\Request;
use OSS\Core\OssException;
use OSS\OssClient;
use Storage;

class SuspendBookController extends Controller
{
    public function getSuspendBooks(Request $request){
        $page_size = $request->input('page_size');
        if(!$page_size){
            $page_size = 15;
        }
        $filter = '';
        $book_name = $request->input('book_name');
        if($book_name){
            $filter = [
                ['b.name','like','%'.$book_name.'%']
            ];
        }
        $suspend = ProductionStatsEmailService::getSuspendProducts(true,$page_size,$filter);
        return response()->pagination(new SuspendBookTransformer(),$suspend);
    }
}

