MYS: prep pro Yuzu template WIP

This commit is contained in:
Pakin 2024-06-20 08:46:26 +07:00
parent 985cfb267f
commit 1d3c15fa5b
27 changed files with 62721 additions and 1541 deletions

File diff suppressed because it is too large Load diff

View file

@ -12,264 +12,346 @@ file_inc_content = file_inc.read()
file_xml.close()
if "template1" in param:
file_inc2 = open(directory_to_process + "/event/promotion_template1.inc", 'r')
file_inc2_content = file_inc2.read()
file_inc_img = open(directory_to_process + "/../image/event/image_template1", 'r')
file_inc2_img_content = file_inc_img.read()
file_inc2 = open(directory_to_process + "/event/promotion_template1.inc", 'r')
file_inc2_content = file_inc2.read()
file_inc_img = open(directory_to_process + "/../image/event/image_template1", 'r')
file_inc2_img_content = file_inc_img.read()
# replace key.
# replace key.
sp_key = file_inc2_img_content.split("\n")
print("sp_key = " + str(len( sp_key)))
for sp_line in sp_key:
sp_line = sp_line.strip()
key_val = sp_line.split("=")
if len( key_val) == 2:
print("k = " + key_val[0] + " val=" + key_val[1])
file_inc2_content = file_inc2_content.replace( "###" + key_val[0], '"' + key_val[1].strip() + '"')
sp_key = file_inc2_img_content.split("\n")
print("sp_key = " + str(len( sp_key)))
for sp_line in sp_key:
sp_line = sp_line.strip()
key_val = sp_line.split("=")
if len( key_val) == 2:
print("k = " + key_val[0] + " val=" + key_val[1])
file_inc2_content = file_inc2_content.replace( "###" + key_val[0], '"' + key_val[1].strip() + '"')
file_inc_event_click = open(directory_to_process + "/event/promotion_onclick1.inc", 'r')
file_inc_event_click_content = file_inc_event_click.read()
file_inc_event_click = open(directory_to_process + "/event/promotion_onclick1.inc", 'r')
file_inc_event_click_content = file_inc_event_click.read()
file_inc2_content = file_inc2_content.replace("###EventOnClick", file_inc_event_click_content)
file_inc2_content = file_inc2_content.replace("###EventOnClick", file_inc_event_click_content)
print(file_inc2_content)
print(file_inc2_content)
#print( file_inc_content)
content_data_was_repack = file_content_main.replace(";dummy_layout.inc", file_inc_content)
content_data = content_data_was_repack.replace(";BigLogoLayout", file_inc2_content)
#print( file_inc_content)
content_data_was_repack = file_content_main.replace(";dummy_layout.inc", file_inc_content)
content_data = content_data_was_repack.replace(";BigLogoLayout", file_inc2_content)
begin_text = content_data.index(";TAGESP")
end_text = content_data.index(";TAGESP", begin_text + 7)
print("TAGESP sub text = " + str(begin_text) + " end = " + str(end_text))
tmp1 = content_data[: begin_text - 7]
begin_text = content_data.index(";TAGESP")
end_text = content_data.index(";TAGESP", begin_text + 7)
print("TAGESP sub text = " + str(begin_text) + " end = " + str(end_text))
tmp1 = content_data[: begin_text - 7]
tmp2 = content_data[ end_text:-1]
#print("tmp1=" + tmp1)
#print("tmp2=" + tmp2)
tmp2 = content_data[ end_text:-1]
#print("tmp1=" + tmp1)
#print("tmp2=" + tmp2)
content_data = tmp1 + tmp2
content_data = tmp1 + tmp2
file_xml3_out = open(directory_to_process + "/event/out_put_file1.txt", 'r')
file_xml3_out_content = file_xml3_out.read()
file_xml3_out_content = file_xml3_out_content.strip()
file_xml3_out_content = file_xml3_out_content.replace("\r", "")
file_xml3_out_content = file_xml3_out_content.replace("\n", "")
file_xml3_out = open(directory_to_process + "/event/out_put_file1.txt", 'r')
file_xml3_out_content = file_xml3_out.read()
file_xml3_out_content = file_xml3_out_content.strip()
file_xml3_out_content = file_xml3_out_content.replace("\r", "")
file_xml3_out_content = file_xml3_out_content.replace("\n", "")
file_xml3 = open(directory_to_process + file_xml3_out_content, 'w')
file_xml3.write( content_data)
file_xml3.close()
file_xml3 = open(directory_to_process + file_xml3_out_content, 'w')
file_xml3.write( content_data)
file_xml3.close()
if "template2" in param:
file_inc2 = open(directory_to_process + "/event/promotion_template2.inc", 'r')
file_inc2_content = file_inc2.read()
file_inc_img = open(directory_to_process + "/../image/event/image_template2", 'r')
file_inc2_img_content = file_inc_img.read()
# replace key.
sp_key = file_inc2_img_content.split("\n")
print("sp_key = " + str(len( sp_key)))
for sp_line in sp_key:
sp_line = sp_line.strip()
key_val = sp_line.split("=")
if len( key_val) == 2:
print("k = " + key_val[0] + " val=" + key_val[1])
file_inc2_content = file_inc2_content.replace( "###" + key_val[0], '"' + key_val[1].strip() + '"')
file_inc2 = open(directory_to_process + "/event/promotion_template2.inc", 'r')
file_inc2_content = file_inc2.read()
file_inc_img = open(directory_to_process + "/../image/event/image_template2", 'r')
file_inc2_img_content = file_inc_img.read()
file_inc_event_click = open(directory_to_process + "/event/promotion_onclick2.inc", 'r')
file_inc_event_click_content = file_inc_event_click.read()
# replace key.
sp_key = file_inc2_img_content.split("\n")
print("sp_key = " + str(len( sp_key)))
for sp_line in sp_key:
sp_line = sp_line.strip()
key_val = sp_line.split("=")
if len( key_val) == 2:
print("k = " + key_val[0] + " val=" + key_val[1])
file_inc2_content = file_inc2_content.replace( "###" + key_val[0], '"' + key_val[1].strip() + '"')
file_inc2_content = file_inc2_content.replace("###EventOnClick", file_inc_event_click_content)
file_inc_event_click = open(directory_to_process + "/event/promotion_onclick2.inc", 'r')
file_inc_event_click_content = file_inc_event_click.read()
print(file_inc2_content)
file_inc2_content = file_inc2_content.replace("###EventOnClick", file_inc_event_click_content)
#print( file_inc_content)
content_data_was_repack = file_content_main.replace(";dummy_layout.inc", file_inc_content)
content_data = content_data_was_repack.replace(";BigLogoLayout", file_inc2_content)
begin_text = content_data.index(";TAGESP")
end_text = content_data.index(";TAGESP", begin_text + 7)
#print("sub text = " + str(begin_text) + " end = " + str(end_text))
tmp1 = content_data[: begin_text - 7]
tmp2 = content_data[ end_text:-1]
#print("tmp1=" + tmp1)
#print("tmp2=" + tmp2)
content_data = tmp1 + tmp2
file_xml3_out = open(directory_to_process + "/event/out_put_file2.txt", 'r')
file_xml3_out_content = file_xml3_out.read()
file_xml3_out_content = file_xml3_out_content.strip()
file_xml3_out_content = file_xml3_out_content.replace("\r", "")
file_xml3_out_content = file_xml3_out_content.replace("\n", "")
file_xml3 = open(directory_to_process + file_xml3_out_content, 'w')
file_xml3.write( content_data)
file_xml3.close()
if "template3" in param:
file_inc3 = open(directory_to_process + "/event/promotion_template3.inc", 'r')
file_inc3_content = file_inc3.read()
file_inc_img = open(directory_to_process + "/../image/event/image_template3", 'r')
file_inc3_img_content = file_inc_img.read()
# replace key.
sp_key = file_inc3_img_content.split("\n")
print("sp_key = " + str(len( sp_key)))
for sp_line in sp_key:
sp_line = sp_line.strip()
key_val = sp_line.split("=")
print("Kenta420:", key_val)
if len( key_val) == 2:
print("k = " + key_val[0] + " val=" + key_val[1])
file_inc3_content = file_inc3_content.replace( "###" + key_val[0], '"' + key_val[1].strip() + '"')
print(file_inc2_content)
file_inc_event_click = open(directory_to_process + "/event/promotion_onclick3.inc", 'r')
file_inc_event_click_content = file_inc_event_click.read()
#print( file_inc_content)
content_data_was_repack = file_content_main.replace(";dummy_layout.inc", file_inc_content)
content_data = content_data_was_repack.replace(";BigLogoLayout", file_inc2_content)
file_inc3_content = file_inc3_content.replace("###EventOnClick", file_inc_event_click_content)
begin_text = content_data.index(";TAGESP")
end_text = content_data.index(";TAGESP", begin_text + 7)
#print("sub text = " + str(begin_text) + " end = " + str(end_text))
tmp1 = content_data[: begin_text - 7]
tmp2 = content_data[ end_text:-1]
#print("tmp1=" + tmp1)
#print("tmp2=" + tmp2)
print(file_inc3_content)
content_data = tmp1 + tmp2
#print( file_inc_content)
content_data_was_repack = file_content_main.replace(";dummy_layout.inc", file_inc_content)
content_data = content_data_was_repack.replace(";BigLogoLayout", file_inc3_content)
file_xml3_out = open(directory_to_process + "/event/out_put_file2.txt", 'r')
file_xml3_out_content = file_xml3_out.read()
file_xml3_out_content = file_xml3_out_content.strip()
file_xml3_out_content = file_xml3_out_content.replace("\r", "")
file_xml3_out_content = file_xml3_out_content.replace("\n", "")
begin_text = content_data.index(";TAGESP")
end_text = content_data.index(";TAGESP", begin_text + 7)
#print("sub text = " + str(begin_text) + " end = " + str(end_text))
tmp1 = content_data[: begin_text - 7]
file_xml3 = open(directory_to_process + file_xml3_out_content, 'w')
file_xml3.write( content_data)
file_xml3.close()
tmp3 = content_data[ end_text:-1]
#print("tmp1=" + tmp1)
#print("tmp3=" + tmp3)
content_data = tmp1 + tmp3
file_xml3_out = open(directory_to_process + "/event/out_put_file3.txt", 'r')
file_xml3_out_content = file_xml3_out.read()
file_xml3_out_content = file_xml3_out_content.strip()
file_xml3_out_content = file_xml3_out_content.replace("\r", "")
file_xml3_out_content = file_xml3_out_content.replace("\n", "")
file_xml3 = open(directory_to_process + file_xml3_out_content, 'w')
file_xml3.write( content_data)
file_xml3.close()
if "template4" in param:
# NOTE: promotion_template4.inc, image_template4, promotion_onclick4.inc, out_put_file4.txt
# promotion 4
file_inc3 = open(directory_to_process + "/event/promotion_template4.inc", 'r')
file_inc3_content = file_inc3.read()
file_inc_img = open(directory_to_process + "/../image/event/image_template4", 'r')
file_inc3_img_content = file_inc_img.read()
# replace key.
sp_key = file_inc3_img_content.split("\n")
print("sp_key = " + str(len( sp_key)))
for sp_line in sp_key:
sp_line = sp_line.strip()
key_val = sp_line.split("=")
print("Kenta420:", key_val)
if len( key_val) == 2:
print("k = " + key_val[0] + " val=" + key_val[1])
file_inc3_content = file_inc3_content.replace( "###" + key_val[0], '"' + key_val[1].strip() + '"')
file_inc_event_click = open(directory_to_process + "/event/promotion_onclick4.inc", 'r')
file_inc_event_click_content = file_inc_event_click.read()
file_inc3_content = file_inc3_content.replace("###EventOnClick", file_inc_event_click_content)
print(file_inc3_content)
#print( file_inc_content)
content_data_was_repack = file_content_main.replace(";dummy_layout.inc", file_inc_content)
content_data = content_data_was_repack.replace(";BigLogoLayout", file_inc3_content)
begin_text = content_data.index(";TAGESP")
end_text = content_data.index(";TAGESP", begin_text + 7)
#print("sub text = " + str(begin_text) + " end = " + str(end_text))
tmp1 = content_data[: begin_text - 7]
tmp3 = content_data[ end_text:-1]
#print("tmp1=" + tmp1)
#print("tmp3=" + tmp3)
content_data = tmp1 + tmp3
file_xml3_out = open(directory_to_process + "/event/out_put_file4.txt", 'r')
file_xml3_out_content = file_xml3_out.read()
file_xml3_out_content = file_xml3_out_content.strip()
file_xml3_out_content = file_xml3_out_content.replace("\r", "")
file_xml3_out_content = file_xml3_out_content.replace("\n", "")
file_xml3 = open(directory_to_process + file_xml3_out_content, 'w')
file_xml3.write( content_data)
file_xml3.close()
if "template5" in param:
# promotion thai tea
file_inc3 = open(directory_to_process + "/event/promotion_template5.inc", 'r')
file_inc3_content = file_inc3.read()
file_inc_img = open(directory_to_process + "/../image/event/image_template5", 'r')
file_inc3_img_content = file_inc_img.read()
# replace key.
sp_key = file_inc3_img_content.split("\n")
print("sp_key = " + str(len( sp_key)))
for sp_line in sp_key:
sp_line = sp_line.strip()
key_val = sp_line.split("=")
print("Kenta420:", key_val)
if len( key_val) == 2:
print("k = " + key_val[0] + " val=" + key_val[1])
file_inc3_content = file_inc3_content.replace( "###" + key_val[0], '"' + key_val[1].strip() + '"')
file_inc_event_click = open(directory_to_process + "/event/promotion_onclick5.inc", 'r')
file_inc_event_click_content = file_inc_event_click.read()
file_inc3_content = file_inc3_content.replace("###EventOnClick", file_inc_event_click_content)
print(file_inc3_content)
#print( file_inc_content)
content_data_was_repack = file_content_main.replace(";dummy_layout.inc", file_inc_content)
content_data = content_data_was_repack.replace(";BigLogoLayout", file_inc3_content)
begin_text = content_data.index(";TAGESP")
end_text = content_data.index(";TAGESP", begin_text + 7)
#print("sub text = " + str(begin_text) + " end = " + str(end_text))
tmp1 = content_data[: begin_text - 7]
tmp3 = content_data[ end_text:-1]
#print("tmp1=" + tmp1)
#print("tmp3=" + tmp3)
content_data = tmp1 + tmp3
file_xml3_out = open(directory_to_process + "/event/out_put_file5.txt", 'r')
file_xml3_out_content = file_xml3_out.read()
file_xml3_out_content = file_xml3_out_content.strip()
file_xml3_out_content = file_xml3_out_content.replace("\r", "")
file_xml3_out_content = file_xml3_out_content.replace("\n", "")
file_xml3 = open(directory_to_process + file_xml3_out_content, 'w')
file_xml3.write( content_data)
file_xml3.close()
###############################################################
# MULTI PRO
###############################################################
print("dummy.current_file_name=", current_file_name)
if "multi_promotion" in param:
print("Should gen multi")
files = os.listdir(directory_to_process + "/event/")
files = [f for f in files if f.startswith("multi_promotion_config")]
for filename in files:
recommend_multi_pro = open(directory_to_process + "/page_catalog_group_recommend_multi_pro.lxml", "r")
recommend_multi_pro_buff = recommend_multi_pro.read()
recommend_multi_pro.close()
#read config
multi_pro_config_file = open(directory_to_process + "/event/"+ filename)
multi_pro_config = json.load(multi_pro_config_file)
index = 0
promotion_name = []
while index < len(multi_pro_config):
promotion_config = multi_pro_config[index]
index += 1
# add promotion name for create filename later
promotion_name.append(promotion_config["name"])
#load template
template_file = open(directory_to_process + promotion_config["template"])
template = template_file.read()
template_file.close()
for key, value in promotion_config["config"].items():
template = template.replace("###"+key, '"' + value.strip() + '"')
promotion_block_str = '\r\n<Block>\r\n\t<State> PromotionState{0} </State>\r\n\t<MarginLeft> 33 </MarginLeft>\r\n\t<MarginTop> 22 </MarginTop>\r\n\t<Width> 484 </Width>\r\n\t<Height> 602 </Height>\r\n'.format(index)
promotion_block_str += template
promotion_block_str += '\r\n</Block>\r\n'
recommend_multi_pro_buff = re.sub(r'(?is)(;block{0}).*(;endblock{0})'.format(index), r'\1{0}\2'.format(promotion_block_str), recommend_multi_pro_buff)
file_inc3 = open(directory_to_process + "/event/promotion_template3.inc", 'r')
file_inc3_content = file_inc3.read()
file_inc_img = open(directory_to_process + "/../image/event/image_template3", 'r')
file_inc3_img_content = file_inc_img.read()
if index == 2:
# expend block3 to full width bottom
inner_block = re.search(r'(?is);block{0}(.*);endblock{0}'.format(index+1), recommend_multi_pro_buff).group(1)
inner_block = inner_block.replace("<Width> 516 </Width>", "<Width> 1032 </Width>", 2)
inner_block = inner_block.replace("<Max> 4 </Max>", "<Max> 8 </Max>", 1)
inner_block = inner_block.replace("<Column> 2 </Column>", "<Column> 4 </Column>", 1)
recommend_multi_pro_buff = re.sub(r'(?is)(;block{0}).*(;endblock{0})'.format(index+1), r'\1{0}\2'.format(inner_block), recommend_multi_pro_buff)
# replace key.
# remove block4
recommend_multi_pro_buff = re.sub(r'(?is)(;block{0}).*(;endblock{0})'.format(index+2), r'\1\2', recommend_multi_pro_buff)
sp_key = file_inc3_img_content.split("\n")
print("sp_key = " + str(len( sp_key)))
for sp_line in sp_key:
sp_line = sp_line.strip()
key_val = sp_line.split("=")
print("Kenta420:", key_val)
if len( key_val) == 2:
print("k = " + key_val[0] + " val=" + key_val[1])
file_inc3_content = file_inc3_content.replace( "###" + key_val[0], '"' + key_val[1].strip() + '"')
if index == 3:
# create expand block
inner_block2 = re.search(r'(?is)(;block{0}.*;endblock{0})'.format(index+1), recommend_multi_pro_buff).group(1)
inner_block2 = inner_block2.replace(";block{0}".format(index+1), ";block{0}-expand".format(index+1))
inner_block2 = inner_block2.replace(";endblock{0}".format(index+1), ";endblock{0}-expand".format(index+1))
inner_block2 = inner_block2.replace("<Width> 516 </Width>", "<Width> 1032 </Width>", 2)
# inner_block2 = inner_block2.replace("<State> \"Enable\" </State> ", "<State>\r\n\teval(\r\n\tIf PromotionState{0} = \"Enable\" Then\r\n\t\tVar block_expend_show = \"Invisible\"\r\n\tElse\r\n\t\tVar block_expend_show = \"Enable\"\r\n\tEndIf\r\n\tVar return = block_expend_show\r\n\t)\r\n</State>".format(index), 1)
inner_block2 = inner_block2.replace("<Max> 4 </Max>", "<Max>\r\neval(\r\n\tIf CountEnablePromotion > 2 Then\r\n\t\tVar max_count = 4\r\n\tElse\r\n\t\tVar max_count = 8\r\n\tEndIf\r\n\tVar return = max_count\r\n)\r\n</Max>", 1)
inner_block2 = inner_block2.replace("<Column> 2 </Column>", "<Column>\r\neval(\r\n\tIf CountEnablePromotion > 2 Then\r\n\t\tVar column_count = 2\r\n\tElse\r\n\t\tVar column_count = 4\r\n\tEndIf\r\n\tVar return = column_count\r\n)\r\n</Column>", 1)
recommend_multi_pro_buff = re.sub(r'(?is);block{0}.*;endblock{0}'.format(index+1), inner_block2, recommend_multi_pro_buff)
file_inc_event_click = open(directory_to_process + "/event/promotion_onclick3.inc", 'r')
file_inc_event_click_content = file_inc_event_click.read()
file_inc3_content = file_inc3_content.replace("###EventOnClick", file_inc_event_click_content)
print(file_inc3_content)
#print( file_inc_content)
content_data_was_repack = file_content_main.replace(";dummy_layout.inc", file_inc_content)
content_data = content_data_was_repack.replace(";BigLogoLayout", file_inc3_content)
begin_text = content_data.index(";TAGESP")
end_text = content_data.index(";TAGESP", begin_text + 7)
#print("sub text = " + str(begin_text) + " end = " + str(end_text))
tmp1 = content_data[: begin_text - 7]
tmp3 = content_data[ end_text:-1]
#print("tmp1=" + tmp1)
#print("tmp3=" + tmp3)
content_data = tmp1 + tmp3
file_xml3_out = open(directory_to_process + "/event/out_put_file3.txt", 'r')
file_xml3_out_content = file_xml3_out.read()
file_xml3_out_content = file_xml3_out_content.strip()
file_xml3_out_content = file_xml3_out_content.replace("\r", "")
file_xml3_out_content = file_xml3_out_content.replace("\n", "")
file_xml3 = open(directory_to_process + file_xml3_out_content, 'w')
file_xml3.write( content_data)
file_xml3.close()
# NOTE: promotion_template4.inc, image_template4, promotion_onclick4.inc, out_put_file4.txt
# promotion 4
file_inc3 = open(directory_to_process + "/event/promotion_template4.inc", 'r')
file_inc3_content = file_inc3.read()
file_inc_img = open(directory_to_process + "/../image/event/image_template4", 'r')
file_inc3_img_content = file_inc_img.read()
# replace key.
sp_key = file_inc3_img_content.split("\n")
print("sp_key = " + str(len( sp_key)))
for sp_line in sp_key:
sp_line = sp_line.strip()
key_val = sp_line.split("=")
print("Kenta420:", key_val)
if len( key_val) == 2:
print("k = " + key_val[0] + " val=" + key_val[1])
file_inc3_content = file_inc3_content.replace( "###" + key_val[0], '"' + key_val[1].strip() + '"')
file_inc_event_click = open(directory_to_process + "/event/promotion_onclick4.inc", 'r')
file_inc_event_click_content = file_inc_event_click.read()
file_inc3_content = file_inc3_content.replace("###EventOnClick", file_inc_event_click_content)
print(file_inc3_content)
#print( file_inc_content)
content_data_was_repack = file_content_main.replace(";dummy_layout.inc", file_inc_content)
content_data = content_data_was_repack.replace(";BigLogoLayout", file_inc3_content)
begin_text = content_data.index(";TAGESP")
end_text = content_data.index(";TAGESP", begin_text + 7)
#print("sub text = " + str(begin_text) + " end = " + str(end_text))
tmp1 = content_data[: begin_text - 7]
tmp3 = content_data[ end_text:-1]
#print("tmp1=" + tmp1)
#print("tmp3=" + tmp3)
content_data = tmp1 + tmp3
file_xml3_out = open(directory_to_process + "/event/out_put_file4.txt", 'r')
file_xml3_out_content = file_xml3_out.read()
file_xml3_out_content = file_xml3_out_content.strip()
file_xml3_out_content = file_xml3_out_content.replace("\r", "")
file_xml3_out_content = file_xml3_out_content.replace("\n", "")
file_xml3 = open(directory_to_process + file_xml3_out_content, 'w')
file_xml3.write( content_data)
file_xml3.close()
# promotion thai tea
file_inc3 = open(directory_to_process + "/event/promotion_template5.inc", 'r')
file_inc3_content = file_inc3.read()
file_inc_img = open(directory_to_process + "/../image/event/image_template5", 'r')
file_inc3_img_content = file_inc_img.read()
# replace key.
sp_key = file_inc3_img_content.split("\n")
print("sp_key = " + str(len( sp_key)))
for sp_line in sp_key:
sp_line = sp_line.strip()
key_val = sp_line.split("=")
print("Kenta420:", key_val)
if len( key_val) == 2:
print("k = " + key_val[0] + " val=" + key_val[1])
file_inc3_content = file_inc3_content.replace( "###" + key_val[0], '"' + key_val[1].strip() + '"')
file_inc_event_click = open(directory_to_process + "/event/promotion_onclick5.inc", 'r')
file_inc_event_click_content = file_inc_event_click.read()
file_inc3_content = file_inc3_content.replace("###EventOnClick", file_inc_event_click_content)
print(file_inc3_content)
#print( file_inc_content)
content_data_was_repack = file_content_main.replace(";dummy_layout.inc", file_inc_content)
content_data = content_data_was_repack.replace(";BigLogoLayout", file_inc3_content)
begin_text = content_data.index(";TAGESP")
end_text = content_data.index(";TAGESP", begin_text + 7)
#print("sub text = " + str(begin_text) + " end = " + str(end_text))
tmp1 = content_data[: begin_text - 7]
tmp3 = content_data[ end_text:-1]
#print("tmp1=" + tmp1)
#print("tmp3=" + tmp3)
content_data = tmp1 + tmp3
file_xml3_out = open(directory_to_process + "/event/out_put_file5.txt", 'r')
file_xml3_out_content = file_xml3_out.read()
file_xml3_out_content = file_xml3_out_content.strip()
file_xml3_out_content = file_xml3_out_content.replace("\r", "")
file_xml3_out_content = file_xml3_out_content.replace("\n", "")
file_xml3 = open(directory_to_process + file_xml3_out_content, 'w')
file_xml3.write( content_data)
file_xml3.close()
# create promotion file
count_name_dict = {
2: "double_",
3: "triple_"
}
promo_file = open(directory_to_process + "/event/" + count_name_dict[len(multi_pro_config)]+ "promotion_" + "_and_".join(promotion_name) + ".lxml", "w")
promo_file.write(recommend_multi_pro_buff)
promo_file.close()

View file

@ -0,0 +1,28 @@
[
{
"name": "thai_tea",
"template": "/event/promotion_template.inc",
"config": {
"normal_eng": "ROOT/taobin_project/inter/mys/image/event/pro_thai_tea/pro_thai_tea_big_btn.png",
"normal_thai": "ROOT/taobin_project/inter/mys/image/event/pro_thai_tea/pro_thai_tea_big_btn.png",
"press_eng": "ROOT/taobin_project/inter/mys/image/event/pro_thai_tea/pro_thai_tea_big_btn.png",
"press_thai": "ROOT/taobin_project/inter/mys/image/event/pro_thai_tea/pro_thai_tea_big_btn.png",
"disable_eng": "ROOT/taobin_project/inter/mys/image/event/pro_thai_tea/pro_thai_tea_big_btn.png",
"disable_thai": "ROOT/taobin_project/inter/mys/image/event/pro_thai_tea/pro_thai_tea_big_btn.png",
"event_on_click": "ROOT/taobin_project/inter/mys/xml/page_catalog_group_pro_thai_tea.lxml"
}
},
{
"name": "yuzu",
"template": "/event/promotion_template.inc",
"config": {
"normal_eng": "ROOT/taobin_project/inter/mys/image/event/pro_thai_tea/pro_thai_tea_big_btn.png",
"normal_thai": "ROOT/taobin_project/inter/mys/image/event/pro_thai_tea/pro_thai_tea_big_btn.png",
"press_eng": "ROOT/taobin_project/inter/mys/image/event/pro_thai_tea/pro_thai_tea_big_btn.png",
"press_thai": "ROOT/taobin_project/inter/mys/image/event/pro_thai_tea/pro_thai_tea_big_btn.png",
"disable_eng": "ROOT/taobin_project/inter/mys/image/event/pro_thai_tea/pro_thai_tea_big_btn.png",
"disable_thai": "ROOT/taobin_project/inter/mys/image/event/pro_thai_tea/pro_thai_tea_big_btn.png",
"event_on_click": "ROOT/taobin_project/inter/mys/xml/page_catalog_group_pro_yuzu.lxml"
}
}
]

View file

@ -0,0 +1,38 @@
<Button>
<State> BigButtonEnable </State>
<Filename>
eval(
If show_eng = "true" Then
Var return = ###normal_eng
Else
Var return = ###normal_thai
EndIf
)
</Filename>
<FilenamePress>
eval(
If show_eng = "true" Then
Var return = ###press_eng
Else
Var return = ###press_thai
EndIf
)
</FilenamePress>
<FilenameDisable>
eval(
If show_eng = "true" Then
Var return = ###disable_eng
Else
Var return = ###disable_thai
EndIf
)
</FilenameDisable>
<EventOnClick>
Open ###event_on_click
</EventOnClick>
</Button>

View file

@ -4,22 +4,57 @@
; zone promote
DEBUGVAR FruityRayaEnable
DEBUGVAR ProThaiTeaEnable
DEBUGVAR ProYuzuEnable
Var CountEnablePromotion = 0
Var PromotionState1 = "Invisible"
Var PromotionState2 = "Invisible"
If ProThaiTeaEnable = 1 Then
Var PromotionState1 = "Enable"
Var CountEnablePromotion = CountEnablePromotion + 1
EndIf
If ProYuzuEnable = 1 Then
Var PromotionState2 = "Enable"
Var CountEnablePromotion = CountEnablePromotion + 1
EndIf
DEBUGVAR CountEnablePromotion
If OpenFromPageBoard = 1 Then
If ProThaiTeaEnable = 1 Then
Var BigButtonEnable = "Enable"
OpenInst 2 "ROOT/taobin_project/inter/mys/xml/event/promotion_thai_tea.lxml"
Var OpenFromPageBoard = 0
; has-ongoing-pro
If CountEnablePromotion >= 1 Then
Var BigButtonEnable = "Enable"
If CountEnablePromotion = 1 Then
OpenInst 2 "ROOT/taobin_project/inter/mys/xml/event/promotion_thai_tea.lxml"
EndIf
If CountEnablePromotion = 2 Then
OpenInst 2 "ROOT/taobin_project/inter/mys/xml/event/double_promotion_thai_tea_and_yuzu.lxml"
EndIf
Var OpenFromPageBoard = 0
Else
OpenInst 2 "ROOT/taobin_project/inter/mys/xml/page_catalog_group_recommend.lxml"
EndIf
Else
If ProThaiTeaEnable = 1 Then
Var BigButtonEnable = "Enable"
OpenInst 2 "ROOT/taobin_project/inter/mys/xml/event/promotion_thai_tea.lxml"
Var OpenFromPageBoard = 0
; has-ongoing-pro
If CountEnablePromotion >= 1 Then
Var BigButtonEnable = "Enable"
If CountEnablePromotion = 1 Then
OpenInst 2 "ROOT/taobin_project/inter/mys/xml/event/promotion_thai_tea.lxml"
EndIf
If CountEnablePromotion = 2 Then
OpenInst 2 "ROOT/taobin_project/inter/mys/xml/event/double_promotion_thai_tea_and_yuzu.lxml"
EndIf
Var OpenFromPageBoard = 0
Else
OpenInst 2 "ROOT/taobin_project/inter/mys/xml/page_catalog_group_recommend.lxml"
EndIf

View file

@ -27,16 +27,25 @@ EndIf
If SystemDateMonthInt = 7 Then
Var ProThaiTeaEnable = 1
If SystemDateDayInt >= 15 Then
Var ProYuzuEnable = 1
Else
Var ProYuzuEnable = 0
EndIf
EndIf
If SystemDateMonthInt = 8 Then
If SystemDateDayInt < 31 Then
Var ProThaiTeaEnable = 1
Var ProYuzuEnable = 1
Else
Var ProThaiTeaEnable = 0
Var ProYuzuEnable = 0
EndIf
EndIf
If BoxID = 177746 Then
Var ProThaiTeaEnable = 1
Var ProYuzuEnable = 1
EndIf

View file

@ -0,0 +1,152 @@
<Popup>
<Cache> "Enable" </Cache>
<Width> 1080 </Width>
<Height> 1920 </Height>
<Background> "0xeae6e1" </Background>
<Volume> SoundVolume </Volume>
<EventOpen>
Var Timeout = 0
DEBUGVAR TelephoneNumber
DEBUGVAR FromProYuzu
DEBUGVAR Seeker.VendingCode
DEBUGVAR Seeker.ProYuzu
DEBUGVAR Seeker.UseProYuzuCode
Var Cid = 43
Var param1 = ""
Var param2 = ""
Var param3 = ""
If FromProYuzu = 1 Then
If TelephoneNumber = "" Then
Else
DEBUGVAR TelephoneNumber
; Telephone must not empty
If Seeker.CodeChannel = 1 Then
DEBUGVAR Seeker.CodeChannel
Var Seeker.UseProYuzuCode = 1
Var Seeker.ProYuzu = 1
Else
Var Seeker.ProYuzu = 1
Var Seeker.UseProYuzuCode = 0
DEBUGVAR Seeker.ProYuzu
DEBUGVAR Seeker.UseProYuzuCode
; support-for-multi-pro-with-same-cid
Var param1 = "701"
AddData Cid TelephoneNumber param1 param2 param3
EndIf
EndIf
EndIf
; reset flag
Var FromProYuzu = 0
; goto lid straw
Open "ROOT/taobin_project/xml/page_lid_straw.xml"
</EventOpen>
<Timeout> 1000 </Timeout>
<EventTimeout>
Var CountDownBrewing = BREW_CNT
Var ShowCountDownBrewing = CountDownBrewing
Var Timeout = Timeout + 1
If Timeout > 2 Then
Open "ROOT/taobin_project/xml/page_lid_straw.xml"
EndIf
TimerReset
Refresh
</EventTimeout>
<EventSecurity>
Open "/media/bt/xml/security_alarm.xml"
</EventSecurity>
<EventActionOk>
;
</EventActionOk>
<EventMachine>
If MachineStage = "drink-success" Then
Var MachineState_Result = 1
EndIf
If MachineStage = "drink-failed" Then
Var MachineState_Result = 2
EndIf
</EventMachine>
;<Image>
;<X> 0 </X>
;<Y> 0 </Y>
;<Filename> "ROOT/taobin_project/image/ad_medium_2.png" </Filename>
;</Image>
;include="ROOT/taobin_project/inc/video.inc"
;<Image>
;<X> 0 </X>
;<Y> 380 </Y>
;<Filename> "ROOT/taobin_project/image/display_get_free/alpha.png" </Filename>
;</Image>
<Image>
<X> 0 </X>
<Y> 560 </Y>
<State> "Enable" </State>
<Filename> Var( DirImage + img_popup6 )</Filename>
</Image>
<Image>
<X> 751 </X>
<Y> 413 </Y>
<Filename> IMG_CNT </Filename>
</Image>
;
<Text>
<X> XPosiShowCountDownBrew </X>
<Y> 470 </Y>
<Align> End </Align>
<Width> 153 </Width>
<Size> 88 </Size>
<Font> RobotoBold </Font>
<Color> 0x513C2F </Color>
<Value> ShowCountDownBrewing </Value>
</Text>
<Text>
<X> 99 </X>
<Y> 1300 </Y>
<Align> center </Align>
<Size> 48 </Size>
<Color> 0x513C2F </Color>
<Value> "Please wait for coupon from SMS ... "
</Text>
</Popup>