nonesale post/list - Danh sách bài viết (app)

 


nonesale post/list - Lấy danh sách bài viết (app)
Tầng puplic
{{domain}}/d2d-nonsale/{{instance}}/api/post/list
    @pType = 2, -- ( 1 Post, 2 FOXWiki, 3 Chiến dịch )

{
    "Type"2,
    "PageNumber":1
}

{
    "Code"200,
    "Message": {
        "Title""Thông báo",
        "Message""Thành công.",
        "ExMessage"null,
        "Popup"0
    },
    "Data": {
        "Result": [
            {
                "Id"154,
                "Title""huong dan hv1",
                "DateAvalible""31/10/2022",
                "ExpirationDate""11/12/2022",
                "Image""https://hi-static.fpt.vn/sys/mobisalevn/dev/images/posts/17_11_2022_14_23_59_thumbnail_image001_(8).png",
                "SortOrder"1,
                "Type"2
            },
            {
                "Id"153,
                "Title""foxwikinew1",
                "DateAvalible""17/10/2020",
                "ExpirationDate""17/06/2026",
                "Image""https://hi-static.fpt.vn/sys/mobisalevn/dev/images/posts/17_11_2022_14_19_23_hinh-anh-con-ca1-1.jpg",
                "SortOrder"1,
                "Type"2
            },
        ],
        "Pagination"null
    }
}

Tẩng Core
{{domain}}/utility/api/v1.0/post/list
{
    "SaleTeamId":2,
    "Type":1,
    "PageNumber":1
}

{
    "Code"200,
    "Message": {
        "Message""Thành công.",
        "ExMessage"null
    },
    "Data": [
        {
            "Id"155,
            "Title""1",
            "Image""https://hi-static.fpt.vn/sys/mobisalevn/dev/images/posts/17_11_2022_15_17_28_hinh-anh-con-ca1-1.jpg",
            "DateAvalible""01/11/2022",
            "ExpirationDate""17/06/2025",
            "SortOrder"1,
            "Type"1
        },
        {
            "Id"152,
            "Title""test12345678",
            "Image""https://hi-static.fpt.vn/sys/mobisalevn/dev/images/posts/17_11_2022_14_18_32_hinh-anh-con-ca1-1.jpg",
            "DateAvalible""17/06/2020",
            "ExpirationDate""17/07/2026",
            "SortOrder"1,
            "Type"1
        },
    ]
}

Câu lệnh SQL trên C# Utility

 SELECT  p.ID,
        p.Title,
        p.Content,
        p.ShortDescription,
        p.Image,
        p.DateAvalible,
        p.ExpirationDate,
        p.SortOrder,
        p.Type,
        p.CreatedBy,
        p.CreatedDate,
        p.UpdatedBy,
        p.UpdatedDate
        FROM SalePlatform..SPF_Post(nolock) p 
        WHERE ((',' + RTRIM(p.SaleTeamID) + ',') LIKE '%,'+CAST(@pSaleTeamId as varchar(5))+',%' OR p.SaleTeamID = '') 
        AND (p.DateAvalible <= CAST(GETDATE() AS DATE) 
        AND p.ExpirationDate >= CAST(GETDATE() AS DATE))
        AND P.Type = @pType
                            ORDER BY p.SortOrder , p.ID DESC OFFSET @pPageSize * (@pPageNumber - 1) ROWS FETCH NEXT @pPageSize ROW ONLY



















Nhận xét