reformat bcode
This commit is contained in:
@@ -10,6 +10,7 @@ from app.models import MembersProductsSettings, MembersProducts, ProductsColorSt
|
||||
from threading import Thread
|
||||
import requests
|
||||
|
||||
|
||||
class WebContentsService(BaseService):
|
||||
|
||||
@staticmethod
|
||||
@@ -39,13 +40,11 @@ class WebContentsService(BaseService):
|
||||
"contact_title": "Questions? Let's Talk",
|
||||
"contact_introduction": "Want to learn more about us, or speak with an expert? Let us know what you are looking for, and we’ll get back to you right away.",
|
||||
"internal_template_style": ''
|
||||
}
|
||||
}
|
||||
# web_contents_data[""] = ""
|
||||
# Do we have this subsction
|
||||
membersSubResult = MembersProducts.get_member_product_by_subscription_uid(provision_uid)
|
||||
|
||||
|
||||
|
||||
if membersSubResult:
|
||||
member_sub = {
|
||||
'id': membersSubResult.id,
|
||||
@@ -64,12 +63,13 @@ class WebContentsService(BaseService):
|
||||
"added": membersSubResult.added,
|
||||
}
|
||||
|
||||
WebContentsService.get_site_imges_data(str(provision_uid, membersSubResult.primary_server),
|
||||
str(membersSubResult.provision_port))
|
||||
WebContentsService.get_site_imges_data(provision_uid, membersSubResult.primary_server,
|
||||
membersSubResult.provision_port)
|
||||
|
||||
if membersSubResult.colorstyle is not None and membersSubResult.colorstyle !='':
|
||||
if membersSubResult.colorstyle is not None and membersSubResult.colorstyle != '':
|
||||
# is this a valid olor scheme
|
||||
colorStyle = ProductsColorStyle.get_colorstyle_by_product_id_and_uid(membersSubResult.product_id, membersSubResult.colorstyle)
|
||||
colorStyle = ProductsColorStyle.get_colorstyle_by_product_id_and_uid(membersSubResult.product_id,
|
||||
membersSubResult.colorstyle)
|
||||
if colorStyle and colorStyle.color_style != '':
|
||||
web_contents_data["internal_template_style"] = colorStyle.color_style
|
||||
|
||||
@@ -85,14 +85,12 @@ class WebContentsService(BaseService):
|
||||
# The template set up
|
||||
# web_contents_data["web_images"]=[]
|
||||
|
||||
|
||||
return web_contents_data
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"An error occurred while getting dashboard data: {str(e)}", exc_info=True)
|
||||
return jsonify({"message": "Internal Server Error"}), 500
|
||||
|
||||
|
||||
@staticmethod
|
||||
def get_web_trafic_data(data):
|
||||
provision_uid = data.get('provision_uid', '')
|
||||
@@ -124,7 +122,7 @@ class WebContentsService(BaseService):
|
||||
"city": city,
|
||||
"latitude": latitude,
|
||||
"longitude": longitude,
|
||||
}
|
||||
}
|
||||
|
||||
logger.error(f"Going for Thread ******************** ")
|
||||
thread = Thread(target=MyProductsService.async_send_settings_refresh_to_kafka,
|
||||
@@ -139,14 +137,14 @@ class WebContentsService(BaseService):
|
||||
return jsonify({"message": "Internal Server Error"}), 500
|
||||
|
||||
@staticmethod
|
||||
def get_site_imges_data(provision_uid, primary_serve,primary_server):
|
||||
def get_site_imges_data(provision_uid, primary_serve, primary_server):
|
||||
|
||||
# membersSubResult = MembersProducts.get_member_product_by_subscription_uid(provision_uid)
|
||||
#
|
||||
# if not membersSubResult:
|
||||
# return None
|
||||
|
||||
destination_server = "http://"+ str(primary_server)+":"+str(primary_server)
|
||||
destination_server = "http://" + str(primary_server) + ":" + str(primary_server)
|
||||
api_url = destination_server + "/api"
|
||||
try:
|
||||
logger.info(f"api_url: {str(api_url)}")
|
||||
@@ -162,7 +160,7 @@ class WebContentsService(BaseService):
|
||||
# "city": city,
|
||||
# "latitude": latitude,
|
||||
# "longitude": longitude,
|
||||
}
|
||||
}
|
||||
|
||||
# logger.error(f"Going for Thread ******************** ")
|
||||
# thread = Thread(target=MyProductsService.async_send_settings_refresh_to_kafka,
|
||||
|
||||
Reference in New Issue
Block a user