# URI-H-02 Favorite Product API ###### tags: `bizAdd` > [name=RoyHuang] ------------------------------------------------------------------------ ## API 清單 No | API | Desc | 執行順序 | 執行條件 :-:|----------|------------------|:-------:|---------- 1 | URI-H-02 | Prepare biz data | 1 | page init ------------------------------------------------------------------------ ## Prepare biz data - Favorite Product 商機所需顯示的資料 ### Path - {TT API 網址}/business/prepare/fav-product - method : POST - body : application/json;charset=UTF-8 - query : None ### Input JSON Path 欄位名稱 | 欄位說明 | 資料型態 | 是否必填 | 備註 ---------|--------|----------|:--------:|----- favProductInfos | 型錄id和語系id的資料集合 | string | Y | 型錄id + dash + 語系id,多組用逗號區隔 - EX: "1895999-41,1452595-42" ### Output JSON Path - 以公司切分群族,每個公司底下顯示各自的型錄 - 排序 - 1) 公司排序依公司id 有小至大 - 2) 型錄排序依型錄id 有大至小 ```json= { "code" : <number> , // 代碼,0:ok、 < 0: error 使用 "errorMsg" : <string> , // 錯誤訊息 "data" : [ { "companyId" : <number>, // 公司id "contactTitleName" : <string>, // 公司聯絡人稱呼 "contactName" : <string>, // 公司聯絡人名稱 "companyName" : <string>, // 公司名稱 "productInfos" : [ "productId" : <number>, // 型錄id "languageId" : <number>, // 語系id "productName" : <string>, // 型錄名稱 "modelNumber" : <string>, // 型錄型號 "productImgUrl" : <string>, // 型錄圖片url "productImgNote" : <string>, // 型錄圖片說明 "contactPictureUrl" : <string>, // 公司聯絡人大頭貼url "productCpUrl" : <string>, // 型錄CP url ] }, ...{} ] } ``` 欄位名稱 | 欄位說明 | 資料型態 | 是否空值 | 備註 ---------|--------|----------|:--------:|----- code | 代碼 | number | N | 0:ok、 < 0: error 使用 errorMsg | 錯誤訊息 | string | N | 代碼 < 0 時,會紀錄錯誤訊息 data | 資料集合 | Array[Object] | N | [公司群組的型錄清單(Object)](#公司群組的型錄清單) #### 公司群組的型錄清單 欄位名稱 | 欄位說明 | 資料型態 | 是否空值 | 備註 ---------|--------|----------|:--------:|-------- companyId | 公司id | number | N 整數,long type<br>EX: 2147483647 contactTitleName | 公司聯絡人稱呼 | string | N | contactName | 公司聯絡人名稱 | string | N | companyName | 公司名稱 | string | N | productInfos | 型錄資料集合 | Array[Object] | N | [型錄清單(Object)](#型錄清單)| #### 型錄清單 欄位名稱 | 欄位說明 | 資料型態 | 是否空值 | 備註 ---------|--------|----------|:--------:|----- productId | 型錄id | number | N | 整數,long type<br>EX: 2147483647 languageId | 語系id | number | N | 整數,int type productName | 型錄名稱 | string | N | modelNumber | 型錄型號 | string | N | productImgUrl | 型錄圖片url | string | Y | 圖檔不存在時,前台請用預設圖 productImgDesc | 型錄圖片說明 | string | N | contactPictureUrl | 公司聯絡人大頭貼url | string | Y | 圖檔不存在時,前台請用預設圖 productCpUrl | 型錄CP url | string | N | - 範例 ```json= { "code" : 0 "errorMsg" : "" "data" : [ { "companyId" : 65, "contactTitleName" : "Mr.", "contactName" : "測試看看", "companyName" : "TAIWAN EXTERNAL TRADE DEVELOPMENT COUNCIL", "productInfos" : [ { "productId" : 1452595, "languageId" : 42, "productName" : "Golden Placenta Ultra Essence12345", "modelNumber" : "BDS22", "productImgUrl" : "https://im01.ttstaging.com.tw/2a0d3256-b40a-4aca-8f0a-48ae987c5e09/", "productImgNote" : "", "contactPictureUrl" : "https://im01.ttstaging.com.tw/a84b0df3-1dd1-4828-a20b-b76ecf8f699c/CAK8CNGT-100x100-100x100.jpg", "productCpUrl" : "https://www.ttstaging.com.tw/product/golden-placenta-ultra-essence12345-1452595.html", }, ] }, { "companyId" : 147927, "contactTitleName" : "Mrs.", "contactName" : "李***", "companyName" : "HYWEB TECHNOLOGY CO., LTD.", "productInfos" : [ { "productId" : 1895999, "languageId" : 42, "productName" : "未販售型錄", "modelNumber" : "TT-0001", "productImgUrl" : "https://im01.ttstaging.com.tw/a33d2e8b-8149-4db7-9be3-53331f63adb7/螢幕快照_2016-08-03_下午2.44.161-360x360-150x150.jpg", "productImgNote" : "未販售型錄", "contactPictureUrl" : "https://im01.ttstaging.com.tw/3c4cdc29-b664-416e-a66a-ecfb21258f23/%E4%B8%8B%E8%BC%89-100x100.jpg", "productCpUrl" : "https://www.ttstaging.com.tw/product/未販售型錄-1895999.html", }, { "productId" : 1882019 "languageId" : 41 "productName" : "(Tw)檢查常用運費" "modelNumber" : "" "productImgUrl" : "https://im01.ttstaging.com.tw/9590939b-5be6-440d-beae-233796eb6b4b/pexels-negative-space-34577-150x150.jpg" "productImgNote" : "(Tw)檢查常用運費" "contactPictureUrl" : "" "productCpUrl" : "https://tw.ttstaging.com.tw/product/tw-檢查常用運費-1882019.html" } ] } ] } ``` ### SQL [參考](https://hackmd.io/kQegnS_oTGCx5MN1LOVDFQ?view#Favorite-product-Prepare-template-data)