reformat bcode
This commit is contained in:
@@ -10,6 +10,7 @@ from app.models import MembersProductsSettings, MembersProducts, ProductsColorSt
|
|||||||
from threading import Thread
|
from threading import Thread
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
|
||||||
class WebContentsService(BaseService):
|
class WebContentsService(BaseService):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@@ -39,13 +40,11 @@ class WebContentsService(BaseService):
|
|||||||
"contact_title": "Questions? Let's Talk",
|
"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.",
|
"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": ''
|
"internal_template_style": ''
|
||||||
}
|
}
|
||||||
# web_contents_data[""] = ""
|
# web_contents_data[""] = ""
|
||||||
# Do we have this subsction
|
# Do we have this subsction
|
||||||
membersSubResult = MembersProducts.get_member_product_by_subscription_uid(provision_uid)
|
membersSubResult = MembersProducts.get_member_product_by_subscription_uid(provision_uid)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if membersSubResult:
|
if membersSubResult:
|
||||||
member_sub = {
|
member_sub = {
|
||||||
'id': membersSubResult.id,
|
'id': membersSubResult.id,
|
||||||
@@ -64,12 +63,13 @@ class WebContentsService(BaseService):
|
|||||||
"added": membersSubResult.added,
|
"added": membersSubResult.added,
|
||||||
}
|
}
|
||||||
|
|
||||||
WebContentsService.get_site_imges_data(str(provision_uid, membersSubResult.primary_server),
|
WebContentsService.get_site_imges_data(provision_uid, membersSubResult.primary_server,
|
||||||
str(membersSubResult.provision_port))
|
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
|
# 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 != '':
|
if colorStyle and colorStyle.color_style != '':
|
||||||
web_contents_data["internal_template_style"] = colorStyle.color_style
|
web_contents_data["internal_template_style"] = colorStyle.color_style
|
||||||
|
|
||||||
@@ -85,14 +85,12 @@ class WebContentsService(BaseService):
|
|||||||
# The template set up
|
# The template set up
|
||||||
# web_contents_data["web_images"]=[]
|
# web_contents_data["web_images"]=[]
|
||||||
|
|
||||||
|
|
||||||
return web_contents_data
|
return web_contents_data
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"An error occurred while getting dashboard data: {str(e)}", exc_info=True)
|
logger.error(f"An error occurred while getting dashboard data: {str(e)}", exc_info=True)
|
||||||
return jsonify({"message": "Internal Server Error"}), 500
|
return jsonify({"message": "Internal Server Error"}), 500
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_web_trafic_data(data):
|
def get_web_trafic_data(data):
|
||||||
provision_uid = data.get('provision_uid', '')
|
provision_uid = data.get('provision_uid', '')
|
||||||
@@ -124,7 +122,7 @@ class WebContentsService(BaseService):
|
|||||||
"city": city,
|
"city": city,
|
||||||
"latitude": latitude,
|
"latitude": latitude,
|
||||||
"longitude": longitude,
|
"longitude": longitude,
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.error(f"Going for Thread ******************** ")
|
logger.error(f"Going for Thread ******************** ")
|
||||||
thread = Thread(target=MyProductsService.async_send_settings_refresh_to_kafka,
|
thread = Thread(target=MyProductsService.async_send_settings_refresh_to_kafka,
|
||||||
@@ -139,14 +137,14 @@ class WebContentsService(BaseService):
|
|||||||
return jsonify({"message": "Internal Server Error"}), 500
|
return jsonify({"message": "Internal Server Error"}), 500
|
||||||
|
|
||||||
@staticmethod
|
@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)
|
# membersSubResult = MembersProducts.get_member_product_by_subscription_uid(provision_uid)
|
||||||
#
|
#
|
||||||
# if not membersSubResult:
|
# if not membersSubResult:
|
||||||
# return None
|
# 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"
|
api_url = destination_server + "/api"
|
||||||
try:
|
try:
|
||||||
logger.info(f"api_url: {str(api_url)}")
|
logger.info(f"api_url: {str(api_url)}")
|
||||||
@@ -162,7 +160,7 @@ class WebContentsService(BaseService):
|
|||||||
# "city": city,
|
# "city": city,
|
||||||
# "latitude": latitude,
|
# "latitude": latitude,
|
||||||
# "longitude": longitude,
|
# "longitude": longitude,
|
||||||
}
|
}
|
||||||
|
|
||||||
# logger.error(f"Going for Thread ******************** ")
|
# logger.error(f"Going for Thread ******************** ")
|
||||||
# thread = Thread(target=MyProductsService.async_send_settings_refresh_to_kafka,
|
# thread = Thread(target=MyProductsService.async_send_settings_refresh_to_kafka,
|
||||||
|
|||||||
Reference in New Issue
Block a user