fix dirs
This commit is contained in:
parent
8478e14d8b
commit
47b1f76017
@ -1,11 +1,105 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import requests
|
import requests
|
||||||
import logging
|
import logging
|
||||||
from ops.ss_virtual_create import SS_Virtual_command
|
#from ops.ss_virtual_create import SS_Virtual_command
|
||||||
import json
|
import json
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
import pdb
|
import pdb
|
||||||
|
|
||||||
|
from urllib.parse import unquote, quote, urlencode
|
||||||
|
|
||||||
|
def my_quote(data):
|
||||||
|
if isinstance(data, dict):
|
||||||
|
return urlencode(data)
|
||||||
|
elif isinstance(data, str):
|
||||||
|
return quote(data)
|
||||||
|
|
||||||
|
|
||||||
|
class SS_Virtual_command:
|
||||||
|
def __init__(self):
|
||||||
|
self.ss_virtual_url = "http://10.10.3.14:8993/v1/ta/meta/prop/virtual/dict/create"
|
||||||
|
self.method = "post"
|
||||||
|
self.loginName = "root"
|
||||||
|
self.password = "kingsome2016"
|
||||||
|
|
||||||
|
def run_cmd(self, cmd):
|
||||||
|
import subprocess
|
||||||
|
msg = "Starting run: %s " % cmd
|
||||||
|
print("run_cmd {0}".format(msg))
|
||||||
|
cmdref = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||||
|
output, error_info = cmdref.communicate()
|
||||||
|
if cmdref.returncode != 0:
|
||||||
|
if isinstance(error_info, list) or isinstance(error_info, tuple):
|
||||||
|
error_info = error_info[0]
|
||||||
|
msg = "RUN %s ERROR,error info: %s" % (cmd, error_info)
|
||||||
|
print(f"{msg},error output={output}")
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
print(f"Run Success,output was {output}")
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def upload_gameid(self):
|
||||||
|
filename = "/data/git/ops_interface/ops/csv/gameid.csv"
|
||||||
|
projectId = int(19)
|
||||||
|
createParam = {"commonHeader": {"projectId": 19},
|
||||||
|
"mainColumn": {"property": {"columnName": "gameid", "tableType": 0}},
|
||||||
|
"columns": [{"property": {"columnName": "gameid", "columnDesc": "主键ID", "selectType": "string"}},
|
||||||
|
{"property": {"columnName": "gameid_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 upload_2001_b_n(self):
|
||||||
|
filename = "/data/git/ops_interface/ops/csv/2001_b_n.csv"
|
||||||
|
projectId = int(22)
|
||||||
|
createParam = {"commonHeader": {"projectId": 22},
|
||||||
|
"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 upload_1004_button_name(self):
|
||||||
|
filename = "/data/git/ops_interface/ops/csv/1004_button_name.csv"
|
||||||
|
projectId = int(19)
|
||||||
|
createParam = {"commonHeader": {"projectId": 19},
|
||||||
|
"mainColumn": {"property": {"columnName": "#vp@button_name", "tableType": 0, "subTableType": "vprop_sql"}},
|
||||||
|
"columns": [{"property": {"columnName": "button_name", "columnDesc": "点击按钮属性", "selectType": "string"}},
|
||||||
|
{"property": {"columnName": "button_name_cn", "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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Mp2shushu():
|
class Mp2shushu():
|
||||||
def __init__(self, gameid, channel):
|
def __init__(self, gameid, channel):
|
||||||
self.mp_url = f"http://10.10.5.4:2333/api/open/promotion/co-list?channelid={channel}&gameid={gameid}"
|
self.mp_url = f"http://10.10.5.4:2333/api/open/promotion/co-list?channelid={channel}&gameid={gameid}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user