1. 程式人生 > 其它 >javascript self物件使用詳解 location.href = url

javascript self物件使用詳解 location.href = url

【TcaplusDB知識庫】如何檢查指定的xml/tdr/proto檔案定義的表

 

加表時支援proto檔案

請求地址

POST
http://OmsAddress/app/newoms.php/webservice/attachment?app_id=appId&zone_id=zoneId&cmd=10001&ip-type=webservicerest&access-token=AccessTokenVal

url中GET引數說明

欄位名稱 資料型別 說明 是否為必填欄位 備註
app_id 整型 上傳檔案所屬業務id 建議指定app_id引數的值,這樣使用介面上傳的檔案在tcaplus oms頁面上也可以使用,同時方便查詢問題
zone_id 整型 上傳檔案所屬遊戲區的id  

 

POST請求引數說明

欄位名稱 資料型別 說明 是否為必填欄位 備註
filename 字串 需要上傳的檔案的名稱  
content 字串 需要上傳的檔案的內容(上傳的檔案內容上限為10M)  

 

Data引數

使用json格式表示記錄相關資訊,示例如下:

{
  "filename": "check_modify_generic_table.xml",
  "content": "<?xml version=\"1.0\" encoding=\"GBK\" standalone=\"yes\" ?> <metalib name=\"table_test\" tagsetversion=\"1\" version=\"1\"><struct name=\"test_table_generic_modify\" version=\"1\" splittablekey=\"gameid\" primarykey=\"gameid,itemid,name\"><entry name=\"gameid\" type=\"uint\" /><entry name=\"itemid\" type=\"uint\" /><entry name=\"name\" type=\"string\" size=\"250\" /><entry name=\"typeid\" type=\"uint8\"/><entry name=\"Data\" type=\"tinyuint\" defaultvalue=\"9\"/><entry name=\"uname\" type=\"string\" size=\"5\" defaultvalue=\"ab\"/><index name=\"index1\" column=\"gameid\" /></struct></metalib>"
}

上傳proto檔案示例:

{
  "filename": "test_table.proto",
  "content": "syntax = \"proto3\";package myTcaplusTable;import \"tcaplusservice.optionv1.proto\;"
}

返回語法

返回引數說明

欄位名稱 資料型別 說明 備註
id 整型 上傳的檔案的id,“3.5.2 申請(tdr/xml)檔案加表”、申請修改表時需要使用此值  
file_name 字串 上傳的檔名稱  
file_size 字串 上傳的檔案大小(B)  
file_ext
字串 上傳的檔案字尾  

 

請求示例

通過 curl 方法發起請求

命令中的紅色部分是需要使用者自行填寫的引數,請參閱url中GET引數說明

curl -H "Content-type: application/json" -X "POST" -d '{ "filename": "check_modify_generic_table.xml", "content": "<?xml version=\"1.0\" encoding=\"GBK\" standalone=\"yes\" ?> " }' http://omsaddress/app/newoms.php/webservice/attachment?app_id=<app_id>&zone_id=<zone_id>&cmd=10001&ip-type=webservicerest&access-token=<access-token>

返回示例

成功返回示例

http請求的Status=200

{
  "id": 99,
  "file_name": "check_modify_generic_table",
  "file_size": 545,
  "file_ext": "xml",
  "url": "http://10.123.16.72/app/global/uploadfile/2017/03/02/2017030219481393920952.xml"
}

錯誤返回

http請求的Status!=200

{
  "name": "Unauthorized",
  "message": "You are requesting with an invalid credential.",
  "code": 0,
  "status": 401,
  "type": "yii\\web UnauthorizedHttpException"
}
{
  "source_ip": "ip:10.29.89.51 not in whitelist"
}

TcaplusDB是騰訊出品的分散式NoSQL資料庫,儲存和排程的程式碼完全自研。具備快取+落地融合架構、PB級儲存、毫秒級時延、無損水平擴充套件和複雜資料結構等特性。同時具備豐富的生態、便捷的遷移、極低的運維成本和五個九高可用等特點。客戶覆蓋遊戲、網際網路、政務、金融、製造和物聯網等領域。