添加2001 b_N上传方法
This commit is contained in:
parent
b02c12831c
commit
a87c754d5d
@ -17,22 +17,13 @@ class SS_Virtual_command:
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.ss_virtual_url = "http://10.10.3.14:8993/v1/ta/meta/prop/virtual/dict/create"
|
self.ss_virtual_url = "http://10.10.3.14:8993/v1/ta/meta/prop/virtual/dict/create"
|
||||||
self.method = "post"
|
self.method = "post"
|
||||||
|
self.loginName = "root"
|
||||||
|
self.password = "kingsome2016"
|
||||||
|
|
||||||
|
def run_cmd(cmd):
|
||||||
def upload_gameid(self, filename):
|
import subprocess
|
||||||
|
msg = "Starting run: %s " % cmd
|
||||||
projectId = int(19)
|
print("run_cmd {0}".format(msg))
|
||||||
createParam = {"commonHeader": {"projectId": 19},
|
|
||||||
"mainColumn": {"property": {"columnName": "gameid", "tableType": 0}},
|
|
||||||
"columns": [{"property": {"columnName": "gameid", "columnDesc": "主键ID", "selectType": "number"}},
|
|
||||||
{"property": {"columnName": "gameid_china", "columnDesc": "china映射", "selectType": "string"}}]}
|
|
||||||
loginName = "root"
|
|
||||||
password = "kingsome2016"
|
|
||||||
body = {"projectId": projectId, "createParam": createParam, "loginName": loginName, "password": password}
|
|
||||||
quote_body = my_quote(body)
|
|
||||||
|
|
||||||
cmd = f"curl --header 'Accept: application/json' --form 'file=@{filename}' '{self.ss_virtual_url}?{quote_body}'"
|
|
||||||
print(cmd)
|
|
||||||
cmdref = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
cmdref = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||||
output, error_info = cmdref.communicate()
|
output, error_info = cmdref.communicate()
|
||||||
if cmdref.returncode != 0:
|
if cmdref.returncode != 0:
|
||||||
@ -45,22 +36,52 @@ class SS_Virtual_command:
|
|||||||
print(f"Run Success,output was {output}")
|
print(f"Run Success,output was {output}")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# r = requests.post(url=self.ss_virtual_url, header="Accept: application/json", files=filename, data=quote_body)
|
|
||||||
# if r.status_code == requests.codes.ok:
|
def upload_gameid(self):
|
||||||
# print(f"upload success,return={r.content}")
|
filename = "/data/git/ops_interface/ops/csv/gameid.csv"
|
||||||
# return True
|
projectId = int(19)
|
||||||
# else:
|
createParam = {"commonHeader": {"projectId": 19},
|
||||||
# print(f"upload failed,return={r.content}")
|
"mainColumn": {"property": {"columnName": "gameid", "tableType": 0}},
|
||||||
# return False
|
"columns": [{"property": {"columnName": "gameid", "columnDesc": "主键ID", "selectType": "number"}},
|
||||||
|
{"property": {"columnName": "gameid_china", "columnDesc": "china映射", "selectType": "string"}}]}
|
||||||
|
|
||||||
|
body = {"projectId": projectId, "createParam": createParam, "loginName": self.loginName,
|
||||||
|
"password": self.password}
|
||||||
|
quote_body = my_quote(body)
|
||||||
|
|
||||||
|
cmd = f"curl --header 'Accept: application/json' --form 'file=@{filename}' '{self.ss_virtual_url}?{quote_body}'"
|
||||||
|
print(cmd)
|
||||||
|
if self.run_cmd(cmd):
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def upload_2001_b_n(self):
|
||||||
|
filename = "/data/git/ops_interface/ops/csv/2001_b_n.csv"
|
||||||
|
projectId = int(21)
|
||||||
|
createParam = {"commonHeader": {"projectId": 21},
|
||||||
|
"mainColumn": {"property": {"columnName": "#vp@b_n", "tableType": 0, "subTableType": "vprop_sql"}},
|
||||||
|
"columns": [{"property": {"columnName": "b_n", "columnDesc": "跳转appid", "selectType": "string"}},
|
||||||
|
{"property": {"columnName": "b_n_china", "columnDesc": "跳转中文名", "selectType": "string"}}]}
|
||||||
|
|
||||||
|
body = {"projectId": projectId, "createParam": createParam, "loginName": self.loginName,
|
||||||
|
"password": self.password}
|
||||||
|
quote_body = my_quote(body)
|
||||||
|
|
||||||
|
cmd = f"curl --header 'Accept: application/json' --form 'file=@{filename}' '{self.ss_virtual_url}?{quote_body}'"
|
||||||
|
print(cmd)
|
||||||
|
if self.run_cmd(cmd):
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
if len(sys.argv) != 2:
|
|
||||||
raise Exception("PLS input filename which need upload!")
|
|
||||||
|
|
||||||
filename = sys.argv[1]
|
|
||||||
ss = SS_Virtual_command()
|
ss = SS_Virtual_command()
|
||||||
ss.upload_gameid(filename)
|
# ss.upload_gameid()
|
||||||
|
ss.upload_2001_b_n()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user