Esempio n. 1
0
 def getUri(request, protocol="HTTP"):
     if protocol == "ALL":
         return executeSqlGetDict(
             "SELECT cu.*,u.userName FROM tb_config_uri cu LEFT JOIN (SELECT * FROM tb_user_uri WHERE addBy= %s ) uu  ON cu.uriKey = uu.uriKey LEFT JOIN tb_user u ON cu.addBy = u.loginName WHERE cu.state = 1 ORDER BY uu.confLevel IS NULL,uu.confLevel ASC ,cu.addTime desc",
             [request.session.get("loginName")])
     else:
         return executeSqlGetDict(
             "SELECT cu.*,u.userName FROM tb_config_uri cu LEFT JOIN (SELECT * FROM tb_user_uri WHERE addBy= %s ) uu  ON cu.uriKey = uu.uriKey LEFT JOIN tb_user u ON cu.addBy = u.loginName WHERE cu.state = 1  AND cu.protocol = %s ORDER BY uu.confLevel IS NULL,uu.confLevel ASC ,cu.addTime desc",
             [request.session.get("loginName"), protocol])
Esempio n. 2
0
def getPythonThirdLib():
    importStr = ""
    if not serviceRedis.existsKey("python_third_libs"):
        res = executeSqlGetDict(
            "select execPythonValue from tb_exec_python_attrs where execPythonAttr = 'importString' "
        )
        if res:
            importStr = res[0]['execPythonValue']
        serviceRedis.set_data("python_third_libs", importStr)
        print("INIT KEY[python_third_libs] to redis!!!")
    return serviceRedis.get_data("python_third_libs")
Esempio n. 3
0
def getKeywordExecPythonTimeout(key="timeoutString"):
    timeout = 10
    currentKey = "python_timeout_%s" % key
    if not serviceRedis.existsKey(currentKey):
        res2 = executeSqlGetDict(
            "select execPythonValue from tb_exec_python_attrs where execPythonAttr = '%s' "
            % key)
        if res2:
            timeoutStr = res2[0]['execPythonValue']
            if isInt(timeoutStr):
                timeout = int(timeoutStr)
            serviceRedis.set_data(currentKey, timeout)
            print("INIT KEY[%s] to redis!!!" % currentKey)
    return int(serviceRedis.get_data(currentKey))
Esempio n. 4
0
 def getAllHttpConf(request):
     return executeSqlGetDict(
         "SELECT  ch.httpConfKey,ch.alias,ch.httpConfDesc  FROM tb_config_http ch LEFT JOIN "
         "(SELECT * FROM tb_user_httpconf WHERE addBy = %s ) uh on ch.httpConfKey = uh.httpConfKey "
         "WHERE ch.state = 1  ORDER BY uh.conflevel is null,uh.conflevel asc , ch.modTime desc ",
         request.session.get("loginName"))
Esempio n. 5
0
 def queryUIRunHttpConfSort(request):
     return executeSqlGetDict(
         "SELECT  ch.httpConfKey,ch.alias  FROM tb_config_http ch LEFT JOIN (SELECT * FROM tb_user_httpconf WHERE addBy = %s ) uh on ch.httpConfKey = uh.httpConfKey WHERE ch.state = 1 AND ch.uiRunState = 1 ORDER BY uh.conflevel is null,uh.conflevel asc , ch.modTime desc ",
         request.session.get("loginName"))
Esempio n. 6
0
 def queryServiceConfSort(request):
     return executeSqlGetDict(
         "SELECT * from tb_config_service s LEFT JOIN (select * from ( SELECT id ucid,httpConfKey uhck,confLevel from tb_user_httpconf where addBy= %s ) b LEFT JOIN (SELECT id hid,serviceConfKey hsk,httpConfKey hck from tb_config_http) a on b.uhck = a.hck) c on s.serviceConfKey = c.hsk where s.state = 1 group by s.serviceConfKey  order by c.confLevel is null,c.confLevel ASC",
         [request.session.get("loginName")])
Esempio n. 7
0
import apps.common.func.InitDjango
from apps.common.func.CommonFunc import dbModelListToListDict, executeSqlGetDict
from all_models.models import TbConfigService


class ServiceConfService(object):
    @staticmethod
    def getServiceConf():
        return dbModelListToListDict(TbConfigService.objects.filter(state=1))

    @staticmethod
    def queryServiceConfSort(request):
        return executeSqlGetDict(
            "SELECT * from tb_config_service s LEFT JOIN (select * from ( SELECT id ucid,httpConfKey uhck,confLevel from tb_user_httpconf where addBy= %s ) b LEFT JOIN (SELECT id hid,serviceConfKey hsk,httpConfKey hck from tb_config_http) a on b.uhck = a.hck) c on s.serviceConfKey = c.hsk where s.state = 1 group by s.serviceConfKey  order by c.confLevel is null,c.confLevel ASC",
            [request.session.get("loginName")])


if __name__ == "__main__":
    # print((businessService.=)))
    # print(UserService.getUserByLoginname(UserService.getUsers()[0].loginname))

    # print(ServiceConfService.queryServiceConfSort())

    print(
        executeSqlGetDict(
            "SELECT * from tb_config_service s LEFT JOIN (select * from ( SELECT id ucid,httpConfKey uhck,confLevel from tb_user_httpconf where addBy= %s ) b LEFT JOIN (SELECT id hid,serviceConfKey hsk,httpConfKey hck from tb_config_http) a on b.uhck = a.hck) c on s.serviceConfKey = c.hsk where s.state = 1 group by s.serviceConfKey  order by c.confLevel is null,c.confLevel ASC",
            ["liyc"]))