fix(ui): align lucky colors with five elements
This commit is contained in:
@@ -1210,11 +1210,16 @@ typedef struct {
|
||||
* can replace colors without touching model-command parsing or LCD playback.
|
||||
*/
|
||||
static const control_plane_lucky_color_mapping_t s_lucky_color_mappings[] = {
|
||||
{"金", DOMAIN_WUXING_ELEMENT_METAL},
|
||||
{"棕", DOMAIN_WUXING_ELEMENT_WOOD},
|
||||
{"蓝", DOMAIN_WUXING_ELEMENT_WATER},
|
||||
{"绿", DOMAIN_WUXING_ELEMENT_WOOD},
|
||||
{"绿色", DOMAIN_WUXING_ELEMENT_WOOD},
|
||||
{"红", DOMAIN_WUXING_ELEMENT_FIRE},
|
||||
{"红色", DOMAIN_WUXING_ELEMENT_FIRE},
|
||||
{"黄", DOMAIN_WUXING_ELEMENT_EARTH},
|
||||
{"黄色", DOMAIN_WUXING_ELEMENT_EARTH},
|
||||
{"白", DOMAIN_WUXING_ELEMENT_METAL},
|
||||
{"白色", DOMAIN_WUXING_ELEMENT_METAL},
|
||||
{"蓝", DOMAIN_WUXING_ELEMENT_WATER},
|
||||
{"蓝色", DOMAIN_WUXING_ELEMENT_WATER},
|
||||
};
|
||||
|
||||
static bool control_plane_resolve_lucky_color(const char *color_name,
|
||||
|
||||
@@ -317,5 +317,5 @@ token/daily_wealth_interface_random_test_report.md
|
||||
|
||||
- The response field names are currently Chinese: `设备id`, `生辰八字`, `五行属性`, `今日喜色`, and `今日财位`.
|
||||
- `currentResidence` and `mbti` are reserved request fields and are not currently used.
|
||||
- `今日喜色` returns a Five Elements name rather than a literal color. The business mapping is: metal (`金`) = white, wood (`木`) = green, water (`水`) = black, fire (`火`) = red, and earth (`土`) = yellow.
|
||||
- `今日喜色` returns a Five Elements name rather than a literal color. The business mapping is: metal (`金`) = white, wood (`木`) = green, water (`水`) = blue, fire (`火`) = red, and earth (`土`) = yellow.
|
||||
- When `targetDate` is omitted, the server uses its current date and the request time zone. Specify `targetDate` for deterministic device behavior and automated testing.
|
||||
|
||||
@@ -80,11 +80,11 @@ if (cJSON_IsString(weather) && weather->valuestring != NULL &&
|
||||
支持的标准喜色指令为:
|
||||
|
||||
```text
|
||||
/*{"喜色":"金"}*/
|
||||
/*{"喜色":"棕"}*/
|
||||
/*{"喜色":"蓝"}*/
|
||||
/*{"喜色":"绿"}*/
|
||||
/*{"喜色":"红"}*/
|
||||
/*{"喜色":"黄"}*/
|
||||
/*{"喜色":"白"}*/
|
||||
/*{"喜色":"蓝"}*/
|
||||
```
|
||||
|
||||
### 3.3 为原五行 UI 增加可选的确定性结果
|
||||
@@ -167,11 +167,11 @@ const domain_wuxing_result_t *result = &s_wuxing_results[result_index];
|
||||
|
||||
| 喜色 | 五行 UI |
|
||||
| --- | --- |
|
||||
| 金 | 金 |
|
||||
| 棕 | 木 |
|
||||
| 蓝 | 水 |
|
||||
| 绿 | 木 |
|
||||
| 红 | 火 |
|
||||
| 黄 | 土 |
|
||||
| 白 | 金 |
|
||||
| 蓝 | 水 |
|
||||
|
||||
代码将映射集中在一个表中:
|
||||
|
||||
@@ -186,11 +186,16 @@ typedef struct {
|
||||
* can replace colors without touching model-command parsing or LCD playback.
|
||||
*/
|
||||
static const control_plane_lucky_color_mapping_t s_lucky_color_mappings[] = {
|
||||
{"金", DOMAIN_WUXING_ELEMENT_METAL},
|
||||
{"棕", DOMAIN_WUXING_ELEMENT_WOOD},
|
||||
{"蓝", DOMAIN_WUXING_ELEMENT_WATER},
|
||||
{"绿", DOMAIN_WUXING_ELEMENT_WOOD},
|
||||
{"绿色", DOMAIN_WUXING_ELEMENT_WOOD},
|
||||
{"红", DOMAIN_WUXING_ELEMENT_FIRE},
|
||||
{"红色", DOMAIN_WUXING_ELEMENT_FIRE},
|
||||
{"黄", DOMAIN_WUXING_ELEMENT_EARTH},
|
||||
{"黄色", DOMAIN_WUXING_ELEMENT_EARTH},
|
||||
{"白", DOMAIN_WUXING_ELEMENT_METAL},
|
||||
{"白色", DOMAIN_WUXING_ELEMENT_METAL},
|
||||
{"蓝", DOMAIN_WUXING_ELEMENT_WATER},
|
||||
{"蓝色", DOMAIN_WUXING_ELEMENT_WATER},
|
||||
};
|
||||
```
|
||||
|
||||
@@ -272,7 +277,7 @@ return domain_runtime_request_expression(&request);
|
||||
|
||||
### 5.2 当前限制
|
||||
|
||||
- 当前只接受单字喜色:金、棕、蓝、红、黄;“红色”“蓝色”等别名尚未支持。
|
||||
- 当前支持绿、红、黄、白、蓝五种喜色,同时兼容“绿色”“红色”等带“色”后缀的值。
|
||||
- 天气值当前只校验为非空字符串,尚未限制为晴、阴、雨等固定枚举。
|
||||
- 指令 JSON 仍要求只有一个字段,同时包含天气和喜色会被拒绝。
|
||||
- 沿用原有单次模型命令分发机制,同一次模型响应中的后续指令不会重复触发。
|
||||
@@ -305,10 +310,10 @@ return domain_runtime_request_expression(&request);
|
||||
|
||||
### 6.2 修改或扩展喜色
|
||||
|
||||
如果只调整颜色与五行的关系,修改集中映射表即可。例如将棕改成绿且仍对应木:
|
||||
如果只调整颜色与五行的关系,修改集中映射表即可。例如将绿色改为青色且仍对应木:
|
||||
|
||||
```c
|
||||
{"绿", DOMAIN_WUXING_ELEMENT_WOOD},
|
||||
{"青", DOMAIN_WUXING_ELEMENT_WOOD},
|
||||
```
|
||||
|
||||
如果要兼容颜色别名,可以将多个字符串映射到同一元素:
|
||||
@@ -326,18 +331,18 @@ return domain_runtime_request_expression(&request);
|
||||
|
||||
```text
|
||||
/*{"天气":"晴"}*/
|
||||
/*{"喜色":"金"}*/
|
||||
/*{"喜色":"棕"}*/
|
||||
/*{"喜色":"蓝"}*/
|
||||
/*{"喜色":"绿"}*/
|
||||
/*{"喜色":"红"}*/
|
||||
/*{"喜色":"黄"}*/
|
||||
/*{"喜色":"白"}*/
|
||||
/*{"喜色":"蓝"}*/
|
||||
/*{"喜色":"紫"}*/
|
||||
```
|
||||
|
||||
预期结果:
|
||||
|
||||
- 天气“晴”只输出预留日志,不改变 LCD。
|
||||
- 五种标准喜色分别显示金、木、水、火、土 UI。
|
||||
- 绿、红、黄、白、蓝分别显示木、火、土、金、水 UI。
|
||||
- 不支持的“紫”不播放随机五行 UI,并输出失败日志。
|
||||
- 喜色 UI 播放完成后正常返回基础表情。
|
||||
- 原按键五行功能继续随机显示结果。
|
||||
|
||||
Reference in New Issue
Block a user