|
@@ -11,7 +11,7 @@ import random
|
|
|
from sqlalchemy import create_engine, select
|
|
|
from typing import Optional
|
|
|
from utils.StripTagsHTMLParser import *
|
|
|
-from common.db import db_event_management, db_user, db_area, db_emergency_plan
|
|
|
+from common.db import db_event_management, db_user, db_area, db_emergency_plan, db_msg_center
|
|
|
from common.security import valid_access_token
|
|
|
import traceback
|
|
|
from utils import *
|
|
@@ -936,21 +936,8 @@ async def send_emergency_plan_task_by_yzy(
|
|
|
db.refresh(event_emergency_notify)
|
|
|
|
|
|
description = "预案名称: " + plan_name + "\n响应级别:" + response_level + "\n消息内容: "+yzy_content
|
|
|
-
|
|
|
- '''
|
|
|
- yzy_callback_url = quote("http://19.155.220.206/yjxp/#/yzy-callback")
|
|
|
- state_json = {
|
|
|
- "redirect_url": "http://19.155.220.206/yjxp/#/leader/index" # 业务页面
|
|
|
- }
|
|
|
- state_str = json.dumps(state_json)
|
|
|
- state = base64.b64encode(state_str).decode('utf-8')
|
|
|
- detail_url = "https://open.weixin.qq.com/connect/Oauth2/authorize?appid=wld341060039&redirect_uri={}&response_type=code&scope=snsapi_base&agentid=1004302&state={}#wechat_redirect".format(yzy_callback_url, state)
|
|
|
- '''
|
|
|
-
|
|
|
- # redirect_url = "http://19.155.220.206:8086/yjxp/#/leader/index" # 业务页面
|
|
|
redirect_url = "{}/".format(settings.YJXP_WEB_ROOT_PATH) # 主页
|
|
|
- # detail_url = YzyApi.format_redirect_url(redirect_url, "eb4kehgy6wj4qn0jhx1dk6")
|
|
|
- detail_url = redirect_url
|
|
|
+ detail_url = YzyApi.format_redirect_url(redirect_url)
|
|
|
|
|
|
send_queue.append({
|
|
|
"id": event_emergency_notify.id,
|
|
@@ -958,6 +945,8 @@ async def send_emergency_plan_task_by_yzy(
|
|
|
"description": description,
|
|
|
"detail_url": detail_url
|
|
|
})
|
|
|
+
|
|
|
+ db_msg_center.add_msg(db, "预案通知", event_emergency_notify.id, user_id)
|
|
|
|
|
|
background_tasks.add_task(async_send_yzy_msg, db, send_queue)
|
|
|
|