<?php

namespace App\Http\Controllers\Manage\Book;

use App\Http\Controllers\Controller;
use App\Libs\ChapterToImage;
use App\Libs\OSS;
use App\Modules\Book\Services\ChapterImageService;
use App\Modules\Book\Services\ChapterService;
use Hashids;
use Illuminate\Http\Request;
use Storage;

class ChapterImageController extends Controller
{

    /**
     * @apiDefine chapter 图书模块
     */

    /**
     * @apiVersion 1.0.0
     * @apiDescription 删除书本的章节图片
     * @api {post} books/deleteBookChapterImage 删除书本的章节图片
     * @apiGroup Book
     * @apiName deleteBookChapterImage
     * @apiParam   {int}    bid  bid
     * @apiSuccess {int}    code 状态码
     * @apiSuccess {String}  msg  信息
     * @apiSuccess {object}  data 结果集
     * @apiSuccessExample {json} Success-Response:
     *     HTTP/1.1 200 OK
     *     {
     *       code: 0,
     *       msg: "",
     *       data: {}
     *       }
     */
    public function deleteBookChapterImage(Request $request)
    {
        $bid = $request->input('bid');
        if (empty($bid)) {
            return response()->error('PARAM_EMPTY');
        }
        ChapterImageService::delete($bid);
        return response()->success();
    }
}
