@@ -142,6 +142,8 @@ async def lifespan(app: FastAPI): | |||
redis_port=conf().get("redis_port") | |||
redis_password=conf().get("redis_password") | |||
redis_db=conf().get("redis_db") | |||
wx_chat_api=conf().get("wx_chat_api") | |||
await redis_service.init(host=redis_host,port=redis_port, password=redis_password, db=redis_db) | |||
app.state.redis_service = redis_service | |||
@@ -154,7 +156,7 @@ async def lifespan(app: FastAPI): | |||
# 初始化 GeWeChatCom | |||
#app.state.gewe_service = await GeWeService.get_instance(redis_service,"http://api.geweapi.com/gewe") | |||
app.state.gewe_service = await GeWeService.get_instance(redis_service,"http://218.78.116.24:10883/gewe") | |||
app.state.gewe_service = await GeWeService.get_instance(redis_service,wx_chat_api) | |||
gewe_service=app.state.gewe_service | |||
# # 初始化 GeWeChatCom | |||
#app.state.gwechat_service = GeWeService(app) | |||
@@ -184,7 +186,7 @@ async def lifespan(app: FastAPI): | |||
'group_id': KAFKA_GROUP_ID, | |||
} | |||
gewe_config = { | |||
'api_url': "http://api.geweapi.com/gewe", | |||
'api_url': wx_chat_api, | |||
} | |||
# Use Celery task | |||
@@ -18,6 +18,9 @@ redis_password=conf().get("redis_password") | |||
redis_db=conf().get("redis_db") | |||
encoded_password = quote(redis_password) | |||
wx_chat_api=conf().get("wx_chat_api") | |||
# 配置 Celery | |||
celery_app = Celery( | |||
"worker", | |||
@@ -53,7 +56,7 @@ kafka_config = { | |||
} | |||
gewe_config = { | |||
#'api_url': "http://api.geweapi.com/gewe", | |||
'api_url':"http://218.78.116.24:10883/gewe", | |||
'api_url':wx_chat_api, | |||
} | |||
@@ -5,5 +5,6 @@ | |||
"redis_password":"telpo#1234", | |||
"redis_db":3, | |||
"kafka_bootstrap_servers":"192.168.2.121:9092", | |||
"aiops_api":"https://id.ssjlai.com/aiopsadmin" | |||
"aiops_api":"https://id.ssjlai.com/aiopsadmin", | |||
"wx_chat_api":"http://api.geweapi.com/gewe" | |||
} |
@@ -5,5 +5,6 @@ | |||
"redis_password":"telpo#1234", | |||
"redis_db":3, | |||
"kafka_bootstrap_servers":"172.19.42.40:9092,172.19.42.41:9092,172.19.42.48:9092", | |||
"aiops_api":"https://ai.ssjlai.com/aiopsadmin" | |||
"aiops_api":"https://ai.ssjlai.com/aiopsadmin", | |||
"wx_chat_api":"http://api.geweapi.com/gewe" | |||
} |
@@ -5,5 +5,6 @@ | |||
"redis_password":"telpo#1234", | |||
"redis_db":3, | |||
"kafka_bootstrap_servers":"172.19.42.53:9092", | |||
"aiops_api":"https://id.ssjlai.com/aiopsadmin" | |||
"aiops_api":"https://id.ssjlai.com/aiopsadmin", | |||
"wx_chat_api":"http://218.78.116.24:10883/gewe" | |||
} |
@@ -5,5 +5,6 @@ | |||
"redis_password":"telpo#1234", | |||
"redis_db":3, | |||
"kafka_bootstrap_servers":"192.168.2.121:9092", | |||
"aiops_api":"https://id.ssjlai.com/aiopsadmin" | |||
"aiops_api":"https://id.ssjlai.com/aiopsadmin", | |||
"wx_chat_api":"http://218.78.116.24:10883/gewe" | |||
} |
@@ -25,7 +25,8 @@ available_setting = { | |||
# kafka配置 | |||
"kafka_bootstrap_servers":"", | |||
# aiops平台 | |||
"aiops_api":"" | |||
"aiops_api":"", | |||
"wx_chat_api":"" | |||
} | |||
class Config(dict): | |||
@@ -41,21 +41,7 @@ class GeWeService: | |||
cls._instance = cls(app,base_url) | |||
return cls._instance | |||
# _instance = None | |||
# def __new__(cls,app:FastAPI,base_url="http://api.geweapi.com/gewe"): | |||
# if not cls._instance: | |||
# cls._instance = super(GeWeService, cls).__new__(cls) | |||
# cls._instance.client = None | |||
# cls._instance.lock_renewal_thread = None | |||
# return cls._instance | |||
# def __init__(self,app:FastAPI,base_url="http://api.geweapi.com/gewe"): | |||
# if not hasattr(self, 'initialized'): | |||
# #self.kafka_service =kafka_service # 获取 KafkaService 单例 | |||
# # self.kafka_service =app.state.kafka_service | |||
# self.redis_service=app.state.redis_service | |||
# self.base_url = base_url | |||
# self.initialized = True | |||
############################### 登录模块 ############################### | |||
async def check_login_async(self, token_id: str, app_id: str, uuid: str, captch_code: str = ""): | |||