{%- set greeting = '亲爱的用户' if hour < 11 else '中午好' if hour < 14 else '下午好' if hour < 18 else '晚上好' -%} {%- set period = '早晨' if hour < 9 else '上午' if hour < 12 else '中午' if hour < 14 else '下午' if hour < 18 else '晚上' -%} {%- set is_hot = temperature is defined and temperature >= 30 -%} {%- set is_cold = temperature is defined and temperature <= 10 -%} {%- set has_rain = weather is defined and weather is string and '雨' in weather -%} {%- set condition = '炎热' if is_hot else '寒冷' if is_cold else '下雨' if has_rain else weather|default('美好') -%} {%- set proportion_pct = (user_proportion * 100)|round(1) if user_proportion is defined and user_proportion is not none else none -%} {%- set popularity_level = '最受欢迎' if proportion_pct is defined and proportion_pct is not none and proportion_pct >= 70 else '人气很高' if proportion_pct is defined and proportion_pct is not none and proportion_pct >= 50 else '很多人选择' if proportion_pct is defined and proportion_pct is not none and proportion_pct >= 30 else '值得一试' -%} {%- set user_desc = '超过' ~ user_count ~ '位用户' if user_count is defined and user_count is not none and user_count >= 10000 else user_count ~ '位用户' if user_count is defined and user_count is not none else '很多用户' -%} {# 第一段:基础推荐 + 数据支撑 #} {{ greeting }},为你推荐{{ feature_name|default('这类衣物') }}的{{ program_name }}程序, {%- if user_count is defined or user_proportion is defined %} 这可是你的老朋友了,数据显示在{{ season }}{{ city|default('本地') }}{{ period }}, {{ user_desc }}{% if proportion_pct is defined and proportion_pct is not none %},占比高达{{ proportion_pct }}%{% endif %}都爱用它洗呢。 {%- else %} 非常适合当前季节和衣物类型。 {%- endif %} {# 第二段:季节场景化推荐 #} {%- if season in ['夏季', '冬天'] or is_hot or is_cold or has_rain %} {{ season }}洗衣时, {%- if is_hot %}高温天气下,{% elif is_cold %}寒冷天气下,{% elif has_rain %}雨天,{% endif %} {{ feature_name|default('这类衣物') }}的{{ program_name }}程序最懂你心意, {%- if proportion_pct is defined and proportion_pct is not none %} {{ city|default('本地') }}{{ period }}时段有{{ proportion_pct }}%用户选择它呢。 {%- else %} 很适合现在使用。 {%- endif %} {%- endif %} {# 第三段:助手提醒(总是输出,增强亲切感) #} 洗衣助手提醒你,{{ feature_name|default('这类衣物') }}的{{ program_name }}程序真不错, {%- if proportion_pct is defined and proportion_pct is not none %} {{ city|default('本地') }}{{ period }}时段人气也很旺,属于{{ popularity_level }}的洗衣方案。 {%- else %} 非常实用,值得一试。 {%- endif %} {# 第四段:天气+时段氛围感推荐 #} 又是一个{{ season }}{{ condition }}的{{ period }}, 为你推荐{{ feature_name|default('这类衣物') }}的{{ program_name }}程序, {%- if proportion_pct is defined and proportion_pct is not none %} 这是{{ popularity_level }}的洗衣方案之一,{{ city|default('本地') }}{{ proportion_pct }}%用户都在用。 {%- else %} 这是当前最合适的洗涤方式。 {%- endif %} {# 结尾温柔提醒 #} 祝你洗衣愉快,衣物干净如新!