---
# System prepended metadata

title: 修改房價api
tags: [進階房價]

---

# 修改房價api
###### tags:  `進階房價`
修改房價會動到的table有
1. LANG_RATECOD_MN
2. RATECOD_MN
3. RATECOD_DT
4. RATESUPPLY_DT
5. RATECOD_ADDON
6. rent_dt，會在store procedure裡產生

下列是各table的格式

### LANG_RATECOD_MN 房價多語系
只會有修改
```jsonld=
"table": {
    "lang_ratecod_mn":[
      {
       "action_cod": "U",
       "ratecod_nam" : "NBA",
       "words": "確認書",
       "condition":[
         {
            "field" : "athena_id",
            "value" : "1",
            "operator" : "equal"
         },
         {
            "field" : "hotel_cod",
            "value" : "01",
            "operator" : "equal"
         },
         {
            "field" : "rate_cod",
            "value" : "NBA",
            "operator" : "equal"
         },
         {
            "field" : "locale",
            "value" : "zh_TW",
            "operator" : "equal"
         },
         {
            "field" : "field_name",
            "value" : "rvconfirm_rmk",
            "operator" : "equal"
         }
        ]
      },
      {
       "action_cod": "U",
       "ratecod_nam" : "NBA",
       "words": "",
       "condition":[
         {
            "field" : "athena_id",
            "value" : "1",
            "operator" : "equal"
         },
         {
            "field" : "hotel_cod",
            "value" : "01",
            "operator" : "equal"
         },
         {
            "field" : "rate_cod",
            "value" : "NBA",
            "operator" : "equal"
         },
         {
            "field" : "locale",
            "value" : "en",
            "operator" : "equal"
         },
         {
            "field" : "field_name",
            "value" : "rvconfirm_rmk",
            "operator" : "equal"
         }
        ]
      },
      {
       "action_cod": "U",
       "ratecod_nam" : "NBA",
       "words": "NBAt",
       "condition":[
         {
            "field" : "athena_id",
            "value" : "1",
            "operator" : "equal"
         },
         {
            "field" : "hotel_cod",
            "value" : "01",
            "operator" : "equal"
         },
         {
            "field" : "rate_cod",
            "value" : "NBA",
            "operator" : "equal"
         },
         {
            "field" : "locale",
            "value" : "zh_TW",
            "operator" : "equal"
         },
         {
            "field" : "field_name",
            "value" : "ratecod_nam",
            "operator" : "equal"
         }
        ]
      },
      {
       "action_cod": "U",
       "ratecod_nam" : "NBA",
       "words": "",
       "condition":[
         {
            "field" : "athena_id",
            "value" : "1",
            "operator" : "equal"
         },
         {
            "field" : "hotel_cod",
            "value" : "01",
            "operator" : "equal"
         },
         {
            "field" : "rate_cod",
            "value" : "NBA",
            "operator" : "equal"
         },
         {
            "field" : "locale",
            "value" : "en",
            "operator" : "equal"
         },
         {
            "field" : "field_name",
            "value" : "ratecod_nam",
            "operator" : "equal"
         }
        ]
      }
    ]
  }
```
### RATECOD_MN 房價主檔
只會有修改
```jsonld=
"table": {
    "ratecod_mn":[
      {
       "action_cod": "U",
       "ratecod_nam" : "NBA",
       "words": "確認書",
       "condition":[
         {
            "field" : "athena_id",
            "value" : "1",
            "operator" : "equal"
         },
         {
            "field" : "hotel_cod",
            "value" : "01",
            "operator" : "equal"
         },
         {
            "field" : "rate_cod",
            "value" : "NBA",
            "operator" : "equal"
         },
         {
            "field" : "locale",
            "value" : "zh_TW",
            "operator" : "equal"
         },
         {
            "field" : "field",
            "value" : "rvconfirm_rmk",
            "operator" : "equal"
         }
        ]
      }
  }
```
### RATECOD_DT 房價dt
1. 若是在畫面下方修改價格的話是打修改
2. 在上面使用期間按鈕裡，增加刪除 日期區間or房型or假日規則 造成房價下方有增減的話，打新增  or刪除
```jsonld=
```
### RATESUPPLY_DT 使用區間
1. 新增時，要取出此rate_cod的使用區間(RATESUPPLY_DT)的最大supply_nos並+1
2. 在單筆做修改時，打修改
3. 刪除單筆時，打刪除
```jsonld=
```
### RATECOD_ADDON 加人加價
只會有修改
```jsonld=
```
### 整個範例api
```jsonld=
```
將上述5個table的範例，依照所需要的動作，產生規格並整合為以下全部規格
```jsonld=
{
  "prg_id": "PMS0810230",
  "socket_id": "uAW3dsoeyF-kRoksAAAM",
  "athena_id": 1,
  "ins_usr": "cio",
  "session_id": 3284131,
  "func_id": "0540",
  "params": {},
  "locale": "zh_TW",
  "trans_log_id": "20200213083959413",
  "mac": "",
  "comp_cod": "ZZATHENA",
  "hotel_cod": "01",
  "server_ip": "",
  "reve_code": "PMS0810230",
  "client_ip": "",
  "upd_usr": "cio",
  "user": "cio",
  "table": {
    "ratecod_mn":[
      {
       "action_cod": "D",
       "ratecod_nam" : "WNBA",
       "condition":[
         {
            "field" : "athena_id",
            "value" : "1",
            "operator" : "equal"
         },
         {
            "field" : "hotel_cod",
            "value" : "01",
            "operator" : "equal"
         },
         {
            "field" : "rate_cod",
            "value" : "WNBA",
            "operator" : "equal"
         }
        ]
      }
    ]
  },
  "event_time": "2020-02-13T08:39:59+08:00"
}
```
