2022-Front-SQL
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # URI-G-18 all-category / a to z API > [name=JasonWu] ###### tags: `URI-G` ## 內容 ### 舊版網址 - https://www.taiwantrade.com/categories-view/all-category.html ### 相關示意圖 - 依照分類顯示 ![](https://i.imgur.com/Th4rax6.jpg) - 依照字母順序顯示 ![](https://i.imgur.com/qUnvnQW.jpg) ### 相關程式 - 參考 ttcms 程式 - com.hyweb.tt.cms.cm.webservice.TaitracodeWebService - getList > 取得清單 - formClassify > 組合 classify 內容 - formAlphaBeta > 組合 a to z 內容 - sortArticle > 資料排序 ### Input JSON Path #### 規格 - path : ${TT-API網址}/category-view/{type}/{did} - method : GET #### Input 欄位名稱 | 欄位說明 | 資料型態 | 是否必要欄位 | 備註 -----------|--------------|----------|--------------|--------- type | 類型 | string | Y | 分為 classify 與 atoz 兩種 did | domain id | number | Y | int ==舊版紀錄如下 Column | Type | Require | Desc -----------|----------|---------|--------- type | string | Y | 類型,分為 classify 與 atoz 兩種 did | number | Y | domain id #### 範例 ```=json https://tt-api.taiwantrade.com/category-view/classify/2 https://tt-api.taiwantrade.com/category-view/atoz/2 ``` #### 邏輯 - 認證類型分兩類,對應參數紀錄如下 - 分類型: classify - 字母排序型: atoz - 解析 json 內容後顯示 - 依照傳入不同的類型,回傳的 classify 與 atoz 的內容不同 - 如果傳入 classify,請解析 classify,atoz 會是空的 - 反之,如果傳入 atoz,請解析 atoz,classify 會是空的 - classify 格式,要呈現階層式的效果,需要跟客戶討論 json 格式 - 直接採用階層式,二碼包四碼,四碼再包六碼 - 採用二碼一包,四碼一包,六碼一包,顯示時再各自尋找 parent 來組合 - 目前建議 json 格式採用二碼、四碼、六碼一包的方式 - atoz 格式,上面要有一排首字母,點選首字母後,跳轉到對應的區塊 - classify 需求 ![](https://i.imgur.com/C1iEUF8.jpg) - 首先需要解析 did,確定是標準 taitra code 還是自訂義 taitra code - 如果是標準 taitra code,透過 sql 取值 - 如果是自訂義 taitra code,透過 idol 取值 - 貿協希望 classify 也要提供二碼的跳轉效果,請參考圖片,參考網址 : https://www.alibaba.com/Products?spm=a27aq.21734014.scGlobalHomeHeader.360.53c962baI9g7Q1 - 點選後,跳轉到對應的二碼 classify,這一段可以解析 classify2 取得 - 依照回報訊息調整,api 回傳的 classify2 的內容排序依照目前的排序效果;api 回傳的 classify4 與 classify6 的排序依照字母來排列,套板時直接依照回傳 api 的排序來顯示 - classifyDefine 區塊內容資料放的是只有 classify2 資料,但沒有所屬的 classify4 與 classify6,這類的不需要特別的跳轉快捷列,直接顯示即可 ### Output JSON Path #### 規格 ```=json { "code" : <code>, "errorMsg" : <errorMsg>, "intervalTime" : <intervalTime>, "data" : { "classify2" : [ { "cateId" : <cateId>, "parentCateId" : <parentCateId>, "title" : <title>, "url" : <url> },... ], "classify4" : [ { "cateId" : <cateId>, "parentCateId" : <parentCateId>, "title" : <title>, "url" : <url> },... ], "classify6" : [ { "cateId" : <cateId>, "parentCateId" : <parentCateId>, "title" : <title>, "url" : <url> },... ], "classifyDefine" : [ { "cateId" : <cateId>, "parentCateId" : <parentCateId>, "title" : <title>, "url" : <url> },... ], "atoz" : [ { "cateId" : <cateId>, "firstChar" : <firstChar>, "title" : <title>, "url" : <url> },... ] } } ``` #### 輸出參數說明 all-category / a to z 輸出欄位 欄位名稱 | 欄位說明 | 資料型態 | 是否可為空值 | 備註 -----------|--------------|----------|--------------|-------- code | 執行狀態代碼 | number | N | int<br/>code=0為正常<br/>code<0為錯誤 errorMsg | 錯誤訊息 | string | N | intervalTime | 執行時間 | string | N | 顯示執行時間,單位 ms data | 主要輸出欄位 | [`主要輸出欄位(Object)`](#主要輸出欄位) | Y | 主要輸出欄位 ==舊版紀錄如下 |欄位名稱 | 欄位說明 | 型態 | 是否可為空值 | |--------------------|-------------|----------|------------| |code | 代碼 | int | 0表示ok | |errorMsg | 錯誤訊息 | string | | |data | 主要輸出欄位 | [`主要輸出欄位(Object)`](#主要輸出欄位) | | ##### 主要輸出欄位 欄位名稱 | 欄位說明 | 資料型態 | 是否可為空值 | 備註 -----------|--------------|----------|--------------|--------- classify2 | 二碼分類 | [`taitra code 分類格式(Object)`](#分類格式taitraCode) | Y | classify4 | 四碼分類 | [`taitra code 分類格式(Object)`](#分類格式taitraCode) | Y | classify6 | 六碼分類 | [`taitra code 分類格式(Object)`](#分類格式taitraCode) | Y | classifyDefine | 自定義分類 | [`taitra code 分類格式(Object)`](#分類格式taitraCode) | Y | atoz | 字母分類 | [`字母分類格式(Object)`](#字母分類格式atoz) | Y | ==舊版紀錄如下 |欄位名稱 | 欄位說明 | 型態 | 是否可為空值 | |--------------------|-------------|----------|------------| |classify2 | 二碼分類 | [`taitra code 分類格式(Object)`](#分類格式taitraCode) | Y | |classify4 | 四碼分類 | [`taitra code 分類格式(Object)`](#分類格式taitraCode) | Y | |classify6 | 六碼分類 | [`taitra code 分類格式(Object)`](#分類格式taitraCode) | Y | |atoz | 字母分類 | [`字母分類格式(Object)`](#字母分類格式atoz) | Y | ##### 分類格式taitraCode 欄位名稱 | 欄位說明 | 資料型態 | 是否可為空值 | 備註 -------------|------------------|----------|--------------|--- cateId | 分類 id | number | N | int parentCateId | 父結點 id | number | Y | int,二碼與自定義為 null,其他四碼六碼必須有值 title | 顯示名稱 | string | N | url | 點選後連結的 url | string | N | ==舊版紀錄如下 |欄位名稱 | 欄位說明 | 型態 | 是否可為空值 | |-------------------|-----------------------------|--------|--------------| |cateId | 分類 id | int | N | |parentCateId | 父結點 id | int | 二碼為 null,其他四碼六碼必須有值 | |~~sort~~ | ~~順序~~ | ~~int~~ | ~~N~~ | |title | 顯示名稱 | string | N | |url | 點選後連結的 url | string | N | ##### 字母分類格式atoz 欄位名稱 | 欄位說明 | 資料型態 | 是否可為空值 | 備註 -------------|------------------|----------|--------------|--- cateId | 分類 id | number | N | int firstChar | 首字母 | string | N | 首字母為 A~Z,其他的顯示 Other title | 顯示名稱 | string | N | url | 點選後連結的 url | string | N | ==舊版紀錄如下 |欄位名稱 | 欄位說明 | 型態 | 是否可為空值 | |-------------------|-----------------------------|--------|--------------| |cateId | 分類 id | int | N | |firstChar | 首字母 | string | N | |~~sort~~ | ~~順序~~ | ~~int~~ | ~~N~~ | |title | 顯示名稱 | string | N | |url | 點選後連結的 url | string | N | #### 範例 ```=json { "code" : 0, "errorMsg" : "", "intervalTime" : "4360 ms", "data" : { "classify2" : [ { "cateId" : 5739, "parentCateId" : null, "title" : "Agricultural & Food", "url": "word=*&cate=5739&type=product&style=gallery&cateName=agricultural-food" }, { "cateId" : 5741, "parentCateId" : null, "title" : "Mineral & Metallurgy", "url": "word=*&cate=5741&type=product&style=gallery&cateName=mineral-metallurgy" } ], "classify4" : [ { "cateId" : 5850, "parentCateId" : 5739, "title" : "Livestock", "url": "word=*&cate=5850&type=product&style=gallery&cateName=livestock" }, { "cateId" : 5837, "parentCateId" : 5741, "title" : "Energy Minerals", "url": "word=*&cate=5837&type=product&style=gallery&cateName=energy-minerals" } ], "classify6" : [ { "cateId" : 7142, "parentCateId" : 5850, "title" : "Chicken", "url": "word=*&cate=7142&type=product&style=gallery&cateName=chicken" }, { "cateId" : 5903, "parentCateId" : 5837, "title" : "Coal", "url": "word=*&cate=5903&type=product&style=gallery&cateName=coal" } ], "classifyDefine": [ { "cateId": 72250, "parentCateId": null, "title": "temp name", "url": "word=*&cate=72250&type=product&style=gallery&cateName=temp-name" } ], "atoz" : [ { "cateId" : 8627, "firstChar" : "A", "title" : "A / V Switch & Splitter", "url": "word=*&cate=8627&type=product&style=gallery&cateName=a-v-switch-splitter" }, { "cateId" : 8674, "firstChar" : "B", "title" : "Baby Bathtub & Bathing Accessories", "url": "word=*&cate=8674&type=product&style=gallery&cateName=baby-bathtub-bathing-accessories" } ] } } ```

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully