設定服務順序

規格

如要影響特定商家服務的顯示順序,請在服務動態饋給中的每個 Service 上設定 ranking_hint.score
// Ranking hints for a service.
message ServiceRankingHint {
  // Arbitrary partner or merchant assigned rank for this service.
  //
  // Services with a higher score will be shown more prominently (e.g. shown
  // higher in lists). Note that other factors may also influence ranking, such
  // as price, availability, user history, etc.
  //
  // Optional. Must be non-negative if set.
  optional float score = 1;
}
顯示多項服務時 (例如,「預訂」按鈕後方直接顯示了供使用者選擇的所有服務的網頁),系統會使用 Service.ranking_hint.score 做為服務訂購服務的信號之一。服務頁面中的分數越高,服務就會顯示。

範例

某商家有 3 項服務「剪髮」、「著色」、「Scalp 按摩和髮型」,以下是他們偏好的訂單:
  1. 剪髮
  2. 頭皮按摩與理髮
  3. 著色
服務動態饋給可以指定如下:

服務

{
  "service": [
    {
      "price": {
        "currency_code": "USD",
        "price_micros": 20000000
      },
      "service_id": "haircut",
      "prepayment_type": "NOT_SUPPORTED",
      "merchant_id": "beauty-1",
      "localized_service_name": {
        "value": "Haircut",
        "localized_value": [
          {
            "locale": "en",
            "value": "Haircut"
          }
        ]
      },
      "localized_description": {
        "value": "Get a haircut.",
        "localized_value": [
          {
            "locale": "en",
            "value": "Get a haircut."
          }
        ]
      },
      "ranking_hint": {
        "score": 30.0
      }
    },
    {
      "localized_service_name": {
        "value": "Coloring",
        "localized_value": [
          {
            "locale": "en",
            "value": "Coloring"
          }
        ]
      },
      "price": {
        "currency_code": "USD",
        "price_micros": 40000000
      },
      "service_id": "haircoloring",
      "prepayment_type": "NOT_SUPPORTED",
      "merchant_id": "beauty-1",
      "localized_description": {
        "value": "Get your hair dyed.",
        "localized_value": [
          {
            "locale": "en",
            "value": "Get your hair dyed."
          }
        ]
      },
      "ranking_hint": {
        "score": 10.0
      }
    },
    {
      "localized_service_name": {
        "value": "Scalp massage and Haircut",
        "localized_value": [
          {
            "locale": "en",
            "value": "Scalp massage and Haircut"
          }
        ]
      },
      "price": {
        "currency_code": "USD",
        "price_micros": 30000000
      },
      "service_id": "scalpmassage",
      "prepayment_type": "NOT_SUPPORTED",
      "merchant_id": "beauty-1",
      "localized_description": {
        "value": "Get a shampoo and scalp massage followed by a haircut.",
        "localized_value": [
          {
            "locale": "en",
            "value": "Get a shampoo and scalp massage followed by a haircut."
          }
        ]
      },
      "ranking_hint": {
        "score": 20.0
      }
    }
  ]
}
上述指定的順序 (不含其他信號) 會產生:

服務順序:理髮、頭皮按摩、髮型、上色。