| 241 | } |
| 242 | |
| 243 | flattenTaskList(taskResult) { |
| 244 | if (!taskResult || taskResult.code !== 0) return []; |
| 245 | const root = taskResult.result; |
| 246 | if (Array.isArray(root)) return root; |
| 247 | if (Array.isArray(root?.list)) { |
| 248 | if (root.list.some(item => item && Object.prototype.hasOwnProperty.call(item, "taskId"))) { |
| 249 | return root.list; |
| 250 | } |
| 251 | return root.list.flatMap(group => Array.isArray(group?.taskList) ? group.taskList : []); |
| 252 | } |
| 253 | return []; |
| 254 | } |
| 255 | |
| 256 | async autoByUserOperation() { |
| 257 | await this.autoTodayFullWaterTask(); |