"
# Replace recipient@example.com with a "To" address. If your account
# is still in the sandbox, this address must be verified.
#RECIPIENT = iRecipient
# RECIPIENTS = iRecipient.split(',')
# CCS = iSale_mail.split(',')
# RECIPIENTS = iRecipient.split(',')
#寄給業務
#RECIPIENTS = ["miko@hhh.com.tw","lily_huang@hhh.com.tw","dori@hhh.com.tw","wesson@hhh.com.tw"]
RECIPIENTS = ["agent@hhh.com.tw"]
#寄給開發
#CCS=["oak@choozmo.com"]
CCS=[]
# CCS.append("hhh_edit@hhh.com.tw")
print(RECIPIENTS)
print(CCS)
###之後要改成上面設計師email
# RECIPIENTS = ["may@hhh.com.tw","jennifer_kao@hhh.com.tw",]
#RECIPIENTS = ["hhh_edit@hhh.com.tw"]
#CCS = ["hhh_edit@hhh.com.tw"]
BCCS = []
# Specify a configuration set. If you do not want to use a configuration
# set, comment the following variable, and the
# ConfigurationSetName=CONFIGURATION_SET argument below.
#CONFIGURATION_SET = "ConfigSet"
# If necessary, replace us-west-2 with the AWS Region you're using for Amazon SES.
AWS_REGION = "us-east-1"
# The subject line for the email.
SUBJECT = "幸福空間 裝修需求預算通知 (來自"+iName+'-'+iPhone+")"
# The email body for recipients with non-HTML email clients.
# BODY_TEXT = ("\r\n" + iName + " 設計師 , 您好:\r\n我是幸福空間編輯 , 您的個案已經完成並上線!\r\n幸福空間已於"+ iSection +"將您的個案露出於幸福空間網站上"+"\r\n個案名稱 :"+ iCap+"\r\n\r\n"+ iImg+"\r\n\r\n網址: https://hhh.com.tw/cases/detail/d/"+iId+"/\r\n煩請您上網查收點閱,若有需要增刪修改之處,還請不吝提出指教,謝謝!\r\n------------------------------------------------------------\r\n 幸福空間股份有限公司\r\n E-mail : service@choozmo.com \r\n 幸福空間 : https://hhh.com.tw \r\n ")
# BODY_TEXT = ("\r\n" + " 以下為裝修需求")
BODY_TEXT = ""
# :\r\n我是幸福空間編輯 , 您的個案已經完成並上線!\r\n幸福空間已於"+ iSection +"將您的個案露出於幸福空間網站上"+"\r\n個案名稱 :"+ iCap+"\r\n網址: https://hhh.com.tw/cases/detail/d/"+iId+"/\r\n煩請您上網查收點閱,若有需要增刪修改之處,還請不吝提出指教,謝謝!\r\n------------------------------------------------------------\r\n 幸福空間股份有限公司\r\n E-mail : hhh_edit@hhh.com.tw \r\n 幸福空間 : https://hhh.com.tw \r\n ")
# The HTML body of the email.
# BODY_HTML = """
#
#
# """ + iName + " 設計師 , 您好:
我是幸福空間編輯 , 您的個案已經完成並上線!
幸福空間已於"+ iSection + "將您的個案露出於幸福空間網站上
個案名稱 :"+ iCap+"
網址: https://hhh.com.tw/cases/detail/d/"""+iId+"""/
# 煩請您上網查收點閱,若有需要增刪修改之處,還請不吝提出指教,謝謝!
# ------------------------------------------------------------
# 幸福空間股份有限公司
# E-mail : service@choozmo.com
# 幸福空間 : https://hhh.com.tw
#
#
# """
# 读取图片并编码为Base64字符串
with open('/var/www/html/hhh/genjson/request_template/mailhead.jpg', 'rb') as img_file:
img_data = img_file.read()
img_base64 = base64.b64encode(img_data).decode('utf-8')
#print(img_data)
BODY_HTML = """
以下為裝修需求
建立時間 : """ + iDate + "
姓名 : "+ iName +"
手機 : "+ iPhone+"
E-mail: "+ iEmail+"
縣市區域 : " + iCity +"
坪數 : "+ iArea+ "
裝修類型:"+ iCtype+ "
房屋類型:"+ iHouse+ "
需求來源平台:"+ iSource +"
"+"""
------------------------------------------------------------
幸福空間股份有限公司
E-mail : agent@hhh.com.tw
幸福空間 : https://hhh.com.tw
"""
# The character encoding for the email.
CHARSET = "UTF-8"
# 创建邮件对象
msg = MIMEMultipart('alternative')
msg['Subject'] = SUBJECT
msg['From'] = SENDER
msg['To'] = ', '.join(RECIPIENTS)
msg['Cc'] = ', '.join(CCS)
# 添加图片附件
#img_attachment = MIMEImage(img_data)
#img_attachment.add_header('Content-Disposition', 'inline', filename='mailhead.jpg')
#img_attachment.add_header('Content-ID', '')
#msg.attach(img_attachment)
# 创建邮件的HTML部分
html_part = MIMEText(BODY_HTML, 'html','utf-8')
print(html_part)
msg.attach(html_part)
# Create a new SES resource and specify a region.
client = boto3.client('ses'
,aws_access_key_id='AKIAQG3PJZCHXPCSTAJG'
,aws_secret_access_key='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'
,region_name=AWS_REGION)
# Try to send the email.
try:
response = client.send_raw_email(
Source=SENDER,
Destinations=RECIPIENTS + CCS + BCCS,
RawMessage={'Data': msg.as_string()}
)
# #Provide the contents of the email.
# response = client.send_email(
# Destination={
# 'ToAddresses': RECIPIENTS,
# 'CcAddresses': CCS,
# 'BccAddresses': BCCS
# },
# Message={
# 'Body': {
# 'Html': {
# 'Charset': CHARSET,
# 'Data': BODY_HTML,
# },
# 'Text': {
# 'Charset': CHARSET,
# 'Data': BODY_TEXT,
# },
# },
# 'Subject': {
# 'Charset': CHARSET,
# 'Data': SUBJECT,
# },
# },
# Source=SENDER,
# # If you are not using a configuration set, comment or delete the
# # following line
# #ConfigurationSetName=CONFIGURATION_SET,
# )
# # Display an error if something goes wrong.
except ClientError as e:
print(e.response['Error']['Message'])
else:
print("Email sent! Message ID:"),
print(response['MessageId'])
return True
@app.post("/SendMail_to_customer")
# async def SendMail_to_customer(iRecipient:str,iSale_mail:str, iDate:str,iPhone:str, iName:str, iCity:str, iArea:str,iCtype:str,iEmail:str):
async def SendMail_to_customer(request: CalculatorRequest):
# Replace sender@example.com with your "From" address.
# This address must be verified with Amazon SES.
SENDER = "Gorgeous Space - Mailer "
# Replace recipient@example.com with a "To" address. If your account
# is still in the sandbox, this address must be verified.
#RECIPIENT = iRecipient
iName = request.name
iPhone = request.phone
iEmail = request.email
iCity = request.city
iArea = request.area
iCtype = request.ca_type
#獲取當前時間
now = datetime.now()
#格式化時間
iDate = now.strftime("%Y.%m.%d %H:%M")
iHouse="無"
# RECIPIENTS = iRecipient.split(',')
# CCS = iSale_mail.split(',')
#寄給填寫email
RECIPIENTS = []
RECIPIENTS.append(iEmail)
#寄給開發
#CCS=['oak@choozmo.com']
CCS=[]
CCS.append("agent@hhh.com.tw")
print(RECIPIENTS)
print(CCS)
###之後要改成上面設計師email
# RECIPIENTS = ["may@hhh.com.tw","jennifer_kao@hhh.com.tw",]
#RECIPIENTS = ["hhh_edit@hhh.com.tw"]
#CCS = ["hhh_edit@hhh.com.tw"]
BCCS = []
# Specify a configuration set. If you do not want to use a configuration
# set, comment the following variable, and the
# ConfigurationSetName=CONFIGURATION_SET argument below.
#CONFIGURATION_SET = "ConfigSet"
# If necessary, replace us-west-2 with the AWS Region you're using for Amazon SES.
AWS_REGION = "us-east-1"
# The subject line for the email.
SUBJECT = "幸福空間 裝修需求預算通知 (來自"+iName+'-'+iPhone+")"
# The email body for recipients with non-HTML email clients.
# BODY_TEXT = ("\r\n" + iName + " 設計師 , 您好:\r\n我是幸福空間編輯 , 您的個案已經完成並上線!\r\n幸福空間已於"+ iSection +"將您的個案露出於幸福空間網站上"+"\r\n個案名稱 :"+ iCap+"\r\n\r\n"+ iImg+"\r\n\r\n網址: https://hhh.com.tw/cases/detail/d/"+iId+"/\r\n煩請您上網查收點閱,若有需要增刪修改之處,還請不吝提出指教,謝謝!\r\n------------------------------------------------------------\r\n 幸福空間股份有限公司\r\n E-mail : service@choozmo.com \r\n 幸福空間 : https://hhh.com.tw \r\n ")
# BODY_TEXT = ("\r\n" + " 以下為裝修需求")
BODY_TEXT = ""
# :\r\n我是幸福空間編輯 , 您的個案已經完成並上線!\r\n幸福空間已於"+ iSection +"將您的個案露出於幸福空間網站上"+"\r\n個案名稱 :"+ iCap+"\r\n網址: https://hhh.com.tw/cases/detail/d/"+iId+"/\r\n煩請您上網查收點閱,若有需要增刪修改之處,還請不吝提出指教,謝謝!\r\n------------------------------------------------------------\r\n 幸福空間股份有限公司\r\n E-mail : hhh_edit@hhh.com.tw \r\n 幸福空間 : https://hhh.com.tw \r\n ")
# The HTML body of the email.
# BODY_HTML = """
#
#
# """ + iName + " 設計師 , 您好:
我是幸福空間編輯 , 您的個案已經完成並上線!
幸福空間已於"+ iSection + "將您的個案露出於幸福空間網站上
個案名稱 :"+ iCap+"
網址: https://hhh.com.tw/cases/detail/d/"""+iId+"""/
# 煩請您上網查收點閱,若有需要增刪修改之處,還請不吝提出指教,謝謝!
# ------------------------------------------------------------
# 幸福空間股份有限公司
# E-mail : service@choozmo.com
# 幸福空間 : https://hhh.com.tw
#
#
# """
BODY_HTML = """
親愛的"""+iName+""",
非常感謝您在幸福空間官網留下您的裝修需求。
以下是您填寫的資訊:
"""+ "
建立時間: "+ iDate + "
姓名 : "+ iName +"
手機 : "+ iPhone+"
E-mail: "+ iEmail+"
縣市區域 : " + iCity +"
坪數 : "+ iArea+ "
裝修類型:"+ iCtype+ "
"+"""
幸福經紀人將後續與您聯繫,以便確認您的需求,
並向您推薦最適合的裝修方案。
歡迎您至幸福空間官網參考更多設計風格案例作品
"""
# The character encoding for the email.
CHARSET = "UTF-8"
# Create a new SES resource and specify a region.
client = boto3.client('ses'
,aws_access_key_id='AKIAQG3PJZCHXPCSTAJG'
,aws_secret_access_key='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'
,region_name=AWS_REGION)
# Try to send the email.
try:
#Provide the contents of the email.
response = client.send_email(
Destination={
'ToAddresses': RECIPIENTS,
'CcAddresses': CCS,
'BccAddresses': BCCS
},
Message={
'Body': {
'Html': {
'Charset': CHARSET,
'Data': BODY_HTML,
},
'Text': {
'Charset': CHARSET,
'Data': BODY_TEXT,
},
},
'Subject': {
'Charset': CHARSET,
'Data': SUBJECT,
},
},
Source=SENDER,
# If you are not using a configuration set, comment or delete the
# following line
#ConfigurationSetName=CONFIGURATION_SET,
)
# Display an error if something goes wrong.
except ClientError as e:
print(e.response['Error']['Message'])
else:
print("Email sent! Message ID:"),
print(response['MessageId'])
return True
# for item in GetList():
# #print(item)
# SendMail(item[0],item[1],item[2],item[3],item[4],item[5],item[6])
# with dataset.connect(connstr) as db:
# jData = json.load(open(hhhMBPath+'/json/designers.json', encoding='utf8'))
# cases = db.query("""SELECT tag,cover,caption,hcase_id,viewed,sdate,style,style2,type,`condition` FROM _hcase c WHERE c.hdesigner_id = '""" + id + """' AND c.onoff='1' ORDER BY sdate DESC LIMIT 6 """ )
# cases_list = []
# for case in cases:
# tag_use = ''
# if case['style']!='':
# tag_use += case['style'].strip()
# tag_use += ','
# if case['style2']!='':
# tag_use += case['style2'].strip()
# tag_use += ','
# if case['type']!='':
# tag_use += case['type'].strip()
# tag_use += ','
# if case['condition']!='':
# tag_use += case['condition'].strip()
# tmpobj = {
# "url": "https://hhh.com.tw/cases/detail/d/"+str(case["hcase_id"]),
# "imgURL": case["cover"].replace('/_hcase/', '/_hcase_orig/').replace('/_hcase_img/', '/_hcase_img_orig/'),
# "title": case["caption"],
# "tag": [{"name": tag, "link": "https://hhh.com.tw/search/lists/case/{}-keyword/".format(tag)} for tag in tag_use.split(',')],
# # "tag": [{"name": tag, "link": "https://hhh.com.tw/search/lists/case/{}-keyword/".format(tag)} for tag in case["tag"].split(',')],
# "views": case["viewed"],
# "dateSort": str(case["sdate"])
# }
# cases_list.append(tmpobj)
# records = db.query("""SELECT * FROM _hdesigner d WHERE d.hdesigner_id = '""" + id + """' AND d.onoff='1' """)
# jData = []
# for c in records:
# if c["service_phone"]!='':
# part1=c["service_phone"][0:4]
# part2=c["service_phone"][4:7]
# part3=c["service_phone"][7:10]
# part4=c["service_phone"].split(',')[1]
# service_phone = part1+'-'+part2+'-'+part3+'#'+part4
# else:
# service_phone=''
# jData.append({"hdesigner_id":str(c["hdesigner_id"]),
# "DesignerName":str(c["name"]),
# "CompanyName": str(c["title"]),
# 'Designerbigimg':"./img/"+id,
# "DesignerIdea":str(c["idea"]),
# "Website":str(c["website"]),
# "Service_phone":service_phone,
# "FB_url":str(c["fbpageurl"]),
# "Carddata": cases_list
# })
# json.dumps(jData)
# return jData
# check_len=[]
# for c in records:
# check_len.append(c)
# if len(check_len)==0:
# return []
# # print(jData)
# for x in jData:
# tmpCaseDetail = []
# icount = 0
# for c in records:
# icount += 1
# # tmpCaseDetail.append({"CaseDetailImg":c["cimg"]})
# if page == "1":
# x["id"] = c["hdesigner_id"]
# x["BannerImg"] = c["background"]
# x["BannerImg_mobile"] = c['background_mobile']
# x["CompanyName"] = c["title"]
# x["DesignerName"] = c["name"]
# x["Designerimg"] = c["img_path"]
# x["Description"] = c["seo"]
# x["Approve"] = c["position"]
# x["FB_link"] = c["fbpageurl"]
# # x["order_computer"] = c["order_computer"]
# # x["order_mb"] = c["order_mb"]
# if c["service_phone"]!='':
# part1=c["service_phone"][0:4]
# part2=c["service_phone"][4:7]
# part3=c["service_phone"][7:10]
# part4=c["service_phone"].split(',')[1]
# service_phone = part1+'-'+part2+'-'+part3+'#'+part4
# else:
# service_phone=''
# phone_list=[]
# for k1 in c["phone"].split(','):
# phone_list.append({"title": "諮詢專線:", "link":'tel:'+k1, "data":k1})
# x["Basics"] = []
# if service_phone!='':
# x["Basics"].append({"title": "免費專線:","link": 'tel:'+c["service_phone"], "data": service_phone})
# for k2 in phone_list:
# x["Basics"].append(k2)
# if len(c["fax"])!=0:
# x["Basics"].append({"title": "公司傳真:", "link": "fax:"+c["fax"], "data": c["fax"]})
# if len(c["address"])!=0:
# x["Basics"].append({"title": "公司地址:", "link": "https://www.google.com/search?q="+c["address"], "data": c["address"]})
# if len(c["mail"])!=0:
# x["Basics"].append({"title": "電子信箱:", "link": "mailto:"+c["mail"], "data": c["mail"]})
# if len(c["website"])!=0:
# x["Basics"].append({"title": "公司網址:", "link": c["website"], "data": c["website"]})
# blog_list=re.findall(r'href="(.*?)"',c["blog"])
# if len(blog_list)==0:
# blog_list=re.findall(r'http.*',c["blog"])
# if len(blog_list)!=0:
# for k3 in blog_list:
# x["Basics"].append({"title": "其他連結:", "link": k3, "data": k3})
# # x["Basics"] = [
# # {"title": "免費專線:","link": 'tel:'+c["service_phone"], "data": service_phone},
# # # {"title": "諮詢專線:", "link": c["phone"], "data": c["phone"]},
# # {"title": "諮詢專線:", "link": c["phone"], "data": c["phone"]},
# # {"title": "公司傳真:", "link": c["fax"], "data": c["fax"]},
# # {"title": "公司地址:", "link": c["address"], "data": c["address"]},
# # {"title": "電子信箱:", "link": c["mail"], "data": c["mail"]},
# # {"title": "公司網址:", "link": c["website"], "data": c["website"]}
# # ]
# x["FreeCall"] = c["service_phone"]
# x["ConsoleCall_1"] = c["phone"]
# x["ConsoleCall_2"] = c["phone"]
# x["Fax"] = c["fax"]
# x["Address"] = c["address"]
# x["Email"] = c["mail"]
# x["Web"] = c["website"]
# x["Branches"] = []
# branches = db.query("""SELECT * FROM designer_branch br
# WHERE br.designer_id = '""" + id + """' """)
# for branch in branches:
# tmpobj = {
# "title": branch["title"],
# "address": branch["address"],
# "address_link" : "https://www.google.com/search?q="+branch["address"],
# "tel": branch["tel"],
# "tel_link": "tel:"+branch["tel"],
# "fax": branch["fax"],
# "fax_link": "fax:"+branch["fax"]
# }
# x["Branches"].append(tmpobj)
# x["Budget"] = c["budget"]
# x["Square"] = c["area"]
# x["SpecialCase"] = c["special"]
# x["Charge"] = c["charge"]
# x["Pay"] = c["payment"]
# x["WorkLoc"] = c["region"]
# x["WorkType"] = c["type"]
# x["WorkStyle"] = c["style"]
# x["WorkBudget"] = c["budget"]
# x["Terms"] = []
# if c["budget"]!='':
# x["Terms"].append({"title": "接案預算:", "data": c["budget"]})
# if c["area"]!='':
# x["Terms"].append({"title": "接案坪數:", "data": c["area"]})
# if c["special"]!='':
# x["Terms"].append({"title": "特殊接案:", "data": c["special"]})
# if c["charge"]!='':
# x["Terms"].append({"title": "收費方式:", "data": c["charge"]})
# if c["payment"]!='':
# x["Terms"].append({"title": "付費方式:", "data": c["payment"]})
# if c["region"]!='':
# x["Terms"].append({"title": "接案區域:", "data": c["region"]})
# if c["type"]!='':
# x["Terms"].append({"title": "接案類型:", "data": c["type"]})
# if c["style"]!='':
# x["Terms"].append({"title": "接案風格:", "data": c["style"]})
# x["scMedia"] = [
# {"name": "Facebook", "img": "https://hhh.com.tw/assets/images/rv_web/fb.svg",
# "link": c["fbpageurl"]},
# {"name": "Line", "img": "https://hhh.com.tw/assets/images/rv_web/line.svg",
# "link": c["line_link"]},
# {"name": "Wechat", "img": "https://hhh.com.tw/assets/images/rv_web/wechat.svg",
# "link": c["fbpageurl"]},
# {"name": "email", "img": "https://hhh.com.tw/assets/images/rv_web/share.svg",
# "link": c["mail"]},
# {"name": "Like", "img": "https://hhh.com.tw/assets/images/rv_web/like-o.svg", "link": ""}
# ]
# x_info = []
# if len(c["idea"])!=0:
# x_info.append({"title": "設計理念", "data": c["idea"]})
# if len(c["taxid"])!=0:
# x_info.append( {"title": "公司統編", "data": c["taxid"]})
# if len(c["career"])!=0:
# x_info.append({"title": "相關經歷", "data": c["career"]})
# if len(c["license"])!=0:
# x_info.append( {"title": "專業證照", "data": c["license"].replace('\r\n','
')})
# if len(c["awards"])!=0:
# x_info.append( {"title": "獲獎紀錄", "data": c["awards"].replace('\r\n','
')})
# x["Content"] = [
# {
# "Title": "設計師作品",
# "mb_title": "作品",
# "Tabtag": "intro",
# "Display_mb": "true",
# "isActive": "true",
# "Carddata": [],
# "total_all":0
# },
# {
# "Title": "設計師影音",
# "mb_title": "影音",
# "Tabtag": "video",
# "Display_mb": "true",
# "isActive": "true",
# "Carddata": [],
# "total_all":0
# },
# {
# "Title": "設計師專欄",
# "mb_title": "專欄",
# "Tabtag": "columns",
# "Display_mb": "true",
# "isActive": "true",
# "Carddata": [],
# "total_all":0
# },
# {
# "Title": "VR360",
# "mb_title": "VR",
# "Tabtag": "vr360",
# "Display_mb": "false",
# "isActive": "true",
# "Carddata": [],
# "total_all":0
# },
# {
# "Title": "設計師公司簡介",
# "mb_title": "公司簡介",
# "Tabtag": "company",
# "Display_mb": "true",
# "isActive": "true",
# "Carddata": [],
# "info":x_info
# # "info": [
# # {"title": "設計理念", "data": c["idea"]},
# # {"title": "公司統編", "data": c["taxid"]},
# # {"title": "相關經歷", "data": c["career"]},
# # {"title": "專業證照", "data": c["license"]},
# # {"title": "獲獎紀錄", "data": c["awards"]}
# # ]
# }
# ]
# records = db.query("""SELECT count(1) FROM _hcase c WHERE c.hdesigner_id = '""" + id + """' AND c.onoff='1'; """ )
# for c in records:
# x["Content"][0]["total_all"] = str(c["count(1)"])
# records = db.query("""SELECT count(1) FROM _hvideo v WHERE v.hdesigner_id = '""" + id + """' AND display_datetime < NOW() and iframe<>'' ;""")
# for c in records:
# x["Content"][1]["total_all"] = str(c["count(1)"])
# records = db.query("""SELECT count(1) FROM _hcolumn c WHERE onoff=1 AND (c.hdesigner_ids LIKE '""" + id + """,%' OR c.hdesigner_ids LIKE '%,""" + id + """,%' OR c.hdesigner_ids LIKE '%,""" + id + """' OR c.hdesigner_ids = '""" + id + """') ;""")
# for c in records:
# x["Content"][2]["total_all"] = str(c["count(1)"])
# records = db.query("""SELECT count(1) FROM _hcase c WHERE c.hdesigner_id = '""" + id + """' and istaging != '' AND c.onoff='1' ;""")
# for c in records:
# x["Content"][3]["total_all"] = str(c["count(1)"])
# # 設計師作品
# x["Content"][0]["Carddata"] = []
# cases = db.query("""SELECT tag,cover,caption,hcase_id,viewed,sdate,style,style2,type,`condition` FROM _hcase c
# WHERE c.hdesigner_id = '""" + id + """' AND c.onoff='1'
# ORDER BY """ + ("sdate" if sort == 'new' else 'corder ASC,viewed') + """ DESC
# LIMIT """ + str((int(page) - 1)*12) + """,12
# """)
# for case in cases:
# tag_use = ''
# if case['style']!='':
# tag_use += case['style'].strip()
# tag_use += ','
# if case['style2']!='':
# tag_use += case['style2'].strip()
# tag_use += ','
# if case['type']!='':
# tag_use += case['type'].strip()
# tag_use += ','
# if case['condition']!='':
# tag_use += case['condition'].strip()
# tmpobj = {
# "url": "https://hhh.com.tw/cases/detail/d/"+str(case["hcase_id"]),
# "imgURL": case["cover"].replace('/_hcase/', '/_hcase_orig/').replace('/_hcase_img/', '/_hcase_img_orig/'),
# "title": case["caption"],
# "tag": [{"name": tag, "link": "https://hhh.com.tw/search/lists/case/{}-keyword/".format(tag)} for tag in tag_use.split(',')],
# # "tag": [{"name": tag, "link": "https://hhh.com.tw/search/lists/case/{}-keyword/".format(tag)} for tag in case["tag"].split(',')],
# "views": case["viewed"],
# "dateSort": str(case["sdate"])
# }
# x["Content"][0]["Carddata"].append(tmpobj)
# # 設計師影音
# # https://i.ytimg.com/vi/y6VmaLC7O9Y/hqdefault.jpg
# x["Content"][1]["Carddata"] = []
# videos = db.query("""SELECT tag_vpattern,iframe,title,hvideo_id,viewed,display_datetime FROM _hvideo v
# WHERE v.hdesigner_id = '""" + id + """' AND display_datetime < NOW() and iframe<>''
# ORDER BY """ + ("hvideo_id" if sort == 'new' else 'viewed') + """ DESC
# LIMIT """ + str((int(page) - 1)*12) + """,12
# """)
# for video in videos:
# print(str(video['iframe']))
# tmpobj = {
# "url": "https://hhh.com.tw/video-post.php?id="+str(video['hvideo_id']),
# "imgURL": "https://i.ytimg.com/vi/" + extract.video_id(html.unescape(str(video['iframe'])))+"/hqdefault.jpg",
# "title": video["title"],
# "tag": [{"name": tag, "link": "https://hhh.com.tw/search/lists/video/{}-keyword/".format(tag)} for tag in video["tag_vpattern"].split(',')],
# "views": video["viewed"],
# "dateSort": str(video["display_datetime"])
# }
# x["Content"][1]["Carddata"].append(tmpobj)
# # 設計師專欄
# x["Content"][2]["Carddata"] = []
# columns = db.query("""SELECT Ctag,clogo,ctitle,hcolumn_id,viewed,sdate FROM _hcolumn c
# WHERE onoff=1 AND (hdesigner_ids LIKE '""" + id + """,%' OR hdesigner_ids LIKE '%,""" + id + """,%' OR hdesigner_ids LIKE '%,""" + id + """' OR hdesigner_ids = '""" + id + """')
# ORDER BY """ + ("sdate" if sort == 'new' else 'viewed') + """ DESC
# LIMIT """ + str((int(page) - 1)*12) + """,12
# """)
# for column in columns:
# tmpobj = {
# "url": "https://hhh.com.tw/columns/detail/"+str(column['hcolumn_id']),
# "imgURL": column['clogo'],
# "title": column["ctitle"],
# "tag": [] if not column["Ctag"] else [{"name": tag, "link": "https://hhh.com.tw/search/lists/column/{}-keyword/".format(tag)} for tag in column["Ctag"].split(',')],
# "views": column["viewed"],
# "dateSort": str(column["sdate"])
# }
# x["Content"][2]["Carddata"].append(tmpobj)
# # VR360
# x["Content"][3]["Carddata"] = []
# cases = db.query("""SELECT tag,cover,caption,hcase_id,viewed,sdate FROM _hcase c
# WHERE c.hdesigner_id = '""" + id + """' and istaging != '' AND c.onoff='1'
# ORDER BY """ + ("sdate" if sort == 'new' else 'viewed') + """ DESC
# LIMIT """ + str((int(page) - 1)*12) + """,12
# """)
# for case in cases:
# tmpobj = {
# "url": "https://hhh.com.tw/cases/detail/d/"+str(case["hcase_id"]),
# "imgURL": case["cover"],
# "title": case["caption"],
# "tag": [{"name": tag, "link": "https://hhh.com.tw/search/lists/column/{}-keyword/".format(tag)} for tag in case["tag"].split(',')],
# "views": case["viewed"],
# "dateSort": str(case["sdate"])
# }
# x["Content"][3]["Carddata"].append(tmpobj)
# # 設計公司簡介
# #x["Content"][4]["Carddata"] = []
# #cases = db.query("")
# """ for case in cases:
# tmpobj = {
# "imgURL":case["cover"],
# "title":case["caption"],
# "tag":[{"name": tag, "link": ""} for tag in case["tag"].split(',')],
# "views":case["viewed"],
# "dateSort":str(case["sdate"])
# }
# x["Content"][4]["Carddata"].append(tmpobj) """
# # print(x)
# # print(jData)
# """ if not os.path.exists(hhhMBPath):
# os.mkdir(hhhMBPath)
# with open(hhhMBPath+'/json/designers-' + id + '.json', 'w', encoding='utf-8') as f:
# json.dump(jData, f, ensure_ascii=False, indent=4) """