import service from "../../utils/request"

/**
 * 获取首页推荐类型列表
 * @returns
 */
export function getRecommendTypeList() {
    return service.request({
        method: "post",
        url: "apingtxt/admin/recommend/type/list",
        data: {

        }
    })
}

/**
 * 根据类型获取推荐列表数据
 * @returns
 */
export function getRecommendDatasByType(search, type, page) {
    return service.request({
        method: "post",
        url: "apingtxt/admin/recommend/list",
        data: {
            search: search,
            type: type,
            pageSize: 20,
            page: page
        }
    })
}

/**
 * 添加小说推荐
 * @returns
 */
export function addRecommendStory(book_id, recommend_type_id) {
    return service.request({
        method: "post",
        url: "apingtxt/admin/recommend/add",
        data: {
            book_id: book_id,
            recommend_type_id: recommend_type_id
        }
    })
}

/**
 * 添加推荐类型
 * @returns type 0 横向 1 竖向
 */
export function addRecommendType(title, type) {
    return service.request({
        method: "post",
        url: "apingtxt/admin/recommend/type/add",
        data: {
            title: title,
            type: type
        }
    })
}

/**
 * 删除推荐类型
 * @returns
 */
export function deleteRecommendType(type_id) {
    return service.request({
        method: "post",
        url: "apingtxt/admin/recommend/type/delete",
        data: {
            type_id: type_id
        }
    })
}

/**
 * 删除小说推荐
 * @returns
 */
export function removeRecommendStory(book_id, recommend_type_id) {
    return service.request({
        method: "post",
        url: "apingtxt/admin/recommend/remove",
        data: {
            book_id: book_id,
            recommend_type_id: recommend_type_id
        }
    })
}

/**
 * 查看当前小说已添加到的推荐
 * @returns
 */
export function checkRecommendStory(book_id) {
    return service.request({
        method: "post",
        url: "apingtxt/admin/recommend/story/check",
        data: {
            book_id: book_id
        }
    })
}