# 商品管理API 指派:Willie ## API文件 ### 取得商品列表 #### Product/GetProduct * Rrequest Parameter ``` json { "P_Id": "2024_01_0001", "P_Name": "韓系 糖果色 純色 薄款 春夏季 中筒襪 女生襪子 女襪 襪子推薦", "SpecName": "馬卡龍色系,繽紛可愛,穿搭好夥伴~", "Category": 1 } ``` * Response Parameter ``` json { "Id": "1", "P_Id": "2024_01_0001", "Name": "韓系 糖果色 純色 薄款 春夏季 中筒襪 女生襪子 女襪 襪子推薦", "Description": "馬卡龍色系,繽紛可愛,穿搭好夥伴~", "Cost_CNY": 4.5 "Cost_TWD": 18, "Link": "https://detail.1688.com/offer/723794100043.html?spm=a360q.7751291.0.0.507829a8bDBS1J&sk=common", "Launch_Date": "2024-02-01 00:00:00", "Image_Path": "https://i.imgur.com/CMV8WC3.jpeg", "Category": 1 "ProductDetails":[ { "Id": 1, "P_Id": "2024_01_0001", "Name": "白色", "Price": 45, "Image_Path": "https://i.imgur.com/w4lZnel.jpeg", "Stock_Count": 1, "Restock_Count": 9, "Sold_Count": 0 }, {...} ] } ``` ### 根據ID取得商品 #### Product/GetProductByPId * Rrequest Parameter ``` json { "P_Id": "2024_01_0001", "P_Name": "韓系 糖果色 純色 薄款 春夏季 中筒襪 女生襪子 女襪 襪子推薦", "SpecName": "馬卡龍色系,繽紛可愛,穿搭好夥伴~", "Category": 1 } ``` ### 新增商品資料 * Product/InsertProductAsync * Rrequest Parameter ``` json { "p_id": "2024_01_0001", "name": "韓系 糖果色 純色 薄款 春夏季 中筒襪 女生襪子 女襪 襪子推薦", "description": "馬卡龍色系,繽紛可愛,穿搭好夥伴~", "cost_cny": 2.5, "cost_twd": 15.0, "link": "https://detail.1688.com/offer/723794100043.html?spm=a360q.7751291.0.0.507829a8bDBS1J&sk=common", "launch_date": "2024-01-25", "image_path": "1.png" } ``` * Response Json ``` json { "status": "success", "msg": "新增商品資料成功!", "rtn_page": "index", } ``` * Product/InsertDetialAsync * Rrequest Parameter ``` json { "p_id": "2024_01_0001", "name": "白色", "price": 30, "image_path": "1.png", "stock_count": 0, "restock_count": 0, "sold_count": 0, } ``` * Response Json ``` json { "status": "success", "msg": "新增商品細項資料成功!", "rtn_page": "index", } ``` 2.取得商品資料 * Product/Get * Rrequest Parameter ``` json { "p_id": "", "name": "", "spec_name": "", } ``` * Response Json ``` json { "main_id": 1, "p_id": "2024_01_0001", "name": "", "description": "", "cost_cny": "", "cost_twd": "", "launch_date": "", "image_path": "", "detail_list":[ { "spec_id": "", "spec_name": "", "price": "", "spec_image_path": "", "stock_count": 4, "restock_count": 20, "sold_count": 16, } ] } ``` 3.更新產品主檔資料 * Product/UpdateProduct * Rrequest Parameter ```json { "id": "1", "p_id": "", "name": "", "description": "", "cost_cny": "", "cost_twd": "", "link": "", "launch_date": "", "image_path": "", } ``` * Response Json ``` json { "status": "success", "msg": "更新商品資料成功!", "rtn_page": "index", } ``` * Product/DetailUpdate * Rrequest Parameter ```json { "id": "1", "name": "", "price": "", "image_path": "", } ``` * Response Json ``` json { "status": "success", "msg": "更新商品明細資料成功!", "rtn_page": "index", } ```