THAI: Update V3 promotion

This commit is contained in:
Kenta420 2025-04-11 14:39:42 +07:00
parent 971f172a62
commit 382cc8cbbf
143 changed files with 15504 additions and 145590 deletions

View file

@ -0,0 +1,32 @@
if "v3" in param and "promotion" in param:
print("Kenta", directory_to_process)
file_template = open(directory_to_process + "/page_catalog_group_recommend.lxml", 'r')
template_content = file_template.read()
file_template.close()
pro_template = open(directory_to_process + "/event/event_v3/promotion_template.inc")
pro_template_content = pro_template.read()
pro_template.close()
all_active_pro = ""
files = os.listdir(directory_to_process + "/event/event_v3")
files = [f for f in files if f.endswith(".json")]
for filename in files:
pro_json_file = open(directory_to_process + "/event/event_v3/"+ filename)
pro_json = json.load(pro_json_file)
start_time = datetime.datetime.strptime(pro_json["start"], "%Y-%m-%dT%H:%M:%S")
end_time = datetime.datetime.strptime(pro_json["end"], "%Y-%m-%dT%H:%M:%S")
if start_time > datetime.datetime.now() or datetime.datetime.now() < end_time:
pro_content = str(pro_template_content)
pro_content = pro_content.replace("#State", pro_json["state"])
pro_content = pro_content.replace("#Type", pro_json["type"])
pro_content = pro_content.replace("#MediaThai", pro_json["media_thai"])
pro_content = pro_content.replace("#MediaEng", pro_json["media_eng"])
pro_content = pro_content.replace("#EventClick", pro_json["event_click"])
all_active_pro += pro_content + "\n\t"
pro_output_file = open(directory_to_process + "/event/event_v3/active_promotions.lxml", 'w')
pro_output_file.write(template_content.replace(";banners", all_active_pro))
pro_output_file.close()

View file

@ -0,0 +1,9 @@
{
"start": "2025-04-01T00:00:00",
"end": "2025-04-30T00:00:00",
"state": "KingdomThaiTeaProState",
"type": "IMAGE",
"media_thai": "ROOT/taobin_project/image/event/kingdom_thai_tea/kingdom_thai_tea.png",
"media_eng": "ROOT/taobin_project/image/event/kingdom_thai_tea/kingdom_thai_tea.png",
"event_click": "Open \"ROOT/taobin_project/xml/v3/page_catalog_group_pro_kingdom_thai_tea.xml\""
}

View file

@ -0,0 +1,9 @@
{
"start": "2025-04-07T00:00:00",
"end": "2025-04-27T00:00:00",
"state": "PepsiXTaobinProState",
"type": "VIDEO",
"media_thai": "ROOT/taobin_project/image/event/pepsi_x_taobin/pepsi_x_taobin.mp4",
"media_eng": "ROOT/taobin_project/image/event/pepsi_x_taobin/pepsi_x_taobin.mp4",
"event_click": "Open \"ROOT/taobin_project/xml/v3/page_catalog_group_pro_pepsi_x_taobin.xml\""
}

View file

@ -0,0 +1,9 @@
{
"start": "2025-03-10T00:00:00",
"end": "2025-03-31T00:00:00",
"state": "MatchaEveryDayProState",
"type": "IMAGE",
"media_thai": "ROOT/taobin_project/image/event/matcha_every_day/matcha_every_day.png",
"media_eng": "ROOT/taobin_project/image/event/matcha_every_day/matcha_every_day.png",
"event_click": "Open \"ROOT/taobin_project/xml/v3/page_catalog_group_pro_matcha_every_day.xml\""
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,16 @@
<Banner>
<State> #State </State>
<Type> #Type </Type>
<Media>
eval(
If show_eng = "true" Then
Var return = "#MediaEng"
Else
Var return = "#MediaThai"
EndIf
)
</Media>
<EventOnClick>
#EventClick
</EventOnClick>
</Banner>

View file

@ -0,0 +1,20 @@
Var FileRecommendToOpen = "ROOT/taobin_project/inter/tha/xml/multi/v3/event/event_v3/active_promotions.lxml"
Var MatchaEveryDayProState = "Invisible"
Var KingdomThaiTeaProState = "Invisible"
Var PepsiXTaobinProState = "Invisible"
If MatchaEveryDayPro = 1 Then
Var MatchaEveryDayProState = "Enable"
EndIf
If KingdomThaiTeaPro = 1 Then
Var KingdomThaiTeaProState = "Enable"
EndIf
If PepsiXTaobinPro = 1 Then
Var PepsiXTaobinProState = "Enable"
EndIf