TaskPollingAdaptor 定义轮询所需的最小适配器接口,避免 service -> relay 的循环依赖
| 25 | |
| 26 | // TaskPollingAdaptor 定义轮询所需的最小适配器接口,避免 service -> relay 的循环依赖 |
| 27 | type TaskPollingAdaptor interface { |
| 28 | Init(info *relaycommon.RelayInfo) |
| 29 | FetchTask(baseURL string, key string, body map[string]any, proxy string) (*http.Response, error) |
| 30 | ParseTaskResult(body []byte) (*relaycommon.TaskInfo, error) |
| 31 | // AdjustBillingOnComplete 在任务到达终态(成功/失败)时由轮询循环调用。 |
| 32 | // 返回正数触发差额结算(补扣/退还),返回 0 保持预扣费金额不变。 |
| 33 | AdjustBillingOnComplete(task *model.Task, taskResult *relaycommon.TaskInfo) int |
| 34 | } |
| 35 | |
| 36 | // GetTaskAdaptorFunc 由 main 包注入,用于获取指定平台的任务适配器。 |
| 37 | // 打破 service -> relay -> relay/channel -> service 的循环依赖。 |
no outgoing calls
no test coverage detected